Saturday, October 31, 2020

Cancelled refactoring

I had a checkbox in my notebook asking whether BlockArea really needs to be a full-fledged GameObject or could be something simpler. So I started to refactor things and see whether we couldn't have more features moved from GameObject into CommonGob instead.

Yeah, I know. You're lost. 

Let's start with GameObject. That one is how the engine sees Bilou, Bladors and all the other characters in the game.

Now the 'BlockArea'. This is a temporary object that captures information about where a GameObject interacts with a special block on the map. During that time, that part of the map must be able to trigger and get collisions.

The part that annoys me is how being a GameObject implies being an Animator. That implies being registered with the engine. There's no good reason for BlockArea to be an Animator: it won't exist for more than one frame. But because being a GameObject implies being an Animator, I have no choice.

Or do I ? I started trying to change the inheritance graph so that now CommonGob -- the thing I introduced to capture what was previously into SimpleGob (AppleAssault-like GOBs made of only one hardware sprite) but had to be shared with CompoundGob (SchoolRush-like GOBs made with AnimEDS). 

But that turned out to be a bad idea: many parts that used GameObject (including the script-parsing code) assumes that GameObjects are Animators that can be played, stopped, etc. 

So I'll have to roll back and return the things as they are. That would have been a nightmare in the CarzyBrix era, but hopefully, it's just one command in mercurial. 

c:> oubliette


No comments: