Video Game Music Implementation With Wwise Part 5
In part 4 we learned how to import and implement stems of our music clips to randomly re-orchestrate our music sequence by using the vertical layering approach. Now that we have our action and exploration music edited and imported, we will be dealing with creating and using music switch containers to switch between the two music styles.
SWITCHING THE CONTAINERS:
As we said at the very start of this series, game music is all about interaction and impressiveness. During the course of a single level of a game, you will likely go from exploring the area to encountering enemies and fighting the toughest one in the form of a boss fight.
Music needs to follow through that and appropriate music should be featured for each of those situations. Wwise has a very intelligent (dare I say wise) way of managing these various states of the game in the form of a Music Switch Container.
What is a Switch Container you may ask? It’s a special type of object inside Wwise that enables us to switch between various music containers. In our case, here we have individual music playlist containers for action and exploration music.
In order to enable switching between the two-music playlist container, we need to select them both, right-click, select New Parent from the drop-down menu and select Music Switch Container.
You can do this with as many music playlist containers that you have in the project. I named the container as Music Switch, just to know what we’re dealing with here. When we click on the music switch container, we can see that its time settings are set to default 120BPM and 4/4 signature.
Knowing that our actions music is at 130 BPM and exploration music at 125 BPM, we will need to set the appropriate tempo and signature settings of the container, so it plays back in sync. We do this by overriding the parent for each music playlist container.
This is very time consuming, so the faster way to do it is to select all of the segments in each playlist container, right-click, and select Show in Multi Editor, or Ctrl+M (Cmd+M on Mac) to show the multi-editor. Inside the multi-editor, we can expand our audio setting by clicking on Audio-General Settings-Time Settings, and then clicking to Override Clock Settings.
Now when we click on each of the segments, we can see that their original tempos are reflected in the time settings.
SETTING UP & CONFIGURING STATES:
Currently, if we click on our music switch container, and try to play back the music, we can see that our transport tool is greyed-out. This is because we need to define which music container should play based on the gameplay situation.
In order to do this, we need to create a state group which will enable us to define the various states of gameplay, I.E. the switch between exploration and ambient music. In order to create a state group, we need to switch to Game Syncs tab in the upper left tab, go to States, click on Default Work Unit, and click the Create new state group button above the list.
Once it is created, you can rename it the way you want. I labelled mine as State_Switch.
Now we need to add the actual states inside the state group. By selecting your created state group, a Create new state button (next to the create new state group button) will be enabled for you, so you can click on it to create a new state, or as many states you need. For the purpose of this tutorial, I created only two states which will make us switch between exploration and action music.
Once this is all set-up, we need to configure the transition times between states. What that means is how fast our music will switch from one state to another. By clicking on State group in drop-down-menu we can see the property editor in the centre tab of our project window. By clicking on the Insert button, we can add the number of transitions that we need.
In this case, it’s only two (exploration to combat and vice versa), but there can be more for a more complex music system. For a good result, a default transition time of 1 (presented in seconds) should do the trick, but you can tweak the times to your liking. For example, a 5 seconds transition from combat music to death music if a player is gradually losing health, so those 5 seconds will be good for a smooth transition between the two states.
CONNECTING MUSIC CONTAINERS TO STATES:
In order to connect our music containers to various states of the game, we need to click on the music switch container and set up the paths to music playlist containers.
We can see in the middle center tab a Music Switch Container Association Editor where we will be setting up our paths between music and states. To add a state group switch, we click on the two arrows followed by State Groups and then we select the group we created previously.
Once we have selected the desired group, a column with three options will appear. The one where it says None we don’t need to worry about, this is a group that stops the music from playing. Combat and Exploration is what we’re interested in.
If we click on Combat, and Add Path(s) button above, we will get a column in the lower centre tab with the name Combat showing to the left. If we click on the browser menu (three little dots) to the right, we will get a window in which we can select which music playlist container should play for the state that’s selected previously.
We click on OK, and our path is now connecting the appropriate state with the appropriate music. A faster way to do this is by dragging the music container to the state column in the Music switch container association editor.
MUSIC SWITCH CONTAINER STATES CONFIGURATION:
Now when all of that is set up, we need to make sure that we set up states inside the actual Music Switch container and set up the transition times between them. We covered that in the previous texts, but let’s review it once again here:
We click on the music switch container that’s created and then we go to the States tab where we click on Add State Group and select the state we created previously.
Then we go to the Transitions tab, where we click on the only option we have there, and then change the exit source the way we like it. If Immediate setting is too fast, you can select the Next Bar transition setting.
After all of this is properly done, your music will transition perfectly from one state to the other. Now bear in mind that you have unlimited possibilities here because you can add multiple music states to various music switch containers.
You can see on the screenshots how I have added another state switch with additional state groups for various types of combat music.
That’s it for this post. In part 6 we will be exploring the music transitions in-depth in order to make all of this switching run smoothly and just the way we want, so don’t worry if your transitions between the states are not running exactly as you planned. We will address this deeper in part 6!