Friday, October 1, 2010

Press Start to Debug

As a short follow-up to the previous post, I thought I would mention some other useful debugging-related features you can add to your codebase.

Firstly, splitting your game camera and viewing camera will let you track down lots of issues easier. Alot of games will not (should not) render objects off-screen, but if you cannot see off-screen are you sure this is happening correctly? Having a second camera which can be zoomed out above the 'game' camera will allow you to see exactly how far off the screen your objects are still visible, and when they are being deleted, et cetera.

You can use your debug primitives rendering to display the game-camera bounding box so you can see it clearly from your debug camera. You can also zoom in closely and make sure your objects are being rendered correctly, look for minor visual issues, and inspect your tiny particle effects to make sure they look correct and artifact-free.

To help with all of this, it is extremely useful to put proper debug pause support into your game. Have a key/button for pausing all of the game entirely, but continue rendering each frame (your logic is not being run in the render code, right?!). From this state you can move around with your debug camera and inspect things in their paused state.

Make sure you add a single-frame-step key to your debug pause system, it will be immensely useful for inspecting particle effects, checking object behaviour, and looking at game state before a crash/bug occurs.

No comments:

Post a Comment