This thread is for stories of bugs you’ve created or fixed that were particularly funny, interesting, or memorable, for whatever reason.
Mine is as follows: About 7 years back, I was working on Battletanx: Global Assault for the Nintendo 64. We had a weird recurrent bug where every vague once in a while, something would go wrong in the collision/physics system, and the tank wouldn’t properly run into walls, wouldn’t fit through gates, etc. For quite a while, we thought that the collision boxes in the world had gotten messed up, but eventually we figured out it was something with the tank.
Debugging this was VERY hard because it would almost never happen, so we couldn’t just sit down, reproduce it, and start going. Finally, it started happening on a system with a debugger attached, and after much poking around, we realized that the tank’s collision box was messed up. In fact, it was rotated around by 90 degrees, so that the collision system thought the tank was wider than it was long (instead of the other way around). How did this happen?
So we started grepping through all of our code, looking for places that collision boxes got rotated, and we did find one interesting thing, which is that when immovable buildings were put into the world, if they were axis aligned (that is, at 0, 90, 180, or 270 degrees rotation) they would be rotated around to 0 degrees, with their width and height swapped around respectively. But that only applied to immovable buildings, not tanks, right?
But wait! One of the features our tank had was a teleporter powerup. And the way the teleporter worked was that it would first find a spot to teleport to, because you don’t want to appear in the middle of a wall. Then it would reserve that space, so that no one could drive into it in the middle of the teleportation (which took a few seconds). But how did it reserve that space? By moving the tank’s collision box there, and TEMPORARILY MAKING IT INTO AN IMMOVABLE BUILDING. So, whenever we teleported the tank, we would pick a random heading for it, which was a int16, and if that int16 happened to be precisely 16K or 48K, our collision system would screw up the tank’s collision box. But of course, there was no immediate or obvious link to the teleporting, and it only happened very occasionally. That was nasty.
We also had a relatively mundane bug in which our list of models would get randomly shuffled, resulting in driving buildings around and firing trees instead of driving tanks and firing bullets. That was so neat looking that we stuck it in as an easter egg.