Trading Places

Created with Sketch.

Trading Places

After 2 hours, it’s done, and it works. By “It” I mean the back up code. Other, different things are broken now. Enemies feel the touch of pain, but do not flinch. They also decide to get into a staring contest with you if they happen to do the now working backing up behaviour. They can, and will stare at you for hours. I’d like to think that they’re plotting some kind of mysterious plan, some scheme for world domination. They’re not though. In fact, they’re standing there because some variable wasn’t passed correctly and the required triggers aren’t being, well, triggered.
But I’m okay with that. The AI code is now restructured and is now understandable by the proud owners of brains. Me for example. Once I got the code restructured, I did almost the same tests I tried previously, but now, I got a result.
The problem was the Range Finder. Basically, it’s code that figures out how far away enemies are from The Thief. It’s modifiable for different kinds of enemies and pretty sweet. Issue is, it’s a basic AI function like the physics model so it runs every cycle. So, when the back up thing was summoned it then ran the Range Finder. When the RF found that there are no attacks going on, it assumed that it needed to change the state of the enemy. That’s why enemies would back up for a 1/30th of a second.
So, in the end, it turns out the problem wasn’t systemic. But without rearranging the code to be readable (by real humans even!) I probably would have not found it. So, now, finally, I can fix the last little pieces, regression test the bastards and get my bloody throw and counter system installed. I’m trying to organize a meeting this weekend, so I really want to have something new and cool to show everybody. It would be extra cool if it fuggin worked.