Game Development Reference
In-Depth Information
default:
break;
}
}
The ExplosionProcess owns a sound effect and drives the imaginary animation
code. The sound effect is initialized during the VOnInit() call, and VOnUpdate()
handles the rest as you
s a trivial state machine that switches
state as the sound progresses past some constant points, 55 percent and 75 percent
of the way through.
Do you notice the hidden problem with this code? This is a common gotcha in com-
puter game design. What happens if the audio designer decides to change the sound
effect and bring the secondary explosion closer to the beginning of the sound? It
'
ve seen before. There
'
s
equally likely an artist will change the timing of an animated texture, which could
have exactly the same effect. Either way, the explosion effect looks wrong, and it
'
'
s
'
anyone
s guess who will get the bug: programmer, artist, or audio engineer.
The Butterfly Effect
Code, animations, and sound data are tightly coupled and mutually dependent
entities. You can
t easily change one without changing the others, and you can
make your life hell by relating all three with hard-coded constants. There
'
sno
silver bullet for this problem, but there are preventative measures. It might seem
like more work, but you could consider factoring the ExplosionClass into
three distinct entities, each with its own animation and sound data. Either way,
make sure that you have some asset tracking so you can tell when someone
changes anything in your game: code, sounds, or animations. When something
breaks unexpectedly, the first thing you check is changes to the files.
'
Mixing Issues
Sound in your game will include sound effects, music, and speech. Depending on
what
s going on, you might have to change the volume of one or more of these ele-
ments to accentuate it. A good example of this is speech, and I
'
m not talking about
the random barks of a drunken guard. Games will introduce clues and objectives with
AI dialogue, and it
'
s important that the player be able to hear it. If you played Thief:
Deadly Shadows, there
'
s a good example of this in the Seaside Mansion mission about
halfway through the game. The thunder and lightning outside were so loud it was
difficult to hear the AI dialogue.
That
'
s one of the reasons there is this notion of SoundType in our audio system. It
gives you a bit of data to hang on to if you want to globally change the volume of
'
 
 
Search WWH ::




Custom Search