MotoGP: debug cameras

When developing 3D games it is useful to have a debug camera that lets you quickly move around the world and view things from any angle. Without this you will waste a great deal of time laboriously moving your player character to the areas you want to view, struggling to reach awkward places, cursing when you accidentally fall off a ledge and die halfway to the place you wanted to check out, etc.

It is possible to navigate a free camera with a gamepad, but much nicer using a mouse. Xbox does not support mouse input, so we reused the MotoGP tweakable system to remote it. We wrote a Windows app (called MouseTrap) that let you click, drag, and press keys anywhere within its window, captured this input, and sent it via telnet to the Xbox devkit. When the telnet console received mouse input it switched the camera to debug mode, disabling the normal camera update and collision logic so you could fly freely around the world.

This was particularly useful in conjunction with the run/stop tweak, because you could move the debug camera even when the game was otherwise stopped. This allowed us to freeze gameplay and examine a scene from different angles: invaluable for debugging rendering problems and framing screenshots!

George added a function where clicking the left mouse button would teleport your bike to the current debug camera location. This was a great way to get to the opposite side of the level, as flying the camera and then teleporting the bike was faster than driving the long way around. Also, much fun was to be had dropping bikes from great heights to dive-bomb the track, or confusing everyone by teleporting into the middle of a network test session 🙂

Our debug camera had two modes. Normally, all drawing code was aware of the debug camera position, so the visibility and level of detail calculations could adapt as the camera moved around the world. But we also had a mode where the camera would lie, claiming it was still at the original non-debug position when asked by anyone other than the final view matrix computation. This allowed us to view the scene from one angle, but have visibility computed as if we were viewing it from somewhere else, which is handy for making sure the visibility system is working properly.

Comments (0)

Skip to main content