Thursday 3 September 2009

C64 :: bugs and tanks

The code that manages the likkle tanks went into GR9 Strike Force yesterday (for speed, the various objects are driven by discrete blocks of code rather than a generic management routine) along with a first draft of their firing routines; at first everything seemed happy bunnies and they'd tootle into the play area, stop after a distance set by the wave data and began firing, exactly what they're meant to do until something odd started happening...

It took about three damned hours to diagnose, but the symptom was that Tank 1 would drive into play from the bottom of the screen, park up and start shooting normally. Then the attack wave manager would throw a couple of passing aircraft into the mix before getting to the data for Tank 2. Just after Tank 2 was assigned (using up the last available object) Tank 1 wanted to fire and couldn't find a free object for it's bullet. The routine has a contingency which essentially suppresses the urge and resets the counter as though the shot happened... but it'd mangle one of the registers on the way out (it should've recovered it from a storage location, but the command got lost in the wash) with the result being that the attempted bullet firing dented a table of timers so Tank 1 forgot it was in "stopped and firing" mode and promptly drove away!

Silly likkle tank.

No comments: