Lesson 5

Table of Contents

Using States

In Cube, the Wwise Wwizard can pick up a super gem that causes the other gems he throws to produce four times the damage for a brief amount of time. The super gem pickup is sent to Wwise as an Event which then sets a State indicating that super gem mode is engaged. The result for the sound effects is that any gems thrown during this time are also accompanied by a super gem chime. You can also use this change in State to modify the music.

You’ll use the Arpeggio track you implemented earlier in the tutorial to provide further audible feedback as to when the player is in super gem mode.

  1. In the Project Explorer, select the Combat-A Music Segment.

    Currently the Arpeggio track is configured to randomly choose a Sub-Track with a variation of the arpeggiated sound, or an empty Sub-Track. Now you’re going to change it so that the arpeggiated part is only heard when the player has a super gem. When the player doesn’t have a super gem, there will be no sound, so this means that the empty sub-track is no longer necessary.

  2. In the Music Segment Editor, right-click the empty Sub-Track within the Combat-A-Arpeggio1 Music Track and select Delete.

    The empty Sub-Track is removed.

    How an object reacts when there’s a change to a game state, is managed by the States tab in the Property Editor.

  3. With the Combat-A-Arpeggio1 track selected, click the States tab in the Music Track Property Editor.

    You need to add an instruction of what to do when there is a change to a specific game state. The game state in Cube that communicates if the super gem is in effect is called PlayerHasSuperGem. When the player picks up the super gem, the PlayerHasSuperGem State Group is set to the Yes State for a period of time, alerting Wwise that any of the Wwizard's gems that hit a monster produces quadruple damage. Once the effect of the super gem is over, the PlayerHasSuperGem State Group is set to the No State. These changes in PlayerHasSuperGem State Group provide the hooks you can use to modify the arpeggio track.

  4. Click the Add State Group >> selector and choose PlayerHasSuperGem.

    You see rows of information appear related to what will happen when the PlayerHasSuperGem State Group is set to either the Yes or No State.

    When there is a change in a State, each of the possible States can be used to trigger an offset value to various properties. For the Music Track, you can offset volume as well as filters. To bring the arpeggiated part in or out, you’ll use a simple volume offset. In this case, you don’t want to hear the arpeggios when there is no super gem power, so you’ll subtract value from the track’s normal volume when the PlayerHasSuperGem State Group is set to No.

  5. For the No row, set the Voice Volume to -108.

    A -108 dB reduction in volume will mean that it’s inaudible. In addition, it means that the sound will fall below the volume threshold for it to be processed, freeing up the game system’s CPU resources. It might be a little odd to have the arpeggios come in midway through a bar or beat, so it’s also possible to defer the track from coming in until a specific point in the Music Segment. This musically-sensitive feature is only available to objects within the Interactive Music Hierarchy. In this case, you’ll have the arpeggios transition in or out at the next bar after the PlayerHasSuperGem State has changed.

  6. Set the Change occurs at property to Next Bar.

    Now you can test your work using the Transport Control view.

  7. In the Project Explorer, select the Combat-A Music Segment.

    The Transport Control view is focused on the Combat-A Music Segment.

    Because the Combat-A Music Segment contains a track that has been configured to react to a change in State, that State can be displayed in the Transport Control view.

  8. In the Transport Control, make sure the States button is selected.

    You can see the PlayerHasSuperGem State Group. You can adjust this as the Music plays to test the effect of the State on the music.

  9. Play the Combat-A Music Segment and then adjust the PlayerHasSuperGem State.

    [Tip]

    If you prefer, Solo the Combat-A-Arpeggio1 Music Track in the Music Segment Editor to isolate its sound and make it easier to hear the part.

    You can hear there’s a brief fade each time the arpeggio part transitions. While it is a brief transition, it feels a bit too long. This fade time is controlled by the PlayerHasSuperGem State Group’s transition time, a value that’s global for anything reacting to the PlayerHasSuperGem State. Because there are no other sounds being manipulated when the PlayerHasSuperGem State Group changes, you can modify the State Group’s transition time without worry.

  10. In the Music Segment Editor, select the Combat-A-Arpeggio1 track header and then in the Music Track Property Editor double-click the PlayerHasSuperGem State.

    The State Group’s Property Editor opens.

    You can see that the transition time is set to 1 second, causing a 1 second fade in or out as the PlayerHasSuperGem State Group is changed. This transition time needs to be reduced quite a bit.

  11. Change the Default transition time to 0.1.

  12. Test the settings by adjusting the PlayerHasSuperGem State in the Transport Control.

    You now need to apply the same configuration to the arpeggio track in the Combat-B Music Segment. The State transition time is global, so you won’t need to do that part.

  13. Repeat the steps 1-9 in this exercise for the arpeggio track in the Combat-B Music Segment.


Was this page helpful?