Is four days enough to develop a roguelike? Yes, there is proof. Is it enough time to test it thoroughly and ensure that it is bug free? Unlikely! In any case, Chronophase was released at the 4-day mark with 3 known bugs, all of which I’ve just now corrected.
These were, in order of priority:
- Enemies were being prematurely removed from the TurnManager (the priority queue handler that handles turns and energy use). This caused enemies to stay stuck in place without shootin’ or movin’.
- Some values of the TurnManager priority queue were mysteriously set to null, crashing the game with Flash’s equivalent of a null pointer error.
- In certain cases, if an enemy shot twice in a row, it was possible for it to destroy its first projectile, due to the order of turn updates inherent in the system.
I list #2 as lower priority than #1, even though #1 didn’t cause a fatal error, because I had a feeling that fixing #1 would fix #2 (and it did). In an ironic turn of events, it was bug #3 that was causing both #1 and #2:
Projectiles were being removed from the TurnManager prematurely, which registered at an index of -1 in the priority queue (not found). I would imagine that AS3’s Array.splice() function, used to delete and insert items at random positions in an array, would ignore an index of -1 and be on its way (it did not). The moment I started checking that the requested splice index be > 0, the first two bugs disappeared.
Bug #3 needed some special case handling to ensure that existing projectiles are allowed to update their position before a new one, shot by the same enemy, can destroy it.
And that did it!