Game Development Reference
In-Depth Information
It might seem odd to perform experiments on software, certainly odd when you
wrote the software in question. Scientists perform experiments on complicated phe-
nomena that they don
t understand in the hopes that they will achieve knowledge.
Why then must programmers perform experiments on systems that spawned from
their own minds? The problem is that even the simplest, most deterministic systems
can behave unpredictably given particular initial states. If you
'
'
ve never read Stephen
Wolfram
s book, A New Kind of Science, take a few months off and try to get through
it. This topic makes some surprising observations about complex behavior of simple
systems. I ' ll warn you that once you read it, you may begin to wonder about the
determinism of any system, no matter how simple!
'
Hypothesis, Experimentation, and Analysis
Debugging is a serious scientific endeavor. If you approach each debugging
task as an experiment, just like you were taught in high school, you
'
ll find
that debugging is more fun and less frustrating.
Complex and unpredicted behavior in computer programs requires setting up good
debugging experiments. If you fell asleep during the lecture in high school on the
scientific method, now
s a good time to refresh your memory. The examples listed
in Table 23.1 show you how to run a successful experiment, but there
'
s a lot more
to good debugging than blindly running through the experimental method.
The first step seems easy: Observe the behavior of the system. Unfortunately, this is not
so easy. The most experienced software testers I know do their very best to accurately
observe the behavior of a game as it breaks. They record what keys they pressed, what
options they turned off, and as best they can exactly what they did. In many cases, they
leave out something innocuous. One of the first things I do when I don
'
t observe
the same problem a tester observed is go down to the test lab and watch them
reproduce the bug myself. Sometimes, I
'
'
ll notice a little wiggle of the mouse or the fact
that they ' re running in full-screen mode and have a Eureka moment.
Bugs in Games Are Extremely Tricky to Find
Unlike most software systems, games rely not only on random numbers but also
change vast amounts of data extremely quickly in seemingly unpredictable ways.
The difficulty in finding game bugs lies in the simple fact that games run so
much code so quickly that it
s easy for a bug to appear to come from any of
the many subsystems that manipulate the game state.
'
Search WWH ::




Custom Search