How do max instances work?

Let’s say I have a map loaded and there are 50 sources for rivers playing endless loops of river audio.

Now, I don’t want to overload things, so I set the max instances to 5. Does that mean only 5 of the sounds will play on load, while the other 45 do not play?

Or does that mean all 50 are ‘active’ and the 5 that play will be the ones nearest to me based on attenuation settings?

Thank you.

1 Like

Hi Brent,

The max instances property sets a limit on how many instances of this event can play simultaneously.

If your game’s code attempts to play any instance of the event, and that event instance would exceed the number set in the event’s max instances property, FMOD Studio culls or virtualizes event instances according to the event’s stealing property.

  • Oldest: Stop the event instance that was created the longest time ago.
  • Quietest: Stop the event instance that is the least audible, taking distance attenuation into consideration.
  • Virtualize: New event instances will be virtualized, meaning they are created and played but produce no output until an existing event instance stops.
  • None: No stealing will occur, therefore no new event instances can be played until an existing even instance stops.

Thanks,
Richard

1 Like

Thanks for the explanation Richard.

It seems to me that:

Oldest would be most useful if playing the newest event instances were the most important. Perhaps for heavy gunfire? Or any super multiple event occurrence where the oldest one doesn’t matter as much as the newest…

Quietest seems to be most useful for using with distance and attenuation. For example, walking in an area with a long river, you’d only want 5 river sounds playing at a time, not the 100 river sounds that are actually present on the map. This would seemingly smoothly stop the river sounds you wouldn’t want playing. This is the one that seems best for my use, and I’ve used it and it seems to work very well.

Virtualize seems useful, but not sure how yet. It seems that the new audio event would be doing everything except playing until an old one stops. Perhaps useful for a rotating torso changing direction on a robot?

None seems to be most useful for focusing on the stopping of an older event and starting of a new event in its place. The new event only produces sound if the old event stops. Not sure what that would be useful for. Perhaps background 3D positional music sources (like a jukebox in-game?)

1 Like

There is also “Furthest” in the latest release (1.10.02) which will remove the event instance furthest away from the listener regardless of how loud it is.

1 Like

Does this work with loops, as well? Doesn’t seem like it … :confused:

Hi Krederik,

It should work with any event, regardless of loops/transitions. Ensure that priority hasn’t been set to “Highest” otherwise the event will never be stolen.

I have a new, but related question: Can I in any way set Max Instances limit for multiple events?

In my game, I have few events for different notifications. Some of them can happen at the same time. I’ve set Max Instances to 1 and stealing to None for each event so that if multiple notifications of the same time happen, the sound is played only once. But when different event types happen, they overlap each other.
The desired behavior is that only the first notification sound is played for a given set of notifications. Is there a native solution or I have to make it manually in code?

Okay, figured out one of the ways to approach this.
You can control Max Instances inside Mixer for each bus. So you can make a sub-group for selected events and set the value there.
Still wonder if there are other ways.

That is correct - to control multiple separate events as one max instance, you will need to use group buses.

Virtualize is useful if you have a larger number of continuously looping point sound sources around a scene, such as torches in a castle. If you have 80 torches in the scene, and the instance limit is 5 with Virtualize, only the nearest 5 torches will be audible. As you move through the castle, whenever you enter the audible range of new torches, they will become audible and the ones further back will get virtualized.

If you use Steal Oldest in this kind of a scene, it is not determined in which order the torch sounds are started (depends on how the scene is loaded, and in what order the instanced objects are in the scene database) so only a few undetermined torches will be audible. If you use Steal Quietest / Furthest, only 5 torches closest to the starting position will be audible, the rest are stolen (aka stopped) and will not become audible when approached.

In short:

  • Stealing is useful for one-off / transient sounds that keep getting triggered (like footsteps)
  • Virtualize is useful for continuous / looping sounds placed into the scene (like rivers or torches)