8.1) Managing Memory
You can have the most amazing soundscape for a game, but that’s irrelevant if it can’t be rendered using the available resources in an end user’s game system. For this reason, game audio integration is really an exercise in the art of doing more with less. Wwise provides powerful features that allow you to maximize efficiency when you integrate sound into your game without sacrificing creative and sonic integrity. In this lesson, you’ll learn how to minimize the size of audio assets and conserve RAM and CPU usage. One of the most powerful aspects of Wwise is that up until now, you’ve been able to focus on the creative side of things and not concern yourself with sound engine performance factors. Now you’ll learn how you can scale a project to work within memory and performance budgets.
In the main menu, choose Layouts > SoundBank or press F7. (Pic01 SoundBank Layout)
Many video games are based on levels and oftentimes there are sounds that are only associated with particular levels, such as the sound of fireworks that are only heard at your character’s victory celebration when the highest level of the game is completed. It is unnecessary to load sounds into memory if the player has not reached that point in the game. This project has six SoundBanks, for the various aspects of the soundscape. Every game needs at least one SoundBank, because it’s the SoundBank that contains the audio assets as well as the instructions for how the audio will be played.
Game programmers have to code the game engine to load the SoundBanks by name on start of the game, so it is imperative that your SoundBanks are named correctly.
Look at the Data Size that is being displayed in the SoundBank Layout.
Each SoundBank has columns related to Data Size. Currently almost all SoundBanks have values greater than 0 bytes, because there are a variety of Events and media files assigned to them. There is however one SoundBank, the Utility Bank, that has a Data Size of 0 bytes. If you click on it, you can see in the SoundBank Editor that it is completely empty. (Pic02 Data Size and SoundBank Editor)
Now look at the Max Size information. (Pic03 Max Size)
In this column you can assign a value expressed in bytes to designate what Memory Budget is expected for the SoundBanks. Budgets are often dictated early on in the game development process but can change over the course of development. It’s important to know what your budget is and stick to it, because any memory resources you use are no longer available for other aspects of the game. Setting a Max Size does not technically constrain you to that value, but it does give you a visual warning when you exceed the budget.
The Sfx SoundBank has a Data Size of 52101104 bytes, which is about 52 Mb. This is quite big for a game this size with only one level. Set the allowed Max Size to around 30 Mb.
As indicated in red, the actual Data Size of the SoundBank exceeds the Max Size. Let’s look at ways to reduce the Data Size for the SoundBank, to have a smaller impact when it is loaded into RAM. (Pic04 Max Size exceeded)