Game Development Reference
In-Depth Information
Chapter 6. Sound
Though sometimes overlooked, sound is an important component of
games. Whether it's to provide audio cues to gameplay situations or en-
hance the overall atmosphere, games lose a great deal without quality
sound. To experience how important sound is, try playing one of your
favorite games on mute—something is definitely lost if the sound is dis-
abled.
This chapter first covers how source data is translated into “cues” that
are played back by the game code. It then moves on to more advanced
sound techniques, such as the Doppler effect, digital signal processing,
and sound occlusion, that might be used in certain situations.
Basic Sound
At the most basic level, sound in a game could simply involve playing back stan-
dalone sound files at the appropriate points in time. But in many cases a single
event does not necessarily correspond to a single sound. Suppose a game has
a character who runs around the world. Every time the character's foot hits the
ground, a footstep sound should play. If there were only one single footstep sound
file played over and over again, it would very quickly be repetitive. At the very
least, it would be preferable to have multiple footstep sounds that are randomly
selected among every time the footstep is triggered.
Anadditionalconsiderationisthatthereisafinitenumberof channels ,orseparate
sounds, that can be played simultaneously. Imagine a game where a large number
of enemies are running around the player—if all of them play their footstep
sounds,itmayveryquicklyuseupalltheavailable audiochannels. Certain sounds
are going to be far more important than enemy footstep sounds, and so there needs
to be some sort of prioritization system, as well. All of these considerations, and
more, very quickly lead to a situation where we need more information than what
is stored in a sound file. Because of this, most games store an additional set of
data that describes how and in what circumstances specific sound files should be
played.
Search WWH ::




Custom Search