Game Development Reference
In-Depth Information
Most C++ debuggers, Visual Studio included, let you look at your source code at the
same time as the assembly code. Take some time to learn how each C++ statement is
broken down into its assembly instructions, and you
'
ll end up being a much better
programmer for it. Fear not
I
'
m with you in spirit, and I wasn
'
t born with a full
knowledge of assembly.
Atari 2600 Games for Fun and Profit
I first learned x86 assembly language in college on an old 8088 processor. We
created little assembly language programs that would write to the serial port and
control different circuits we built on breadboards. It was a huge amount of fun! In
an attempt to teach myself another form of assembly (6502 in this case), I started
working on a small game for the Atari 2600. Using assembly language for fun little
projects like these is a great way to teach yourself this useful tool.
The Art of Handling Failure
If you are looking for some wisdom about handling personal failure, stop reading and
call a shrink. My focus here is to discuss application failure, the situation where some
defensive code has found an anomaly and needs to handle it. There
s a great conver-
sation you can start with a group of programmers about how to handle errors or fail-
ures in games. The subject has more gray area than you
'
'
d think, and therefore it
'
doesn
t have a single best strategy. The debate starts when you ask if games should
ignore failures or if they should stop execution immediately.
I
m talking about the release build, of course. The debug build should always report
any oddity so that programmers can catch more bugs in the act. The release build
strips asserts, so there
'
s a good question about what should happen if the assert con-
dition would have been satisfied in the release build. Does the game continue, or
should it halt? As with many things, there
'
'
s no right answer. Here
'
s an example of
two functions that handle the same error in two different ways:
void DetectFixAndContinue(int variable)
{
if (variable < VARIABLE_MINIMUM)
{
variable = VARIABLE_MINIMUM;
GCC_ERROR(
Parameter is invalid
);
}
// More code follows...
}
void DetectAndBail(int variable)
 
 
Search WWH ::




Custom Search