Version
This method will apply if:
The game has a large number of in-memory media assets.
The media requirements are difficult to predict in advance by the sound designer.
The project uses Switches and States to determine which sound or motion objects will play for a specific Event.
Sounds can't easily be split into defined sections.
Games can be very complex and the triggering of sounds and motion can be based on a variety of different factors, including game textures, the time of day, the movement of game objects, and in some cases the Actions of other players for online multiplayer games. In an Event-based or object-based environment, sounds could, for example, be loaded into memory based on the proximity of some other game objects. Every game object could have a list of SoundBanks that must be loaded when they are within a given range or simply because they exist.
Also, Switches and states can determine which objects are played. When an Event playing such objects is added to a SoundBank, all possible media is automatically added to the SoundBank as well. For example, you may have a single Event called “Play_Footstep”. This Event will play the appropriate sound based on the current texture of the ground, which is specified by changing the Switch. Although this works well, it can be a waste of memory keeping the sounds “footstep_sand.wav” or “footstep_winter.wav” ready in memory when the gameplay is happening inside a building in London.
To avoid wasting memory in this case, you can add Events and/or object structures to a SoundBank and then specify which corresponding objects will be included in the SoundBank. For example, let's take footstep sounds on different textures. In this case, we could create the following SoundBanks:
The “EventBank”, which would contain the “Play_Footstep” Event and structure.
The “Winter_Footstep_bank”, which wound contain the media for the footsteps that only occur in some part of the game (winter).
The “Desert_Footstep_bank”, which wound contain the media for the footsteps that only occur in some part of the game (desert).
The “Common_Footstep_bank”, which would contain the media for the footsteps that can occur anywhere (wood, concrete, and so on).
Let's say you have three different textures in your game (snow, sand, and concrete). In Wwise, you have a Switch Container, that plays one of three Random Containers, based on the Switch “ground_texture”. Each of the three Random Containers has four variations of the footstep sound on a given texture.
To create SoundBanks in Wwise that micromanage your media:
Create a SoundBank called “EventBank” and load it into the SoundBank Editor.
Drag the “Play_Footstep” Event to the Add tab of the SoundBank Editor.
Deselect the “Media” check box for this Event, but leave the Events and Structures check boxes selected.
Create the three other SoundBanks, one for each texture.
In each SoundBank, drag the Random Container associated with this texture.
Note | |
---|---|
It would work as well if instead of drag and dropping the Random Containers we would drag and drop each of the sounds individually. But the advantage of using the containers is that all the sounds in the container will automatically be added in the SoundBank instead of having to make all the changes manually if the container's content changes. |
Deselect the “Events” and “Structures” check boxes for each of the three texture SoundBanks, leaving only the Media type checked.
Generate the SoundBanks and copy the generated SoundBank folder to the game application.
At this point, we have four SoundBanks, one that contains the Event and the structure data related to the audio that is to be played, and three others that contain only media associated with a particular ground texture.
To integrate SoundBanks in game using the micromanaging strategy:
In the game, load the common SoundBanks at the beginning of your game and then simply load the other SoundBanks when they are required. For example, the game could load the Event SoundBank and the common footsteps SoundBank at the beginning and then load the other SoundBanks based on the player's actual location in the game.
The following sample of code gives you an idea how these SoundBanks can be loaded in game.
// Load Init and the Eventbank. AkBankID bankID; // Not used in this sample. AKRESULT eResult = AK::SoundEngine::LoadBank( L"Init.bnk", bankID ); if( eResult == AK_Success ) { eResult = AK::SoundEngine::LoadBank( L"Eventbank.bnk", bankID ); } if( eResult == AK_Success ) { eResult = AK::SoundEngine::LoadBank( L"Common_Footstep_bank.bnk", bankID ); } ... // And at various places in the code, possibly based on the location: eResult = AK::SoundEngine::LoadBank( L"Winter_Footstep_bank.bnk", bankID ); ... eResult = AK::SoundEngine::LoadBank( L"Desert_Footstep_bank.bnk", bankID ); ... eResult = AK::SoundEngine::LoadBank( L"Level_3.bnk", bankID ); ... eResult = AK::SoundEngine::UnloadBank( L"Winter_Footstep_bank.bnk" ); ... eResult = AK::SoundEngine::UnloadBank( L"Desert_Footstep_bank.bnk" );
This was only a very specific example of one of many possible things that can be done using this technique. Since it is possible to decide object by object and Event by Event what will be included in every SoundBank, you have complete control over the contents of each SoundBank. Although you could create a separate SoundBank for each object in your game, this would be very difficult to maintain as every new sound or motion object would require new code to load the SoundBank at the right place in the game. The goal for each game is to try and find a good balance between granularity and ease of integration in the game.
Note | |
---|---|
If you are interested in a sound by sound loading scheme, you may want to prepare Events instead of loading entire SoundBanks. For more information on preparing Events, refer to Method 4: Preparing Action Events. |
The following table lists the pros and cons of micromanaging your media.
Pros |
Cons |
---|---|
The best option to optimize memory usage. Gives you full control over what media is loaded at any point in the game. Gives you SoundBank Backward Compatibility with the typically larger media SoundBanks. |
Requires a lot of communication between the sound designer and the game developers to determine which SoundBank must be loaded, and when. |
Questions? Problems? Need more info? Contact us, and we can help!
Visit our Support pageRegister your project and we'll help you get started with no strings attached!
Get started with Wwise