5.2 Switch Groups and Switches

 

5.2) Switch Groups and Switches

 
 

 

Switches are the first type of Game Syncs you will learn about in this lesson. Switches allow an instant change in sound for all Game Calls following the Switch change, which is perfect for swapping footstep sounds depending on the type of surface the Player Character is running on. To actually reflect this change in sound, a simple Raytracing method has been implemented in the code of the game, shooting downwards from the Player Character’s feet to detect which type of surface is currently underneath. The game can then set Wwise Switches to communicate this condition to the Wwise Audio Engine for all following footstep sounds that are being played back.

In this Platformer Game only two Switches have been implemented. These two Switches communicate the current surface type underneath the Player Character’s feet. There is either a Switch called “Concrete“ set for a vast majority of surfaces in the level, such as a Switch called “Metal“, set exclusively for the surface of two elevators. Both Switches are linked through a Switch Group called “SurfaceType”. Since the Player Character can both run and jump on the metal surface of the elevators, you’ll have to change the sounds for both mechanics to meet the condition for the surface type set by the game engine.

Pic01 Profiling Switches

Pic02 Create a Switch Group

Pic03 Create Switches

Pic04 Profiling Switches

Pic05 Create Switch Containers

Pic06 Blending Footsteps

Pic7 Source Editor

Pic8 Property Editor

Pic9 Assigned Objects

  1. First open the Profiler and set the Filter to filter only Switches and API Calls for Game Syncs.

  2. Play the game, start profiling and jump on both elevators.

  3. Now let’s check out the Capture Log of the Profiler.

    You can clearly see that there are several API Calls for setting a Switch, but it currently reads “Unresolved” because you haven’t created any Switches in your Wwise project yet. Therefore the Switch is automatically set to a “Default” value, as you can see in the Capture Log. (Pic01 Profiling Switches) The game tries to change a Switch for a couple of times; there are 4 Game Calls of this type to be exact. You can also see the name of the Game Object that tries to set the Switch, which is of course the Player Pawn. Since you are jumping from a concrete surface onto the elevator (1), then being in the air in between elevators (2), then jumping onto the next elevator (3), then landing on the street again (4), the number of Game Calls for setting a Switch seems to make sense. So let’s create the Switches.

  4. Go to the Game Syncs Tab in the Designer Layout.

  5. Select the Default Work Unit in the Switches Folder and create a new Switch Group.

    A new Object called Switch Group is created and is ready to be named. Similar to Events, you and the Audio Programmer must agree upon a name for the Switch Group. In this case, the Audio Programmer has already implemented the Switch Group (and Switches) within the games code, so in order for it to work it is important to match the name for these Objects. Set “SurfaceType” for the Switch Group’s name. (Pic02 Create a Switch Group)

    While you intend to use this to affect the footstep sounds, there could be many other sounds that utilize this Switch Group in order to affect sound. Knowing which surface the Player Character is running on could also be used to change the sound of gun shells falling to the ground.

  6. Create two Switches for the Switch Group and name them "Concrete” and “Metal”. (Pic03 Create Switches)

  7. Play the game, start profiling and jump on both elevators.

  8. Check the Capture Log again. It should now show your Switch Group and Switches. (Pic04 Profiling Switches)

    Now that Wwise receives the Game Calls, you’ll need to connect them with the sounds you intend to use in game. You created two different surfaces that ultimately need to have corresponding sounds to go with them. This is achieved by creating Switch Container Objects in the Actor-Mixer Hierarchy.

  9. Go to the Designer Layout and find the foley_land and footstep_generic Random Containers.

  10. Create two new Switch Containers as child Objects of the foley Actor-Mixer. (Pic05 Create Switch Containers)

  11. Let’s start with sounds for landing. Make the foley_land Random Container a child Object of the first Switch Container. Rename this Switch Container foley_land.

    You now technically have sounds for the first surface type. You still need sounds for a robot landing on the metal surface of the elevator. To not bother the Sound Designer, you’ll just be creative and re-use sounds that you have already imported into the project, like the metal sounds used for the robot banging on the door of the transporter in the beginning of the level.

  12. Create a new Blend Container as child of this Switch Container. Rename this Blend Container foley_land_metal.

  13. Now copy the before mentioned metal Random Container of the metal Actor-Mixer into this Blend Container.

  14. Make another copy of the foley_land Random Container a child Object of this Blend Container.

  15. Listen to the Blend Container. (Pic06 Blending Footsteps)

    Sounds quite alright, doesn’t it? You are now combining the default footstep sounds with the sounds of the robot banging on a metal surface to create the illusion of footsteps on a metal surface. The duration of the metal sounds is a bit too long for this application, so lets make all sounds a bit shorter so they better fit your purpose.

  16. Open the Source Editor for all Sound SFX objects within the metal Random Container and trim the end of all clips, so the sounds get shorter. Use a short Fade-out at the end to make the sounds not end abruptly. (Pic7 Source Editor)

  17. Do the same for all Sound SFX objects within the default foley_land Random Container, so you can’t hear the crumbling of the concrete floor any more, so it better blends in with the metal sounds.

  18. Now that you have the sounds set up, let’s connect the Switch Group and Switches with the right Objects, so Wwise knows exactly which sounds to associate with which Game Call. Look at the Property Editor (Pic8 Property Editor)

  19. Select the Switch Group and choose “Concrete” as Default.

  20. Then drag and drop the Objects from the Project Explorer to the corresponding slots for the Assigned Objects in the Contents Editor. You have now completed the setup for landing sounds on two surfaces. (Pic9 Assigned Objects)

  21. After that you only have to define the Switch Containers as a new Target for the Play Action of the corresponding Event. What’s left to do after this point is to repeat the same process for the footsteps. This will be the first exercise for this lesson.