Refactoring Time

posted in Beals Software
Published April 17, 2012
Advertisement
Well, while finishing up the 2nd prototype for SAGE I found a pretty glaring design in my codebase: my AnimatedSprite class has state data, so it doesn't cache well. I could get around this by cloning it when loading, but that would be a very large band-aid and leave me a MUCH bigger mess to clean up later. Instead I decided to correct the issue last night and in doing so I have broken every game project I have started. As I'm going to be going through and correcting the projects and recreating all of my sprite resources, I decided now would probably be a great time to do some refactoring and some other much needed updates to my codebase.

I have the worst feeling that this is going to be a nightmare...

[edit]
One day and MANY, MANY changes later I realize: I'm a moron. I finally got around to updating my game object system to account for the changes I made, just to realize: there really isn't anyway for me to have a 'game object' that is loaded from a file without it containing said state data (yes, I could have GameObjectData and a separate GameObject class, but I'm really not a fan of that design.)

So, I think to myself: ohmy.png I can just use cloning on my AnimatedSprite class when it's importing! Wait a minute, what's this? 'AnimatedSprite : ICloneable' Yup, I was already using cloning as it was the solution I implemented to allow me to finish the 2nd prototype for SAGE. I feel so smart right now, you don't even know.

As I use source control I can easily revert my changes. The problem is, I don't remember what all of those are other than 'I had some good ones...somewhere.' Time to trudge through my source control.
[/edit]

[edit]
Forever and a day later...I'm finally done reverting and updating. I ended up trudging through the diff for each file to decide whether or not I wanted to revert (very few to no changes) or if I wanted to skip/manually revert. In the end it was totally worth it as the asset system is way better and I have a basic GameObject system in place.

Bed time for now, but back to work on SAGE tomorrow!
[/edit]
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement
Advertisement