버전
menu_open

Method 5: Preparing Events and Game Syncs (Switches and States)

This method will apply if:

  • A small level of granularity is required for media to keep the memory usage low.

  • You do not want to worry about splitting your media assets into banks.

  • You have events in your project that play different sounds and motion FX based on switches or states.

  • Your project contains interactive music that plays music based on switches or states.

This method is basically the same as the previous method, but with more control over the media that gets loaded when events are prepared. With this method, only the media associated to both the events that are prepared and the game syncs that are currently active is loaded into memory.

Let's say you have a simple project with two events: “Play_Maincharacter_FootSteps” and “Play_Monster_Footsteps”. Each event plays a different switch container that plays different random sounds based on the ground texture under the moving character. The switch group name is “GroundTexture” and has three possible states: “Snow”, “Concrete”, and “Sand”.

The switch container hierarchies in Wwise will look like the following:

In this example, we have 18 sounds (6 groups of 3 sounds) that can potentially be loaded into memory. You could use Method 4: Preparing Action Events, but you won't get a level of granularity smaller than 6 sounds loaded in memory per event.

You could use Method 3: Micromanaging Your Media to get a better level of granularity, but you would have to create 6 different banks for this simple project (the number of banks increases quickly in a real project). Then, when a monster appears, you would have to check to see what textures are possible and then load the appropriate banks.

With the current method, all you have to do is specify which events and game syncs are possible and then only the appropriate media will be loaded. To make things very simple, all the media can be grouped into one single bank.

To setup banks when preparing events and game syncs:

  1. Create a bank named “Events” and load it into the SoundBank Editor.

  2. Drag the 2 events to the Add tab of the SoundBank Editor.

  3. Deselect the “Media” check box, leaving the “Events” and "Structures" check box selected for both events. When using prepare event, the media must not reside in a bank, but be loaded directly off disk.

    [Note] Note

    For the purposes of this example, all the events and structures are contained in one bank. Although this is acceptable for small projects, you will most likely want to split up your content into several banks. It is also possible to create a separate “Structures” bank that does not need to be explicitly loaded nor prepared from the SDK command because each event includes references to the other banks that need to be loaded.

  4. Generate the banks and copy the generated bank folder to the game application.

    [Note] Note

    The structure data contained within a single bank can't be split at run time. Therefore, if you are using AK::SoundEngine::PrepareEvent, and the structure data from a separate bank is required, all the structures within that bank will be loaded at once. For this reason, you may want to split the structure content in your project into multiple banks, to minimize the amount of unnecessary information that is loaded into memory.

To prepare events and game syncs in game:

  1. Load the “Event” bank before the two events are required by the game.

  2. Activate the Concrete texture at all times.

  3. Prepare the main character footstep event at all times.

  4. When possible ground textures are nearby, activate the game syncs.

The following sample of code gives you an idea how to prepare game syncs in game. First off, you need to initialize the sound engine and set the required settings, including the bEnableGameSyncPreparation flag.

Then you can load the Init bank and the events bank.

Now you can prepare the required events and game syncs.

Additional Notes on this Method

The following table lists the pros and cons of preparing game syncs.

Pros

Cons

Bank generation process is simple.

Level of granularity for media is very small.

Maintain a low overall memory usage.

Easy to automate the process.

Only useful media gets loaded.

Potentially increases the number of reads and seeks on the disk as the media assets will be loaded one by one.

Less control over the total amount of memory used.

Activating a game sync can cause high streaming bandwidth when a lot of events are prepared that require new data to be loaded.


이 페이지가 도움이 되었나요?

지원이 필요하신가요?

질문이 있으신가요? 문제를 겪고 계신가요? 더 많은 정보가 필요하신가요? 저희에게 문의해주시면 도와드리겠습니다!

지원 페이지를 방문해 주세요

작업하는 프로젝트에 대해 알려주세요. 언제든지 도와드릴 준비가 되어 있습니다.

프로젝트를 등록하세요. 아무런 조건이나 의무 사항 없이 빠른 시작을 도와드리겠습니다.

Wwise를 시작해 보세요