Game Development Reference
In-Depth Information
n Memory/frame rate: In debug versions of your game, it can be very useful to
draw current memory and frame rate information every few seconds. Don ' tdoit
every frame because you can
'
t really see things that fast, and it will affect your
frame rate.
n Coordinate axes: A classic problem with 3D games is that the artist will create
3D models in the wrong coordinate system. Draw some additional debug
geometry that shows the positive X-axis in red, the positive Y-axis in green, and
the positive Z-axis in blue. You
'
ll always know which way is up!
n Wireframe: You can apply wireframe drawing to collision geometry to see if
they match up properly. A classic problem in 3D games is when these geome-
tries are out of sync, and drawing the collision geometry in wireframe can help
you figure out what
'
s going on.
n Targets: If you have AI routines that select targets or destinations, it can be
useful to draw them explicitly by using lines. Whether your game is 3D or 2D,
line drawing can give you information about where the targets are. Use color
information to convey additional information such as friend or foe.
Every 3D Game Needs a Test Object
In 3D games,
s a good idea to construct a special test object that is asymmetrical on all three
coordinate axes. Your game renderer and physics system can easily display things like cubes in a
completely wrong way, but they will look right because a cube looks the same from many different
angles. A good example of an asymmetrical object is a shoe, since there
it
'
s no way you can slice it and
get a mirror image from one side to another. In your 3D game, build something with similar properties,
but make sure the shape is so asymmetrical that it will be obvious if any errors pop up.
'
Lint and Other Code Analyzers
These tools can be incredibly useful. Their best application is one where code is being
checked often, perhaps each night. Dangerous bits of code are fixed as they are
found, so they don ' t get the chance to exist in the system for any length of time. If
you don
t have Lint, make sure that you ramp up the warning level of the compiler as
high as you can stand it. It will be able to make quite a few checks for you and catch
problems as they happen.
A less useful approach involves using code analysis late in your project with the hope
that it will pinpoint a bug. You
'
ll probably be inundated with warnings and errors,
any of which could be perfectly benign for your game. The reason this isn
'
t as useful
at the end of your project is that you may have to make sweeping changes to your
code to address every issue. This is not wise. It is much more likely that sweeping
changes will create a vast set of additional issues, the aggregate of which could be
'
 
 
Search WWH ::




Custom Search