Memory Optimization with AtomCraft
This post explains how to minimize the audio memory footprint in your game using AtomCraft.
Introduction
Depending on what target platform a game is aimed at, its audio memory budget will largely vary. For instance, if you are developing a mobile game, you will have a very limited amount of memory at your disposal compared to a console game. It is imperative for the sound designer to be able to efficiently control the memory usage of its audio implementation in order to respect this audio memory budget.
AtomCraft gives you full control at the macro and micro levels. In this post, we explain how it is possible to control your memory footprint without scarifying the overall audio quality of the project.
The Basics
Before going further, there are two very important concepts that we need to review.
The first one is the AtomCraft’s CueSheets system. Basically, CueSheets are sound banks that can be loaded and unloaded from the memory by the programmer. It is recommended to carefully split your sound effects between different CueSheets. Dividing your audio this way will allow you to carry only the assets you need at any given time, which will indeed reduce the memory usage. The way you divide your Cues in CueSheet will depend on the type of game and assets you have. For example, you could have a CueSheet per level or location in your game, or one per type of character or weapon etc…
Here is an example of CueSheet organization:
The second important point to keep in mind is the availability of different proprietary audio Codecs in AtomCraft. CRI Middleware has developed two main proprietary codecs, ADX & HCA, which are available in addition to the ones offered by the console manufacturers. All CRI Middleware’s codecs are high-fidelity, high compression, low CPU-load and they are running on all game platforms, mobile devices, and embedded systems. Thanks to this, the engine can play hundreds of sounds on consoles, and tens of sounds on mobile platforms. To learn more about CRIWARE’s proprietary audio Codecs, please refer to this Video Tutorial (you can skip to 2:20 for the most interesting bit!).
Macro-Management
With AtomCraft it is possible to define the encoding settings for each target platform directly in the Global Settings. This option allows you to select a default Codec and a default compression ratio for each platform. It is a quick and easy way to macro-manage your memory usage.
To access this feature: go to the Global Settings pane, open the Global Settings folder, select the TargetConfigs folder and click on the desired platform.
In the center pane, you can access the encoding options and select the desired audio codec.
ADX is a high-fidelity and low CPU-load codec running on all game platforms. Using ADX, audio files can be compressed up to 1/4.
The HCA codec (for High Compression Audio) was developed to offer a low CPU load, high-quality, and high compression ratio. It is comparable to the general-purpose audio codecs such as mp3 or AAC and offers a compression ratio from 1/6 to 1/24.
The HCA-MX codec is a variation of the HCA which reduces the CPU load when playing back a large number of sounds simultaneously. It has some limitations but it is the best audio Codec on the market for mobile games!
Finally, it is also possible to set a default compression ratio.
Compression ratios can be specified by selecting one of five quality options:
- Hi Quality (Lowest compression ratio)
- Medium Hi Quality
- Medium Quality
- Medium Low Quality
- Low Quality (Highest compression ratio)
Micro-Management
It is also possible to manage the memory usage at the audio file level. AtomCraft allows for different Codecs and compression ratios to be assigned to each one of your project’s audio files! This feature is very useful because it gives the sound designer the ultimate power to choose what sound needs to be at the highest quality and which one can afford lower specs. This way, it is possible to save memory by reducing the quality of SFX based on their importance / prominence in the game for example.
To override the Global Settings and fine-tune the memory usage of each of your audio files:
Go the Materials pane and click on an audio file.
In the middle pane, we can see the options to override the default settings. Simply select the desired Codec and/or compression ratio.
Finally, it is possible to test and fine-tune the result without rebuilding the game, because the Criware Atom Viewer allows you to listen to the audio embedded in the binary files. Therefore, you can listen to the files that have been encoded and then decoded, exactly as if they were being played in the game. It is an easy way to quickly compare different compression settings and Codecs.
This concludes our post about memory optimization using AtomCraft. Let us know if you want to learn more about a specific ADX2 feature!