Wednesday, 13 April 2011


Sometimes, there's just something in your code that niggles away at you, making your life more awkward until one day you decide you've had enough, reach for the refactoring chainsaw and refactor the buggery out of it.  Today, I reached that point.

In this case, it was a couple of aspects of the main game object class structures that, although sensibly designed at the beginning of development, has since grown into a significant bugbear (as shown in Figure 1).  Basically, I'd shoved a templated structure too high up in the hierarchy, meaning that I was having to do a lot of dynamic casting between different interfaces as it wasn't really possible to have a single interface that had access to all the important bits (in this case the object's activity state, pose, dynamics, collision properties and damage interface) due to this templated bit sitting in the middle (which was a subobject list, in case anyone cares). 
Figure 1: Artist's depiction of a bugbear.
To simplify development, I shifted this templated element down to the bottom of the hierarchy.  Of course, this involved screwing with a lot of the core code and, as you'd expect, it's taken a fair amount of time to get everything back up and running again.  There's still some additional validation to do, but it's generally all looking promising and should make my life easier in future.

In general news, the ship missiles are now coupled with one of the space-warping effects, making them look quite sexy (should make a video), although I still need to create a larger explosion graphic to go with it.

I'm heading back up to the North of the UK for a week soon to see my folks and, unfortunately, my laptop doesn't have DirectX 10 hardware, making working on Juggernaut more tricksy.  However, I do have a fair amount of work to do on improving the collision physics that doesn't really need pretty graphics, so this seems like a good time to do it.