YouTube Gamer Helps Me Crush Bugs!

I debated writing this post because to be quite honest, it feels a little “vulnerable” talking about bugs that I should have caught, or exposing things I didn’t think about. However, if other new devs are viewing this, hopefully it encourages them to know that these things happen, and this is just how it goes sometimes (at least in my experience). That said, there’s nothing more motivating to patch bugs than seeing them broadcast by independent parties on Youtube. I sent keys out to some folks to help get coverage and feedback. One of them was who posted this video today:

I’m super grateful for his post (he has nearly 7,000 followers), but the very public exposure of some bugs made me cringe a little inside. There was one GLARING bug that I was aware of but as a developer you sometimes become “numb” to because in your mind it’s minor.. That is the score increments when you die but your last life there’s a discrepancy between your printed score and your High Score.  It turns out a race condition of the enemy death vs the player being cleaned up b/c it was his last life was the root cause. That was an easy fix.

The second was new to me and I ALMOST missed it watching his video. In the middle of the video he starts a new game and dies once, then almost clears the FIRST wave and dies with 2 enemies left on the screen. Then you see “Wave 4” pop up as he starts his new life.

Wait a minute! How did he jump from Wave 1 -> Wave 4? At first I thought just video edited to bypass some gameplay but I rewatched it and sure enough the score stayed the same, there was no cut, that was in fact a bug.

Thanks to it being recorded I was able to replicate pretty easily. What I realized is that I had the logic for broadcasting events in an if statement in the main update loop of the Spawn Controller (those orange things that spit out enemies). There’s a few boolean logic conditions that come together to fire a “wave update” signal to the game and it seems when there are 3 or fewer enemies left in the wave and you die – that get’s fired for a few frames before the slots / callbacks respond to them! I realized I didn’t need that check every frame and moved it to the logic that only gets fired when an enemy dies. So far, I can’t reproduce the issue now!

So that’s how my day began – now onto creating bosses 🙂