Game Development Reference
In-Depth Information
The Best Hack I Ever Saw
I recall a truly excellent hack we encountered on Savage Empire, an UltimaVI
spin-off that Origin shipped in late 1990. Origin was using Borland
'
s 3.1 C
Compiler, and the runtime module
s exit code always checked memory
location zero to see if a wayward piece of code accidentally overwrote that
piece of memory, which was actually unused. If it detected that the memory
location was altered, it would print out
'
at
the top of the screen. Null pointer assignments were tough to find in those
days because the CPU just happily assumed you knew what you were doing.
Savage Empire programmers tried in vain to hunt down the null pointer
assignment until the very last day of development. Origin
Error: (null) pointer assignment
s QA had signed
off on the build, and Origin execs wanted to ship the product, since
Christmas was right around the corner. Steve, one of the programmers,
'
the problem with an
amazing hack. He hex edited the executable, savage.exe, and changed the text string
fixed
Error:
(null) pointer assignment.
to another string exactly the same length:
Thanks for playing Savage
Empire.
If the memory corruption seems random writing to memory locations here and
there without any pattern
s a useful but brute force trick: Declare an enormous
block of memory and initialize it with an unusual pattern of bytes. Write a check
routine that runs through the memory block and finds any bytes that don
here
'
'
t match
the original pattern, and you
'
ve got something that can detect your bug.
The Infamous Barge Bug
Ultima games classically stored their game data in large blocks of memory,
and the data was organized as a linked list. If the object lists became
corrupted, all manner of mayhem would result. A really bad one happened
to me on my very first project, Martian Dreams. QA was observing a bug
that made the Martian barges explode. The objects and their passengers
would suddenly shatter into pieces, and if you attempted to move one step
in any direction that game would crash. I tried again and again to fix this bug.
Each time I was completely sure that the barge bug was dead. QA didn
t
share my optimism, and for four versions of the game I would see the bug
report come back:
'
Not fixed.
The fourth time I saw the bug report, my exhausted mind simply snapped. I
don
t need to tell you what happened, because an artist friend of mine, Denis, drew this picture of me in
Figure 23.4:
'
 
Search WWH ::




Custom Search