Version

menu_open

Creating a Random Container

For all situations where you want a series of objects to be played back randomly, you can use a Random Container. For example, you might want to use a Random Container for all the attack, hit, and reaction sounds in a fighting game.

In Wwise, random can mean either a standard random selection, where each object within the container has an equal chance of being selected for playback, or a shuffle selection, where objects are removed from the selection pool after they have been played.

You can also assign a weight value to each of the objects within a Random Container. The weight value can increase or decrease the likelihood that an object is selected for playback. The weight value set for a particular object is relative to the sum of all weights in the container. This basically means that the number assigned for each object represents the number of chances the object will be selected for playback out of the summed total. For example, if there are two objects in the container with weight values of 1 and 100, the first object will have a 1/101 chance of being played and the second object will have a 100/101 chance of being played.

Using Random Containers - Example

Let's say one of the environments in your game is a cave. You want to have the sound of water dripping in the background to give some ambience to the cave environment. In this case, you can create a Random Container that groups all the different water dripping sounds. Since you would want the sounds to be played continuously while the character is in the cave, you would set the play mode of the container to Continuous with infinite looping. By playing the limited number of sounds randomly, you add a sense of realism.

To create a Random Container:

  1. In the Project Explorer, right-click any one of the following objects in the Actor-Mixer Hierarchy:

    • Work unit

    • Virtual Folder

    • Actor-Mixer

    • Blend Container

    • Random Container

    • Sequence Container

    • Switch Container

  2. From the shortcut menu, select New Child > Random Container.

    A new Random Container is created and highlighted in the Actor-Mixer Hierarchy.

  3. Type a name for the Random Container and press Enter.

  4. Double-click the new Random Container to open its corresponding Property and Contents editors.

  5. Populate the Random Container by dragging objects from the Project Explorer to the Contents Editor.

  6. In the Random group box, select one of the following options:

    • Standard to keep the pool of objects intact. After an object is played, it is not removed from the possible list of objects that can be played and can therefore be repeated.

    • Shuffle to remove objects from the pool after they have been played. This option avoids repetition until all objects have been played.

  7. To avoid objects being repeated one after the other, select the Avoid repeating last x played option.

    The behavior of this option is affected by whether you are in Standard or Shuffle mode.

    In Standard mode, the object played is selected completely randomly, but the last x objects played are excluded from the list.

    In Shuffle mode, when the list is reset, the last x objects played will be excluded from the list.

  8. In the Avoid repeating last x played text box, type the number of objects that must be played before an object can be repeated.

  9. In the Contents Editor, assign a weight to each of the objects within the container.

    The weight helps to prioritize certain objects over others. The number you assign for each object represents the number of chances the object will be selected for playback out of the summed total.


Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise