Lesson 7

Table of Contents

Configuring RTPC Values to Control a Switch

In the previous lesson, you used Events to set the States that in turn play various pieces of music for the Boss, Story, Victory, and Defeated segments. Later in this lesson you’ll add similar Events for indicating if the enemy is aware or not aware of the player’s presence, which will in turn be used to play the Combat or Explore music. While it’s possible to use those Events to set the Explore or Combat Switches, you won’t be directly linking them this way. Instead you’ll drive the Gameplay_Switch Switch Group with an RTPC. The reason for not directly connecting the enemy awareness Events to the Switch Group is because the game can go in and out of enemy awareness very quickly, which would cause the music to jump abruptly. If, for example, the player is exploring, comes across a single monster and defeats it, all in the span of two seconds, it would sound strange to transition from Explore to Combat and back to Explore music in that same amount of time.

To address this, you can take advantage of a feature called a Slew Rate, which is only available in Game Parameters/RTPCs. A Slew Rate offers a way to slowly transition between values over a period of time. Think of a vehicle that you want to go from 0 to 100 kilometers per hour and back again. A sports car has a fast slew rate, achieving that transition very quickly; but, for a school bus it takes much longer to transition between those same values—a slow slew rate.

You’re going to configure an EnemyAware Game Parameter that has a range of -1 to 101. The numbers -1 to 50 will represent when the enemy is not aware, with 51 to 101 representing that the enemy is aware. By controlling the speed of the slew rate, you’ll be able to control how fast the transition between enemy awareness occurs. This information will then be used to set the Gameplay_Switch Switch Group you’ve already set up to play the Combat or Explore music.

Because the EnemyAware Game Parameter will be unique to the Music system, you’ll place it in the Music Work Unit.

  1. In the Project Explorer, click the Game Syncs tab and select the Game Parameters folder. Then create a new Work Unit and name it Music.

  2. Select the Music Work Unit and click the Create New Game Parameter icon and call it EnemyAware.

  3. Select the EnemyAware Game Parameter and change the Min Range value to -1.

    A warning appears asking how the change in scale should be handled for any objects that might already be referencing the change. Since no other objects currently reference this Game Parameter, it doesn’t matter which option you select.

  4. Click Stretch and proceed with changing the Max Range value to 101. The new values for the Range properties are applied.

    You’ll want to use 0 as a Default value so that Wwise assumes the player is in an exploration mode unless informed otherwise.

  5. Set the Default value to 0.

    Now that you’ve defined the range of values to be used, you need to indicate that the transition between values needs to be gradual over time using the Slew Rate feature. Slew Rate is found as an option in the Interpolation group box.

  6. Change the Interpolation Mode to Slew Rate.

    For it to be effective, you need to adjust the Attack and Release times. The Attack rate acts on variations to the value that are going upward, while Release times act on values going downward. Using the car metaphor, a car goes from 0 to 100 kilometers per hour slower than it goes from 100 to 0 kilometers per hour, so its Attack is slower than its decay.

    The idea is that you want the player to understand that they’ve been recognized by the enemy (triggering the Combat music) fairly quickly. But, when the player defeats the last monster, the transition back to the enemy being unaware (triggering the Explore music) should be quite a bit slower, just to create a few moments of anxiety that there may still be more creatures lurking about.

  7. Set the Attack value to 1000 with the Release value to 10.

    Now you need to map the EnemyAware RTPC to the Gameplay_Switch Switch Group. This is done in the same way that you applied the Playerhealth Game Parameter to the Switch you used with the Guitar Switch Track in Lesson 5.

  8. Select the Gameplay Switch Group and click the Use Game Parameter check box. In the Game Parameter group, click the [>>] selector button and choose the EnemyAware Game Parameter.

    A curve appears in the graph and you see the Explore and Combat Switches represented by the Y axis and the numeric values for the EnemyAware Game Parameter represented by the X axis.

    You want to transition between Explore and Combat at the halfway point. In other words, values -1 to 50 will be Explore and values 51 to 101 will be Combat.

  9. Drag the first control point to the Explore line.

    [Note]

    As you drag, you won’t see the pointer move until the cursor reaches the top.

  10. Double-click just below 50 and drag the control point down to the Combat line.

    [Note]

    It’s not important for the value to be exact, so long as it’s near 50.

    Now that you’ve mapped the EnemyAware Game Parameter to the Gameplay_Switch Switch Group, you can test your work. For now, you’ll test this by adjusting the EnemyAware cursor at the top of the graph. This will let you hear if the change in value triggers the proper music, but at this time you won’t hear how the Slew Rate delays the transition. You’ll test that later in the lesson.

  11. Make sure that the PlayerLife State Group is set to Alive and the Music_State State Group is set to Gameplay, then play the Music Event and adjust the RTPC cursor value left and right.

    You hear that EnemyAware values of more than 50 play the Combat music and values less than 50 play the Explore music.


Was this page helpful?