Bug killed ! Finally !

So finally i have tackled this nasty bug in my game which bed-bug-exterminator-hmakes all my animations really weird when using a tool like a shotgun… it was very difficult to find it because there was a mix of action cleaning stuff with states check routines and, at the end, my code was really difficult to understand.
So to track it, I have refactored a lot of code in order to make me understand what happened. The final code is still complicated and I am not satisfied with it but at least I can now continue to implement ranged attacks.
The cool thing is that to track the bug, I am now able to decrease/increase the speed of the game with a keyboard shortcut. I am sure this would help me a lot for future bug tracking.

All this thing make me realise that it is very difficult to debug a game because of the real-time process:

  • you can’t really use breakpoint because they will stop the process on every frame.
  • you could use a conditional breakpoint to reach a bad state. You will be able to see the context but you will not be able to track all the history.
  • forget to log every step, you will have zillions lines of logging where it will be difficult to find any relevant information.
  • some would tell me to unit tests but as I explained above, it so dependent on the context that it is difficult to reproduce it.

I don’t know how real game studio are working but I am sure some technics (that I don’t know) exist.