GGS Debug Library

2007-04-24

I'm working on some game libraries, tools and utilties. The first thing I'm posting is some debugging libraries. Stuff I use while making a game, specifically a console game.

There's 4 major parts to it

  1. a debug console.

    This is just the ability to do a printf to the display. Most development systems let you print to a terminal or inside the debugger. The problem with those systems is the artist, the desginer or myself is not looking at the debugger. We are looking at the game. Therefore, important messages need to be displayed in the game or they will go un-noticed.

    On top of that, games generally erase and re-draw the entire screen every frame so some method of re-drawing the messages needs to be created. Without a system like this that process can get quite cumbersome.

    The systmem supports output in different colors as well as flashing output to make very important messages stand out.

  2. print to the debug terminal

    Most dev systems have an OutputDebugString type of way to get a message to the terminal. These are just wrappers that provide more functionalty like printf and so I have one place to fix if I switch engines.

  3. print to the screen

    Again, most systems have a DrawText function that will draw a string. I just always need wrappers so I can do printf style formatting and again, I want it in one place so if I switch engines I don't have to learn a new api or change other code to use a new api.

  4. debug menus

    This is the biggest part. These are menus, controllable from the joypad/controller that you can pull up in the game to inspect and or edit things in realtime.

For all of these my #1 goal was to make something easy to use. So for example there is no need to init any of them. While you can set a few parameters they will work without any settings. The menus and the console only require 1 function to be called for them to operate, etc...

The menus in particular have been designed to be easy to add items to with lots of default handlers. In one line you can add menus that edit bools, ints, floats, either directly or can edit them through functions or even member functions. Menus that call callbacks in C style, CPP function object style and member function style.

They handle enums, although you need to supply a value−label table. They can also handle STL collections and display them as menu items.

Some other features.

Anyway, I have no idea if anyone other than me will find these useful. I know that many teams are using systems that have other ways to accomplish this kind of thing. For me though I have found them useful and so have the teams I've been on. It's my hope that now that I have my own I'll never have to write them again.

If you are interested you can find them on sourceforge here. They are released under the NewBSD license so use them how ever you want. There are not a lot of docs yet but the code is pretty well commented. There's also a file called debugmenus_examples.cpp that shows how to setup a bunch of different kinds of menus. And, there's a Win32 sample as well to actually see them run. To keep it simple the sample uses the keyboard to emulate a joypad. The cursor keys are the DPAD. The space bar is the Action button if you want to call it that. Think X on the PS3 or A on the 360. Backspace is the cancel button.

Comments
Licenses vs Original IP revisited
Ranking Zeldas