Monday, 20 June 2011

Kicking ass

Sometimes virtual functions can reveal their bad side which is repeating code. After all virtual functions are a lot like switch-case in traditional C. I noticed that when re-factoring kicking for objects. Each object type has virtual Kick function, but it's starting to look like the data-driven style is kicking back with generic code that looks like it could be placed in one function. Good thing is that such function already exists, I just never thought it could be more generic. It's of course Damage, a routine that has caused a lot of pain to program.

Sometimes I wonder why it took so long to "return" to this stage, where stuff begins to work like it should (for example kicking objects). Did I really spend six years refactoring the game engine?

No comments:

Post a comment