From what I understood, building into separate banks instead of all into the master bank allows a better memory management, by loading/unloading wanted/unwanted banks at any time.
However, I’m surprised to find, in the Exemple project, as in the Celeste project, banks being broken into, essentially, music bank, sfx bank, UI bank. Since all 3 banks has to be loaded at all times, I don’t see the purpose of building multiple banks rather than building a unique master bank. It would have maked more sense, in the Celeste project, for instance, to have a separate music bank for each level, since each music is specific to that level.
Am I missing something on the purpose of bank managing?
My guess is the banks make sense if you have a bunch of SFX that only appear on a level or part of your game. I put everything into one back because the sounds can appear anywhere. I did implement loading via FMOD_System_SetFileSystem() so it only unloads/loads what it needs when it needs it. There is some metadata overhead but it’s not much. Maybe there is a good use case for banks.
So you seem to agree with me that there’s no point in breaking down in the common way SFX.bank / Music.bank / UI.bank, rather than building everything in the Master.bank.
Music might be the exception since I could see doing a build without music, or music need to be encoded very differently? But even then I wouldn’t. Maybe the FMOD people can provide more background but I see no reason too. Using FMOD_System_SetFileSystem() might be necessary to keep the whole bank from being loaded.
Having multiple banks becomes more useful the bigger the game and if it gets updated often. A small mobile game likely won’t benefit from split banks, but a large open world adventure game definitely will. It provides a few benefits:
- Multiple banks can act as a buffer for loading in priority sounds. For example, you might need music to play straight away for the game’s main menu, but won’t need dialog until after the game has loaded - so having both loaded at the same time (or everything loaded in one bank) won’t be beneficial. Rather than risking the music loading in slowly as the FMOD Studio system loads an unnecessary dialog bank, you can just load the music bank and start using it immediately.
- Multiple banks are good for resource management. There might be some frame-critical sounds you need playing immediately, in which case you can use
Bank::loadSampleData() to preload all sample data into memory. This can’t be done at an event level, so if you have one single bank then it will load everything into memory which might not be optimal, especially with larger banks. Having lots of smaller banks and only preloading into memory ones you need will help in keeping resources free for more pressing needs.
- If your game needs updating and you have made adjustments to one event, if everything was loaded into one bank then it will need rebuilding in its entirety. For example, if you have one 1GB Master.bank and made a small change to one event, the updated bank will also be 1GB. However, if you only made changes to one event in a separated bank, only that bank will need updating, likely being significantly smaller in size for the player to download. Separating the banks out further into metadata and asset banks will further help with this if the change is only done to the metadata (eg. volume or parameter adjustments).
- On the subject of mobile games, with multiple banks you can have the initial download of the app really small (just a master.bank and master.strings.bank) and then download the rest of the banks after initial setup. This is popular for larger games to keep the initial download size small.
I hope this helps. Please let me know if there’s any more information you need.
Thank you for this insight!
Is it a common practice to use
Bank::loadSampleData() for game SFX in general?
The doc seems to contradict you on that point: Studio::EventDescription::loadSampleData
Ah, my mistake I was looking at event instances and not descriptions. In that case, loading sample data from the bank will be useful for either requiring the same asset being used across multiple frame-critical events, or for preloading multiple events as needs be.
Loading the sample data of an SFX bank really depends on how frame-critical the SFX are. If you don’t really need the SFX to have very tight timings then a normal bank loading will suffice for most games.