Jump to content
  • Advertisement
  • entries
    707
  • comments
    1173
  • views
    436037

Refactoring Time

Sign in to follow this  
Programmer16

1025 views

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]
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!