Game Development Reference
In-Depth Information
static float dbgVelocity = 2.74f;
SetParticleVelocity(dbgVelocity);
// More code would follow....
}
It then becomes a trivial thing to set a breakpoint on the call to SetParticle
Velocity() to let you play with the value of dbgVelocity in real time. This is
much faster than recompiling and even faster than making the value data driven,
since you won
'
t even have to reload the game data.
Once you find the values you ' re looking for, you can take the time to put them in a
data file.
Caveman Debugging
If you can
t use a debugger, you get to do something I call caveman debugging. You
might be curious as to why you wouldn ' t be able to use a debugger, and it ' s not
because you work for someone so cheap that they won
'
ll
see problems only in the release build of the application. These problems usually
result from uninitialized variables or unexpected or even incorrect code generation.
The problem simply goes away in the debug version. You might also be debugging
a server application that fails intermittently, perhaps after hours of running nomi-
nally. It
'
t buy one. Sometimes you
'
'
s useless to attempt debugging in that case.
Logging Is Your Friend
Make good use of stderr if you program in UNIX or OutputDebugString() if you program under
Windows. These are your first and best tools for caveman debugging. Most games have a relatively
complex logging system that uses a number of different logging and caveman techniques for displaying
debug information. You should do the same.
In both cases, you should resort to the caveman method. You ' ll write extra code to
display variables or other important information on the screen, in the output win-
dow, or in a permanent log file. As the code runs, you
'
ll watch the output for signs
of misbehavior, or you
ll pore over the log file to try to discern the nature of the bug.
This is a slow process and takes a great deal of patience, but if you can ' t use a
debugger, this method will work.
'
Being Hypnotized by the Ultima Online Login Servers
When I was on UltimaOnline, one of my tasks was to write the UOlogin servers. These servers were the
main point of connection for the Linux game servers and the SQL server, so login was only a small
portion of what the software actually did. An array of statistical
information flowed from the game
 
 
Search WWH ::




Custom Search