, ,

I am an eejit. While trying to fix the performance issues a month ago, I think I broke the spammers’ sound detection. However, I didn’t realise this until I tried making them go on alert if they heard a SQL round miss. I’m not even sure if that’s when it happened!

The root cause of this bug is that I had converted their sound detection to use a Coroutine with a 0.2-second interval, rather than OnTriggerStay. OnTriggerStay runs on the physics timestmp, which by default is 50 times a second – which is a bit more intensive than I wanted. However, when converting it, I forgot to actually make it run more than once! So, the spammers were effectively deaf, which pretty much defeated the point of the game.

Another thing that was broken was their Sockpuppet detection. This was a physics issue – I had set the Spammer layer to ignore collisions with the Decoy layer. However, that’s the layer which is supposed to contain the Sockpuppets!

There are two things that would have helped with this:

  • Automated testing. I might have noticed this if I had a dedicated scene where I can set some bots to detect and attack things in a controlled setting. This
  • Source control. Why should I try remembering what I changed last week when the computer has a record of that for me? I have some familiarity with Git in my day job.