355
21
Data‐DrivenSoundPack
LoadingandOrganization
Simon Franco
The Creative Assembly
21.1Introduction
Typically, a game’s audio data, much like all other game data, cannot be fully
stored within the available memory of a gaming device. Therefore, we need to
develop strategies for managing the loading of our audio data. This is so we only
store in memory the audio data that is currently needed by the game. Large audio
files that are too big to fit into memory, such as a piece of music or a long sound
effect that only has one instance playing at a time, can potentially be streamed in.
Streaming a file in this way results in only the currently needed portion of the file
being loaded into memory. However, this does not solve the problem of how to
handle audio files that may require multiple instances of an audio file to be
played at the same time, such as gunfire or footsteps.
Sound effects such as these need to be fully loaded into memory. This is so
the sound engine can play multiple copies of the same sound effect, often at
slightly different times, without needing to stream the same file multiple times
and using up the limited bandwidth of the storage media.
To minimize the number of file operations performed, we typically organize
our audio files into sound packs. Each sound pack is a collection of audio files
that either need to be played together at the same time or within a short time pe-
riod of each other.
Previously, we would package up our audio files into simplified sound packs.
These would typically have been organized into a global sound pack, character
sound packs, and level sound packs. The global sound pack would contain all
audio files used by global sound events that occur across all levels of a game.
Get Game Engine Gems 2 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.