Help with improving performance

Hi, I am the soundie on a Tower defence game.

  • Game is being made in Unity with FMOD. Is about 1 year and a half in development.
  • This game is 3D and is a top-down style TD (pretty usual).
  • You can pan X,Y,Z and zoom in across the map (relevant for discussing Spacialization)
  • Game is relatively normal in design - enemies come running to base, towers shoot them etc.

Main problems that are arising:

  • We have a lot of sound that potentially gets played, at higher intensities, 100’s of events could be triggering and possibly 1000’s of voices at once. Attached I have a video and pic of performance at high intensity.

So far:

  • I have a priority system set up, that is easy enough.
  • I have stealing applied to basically every normal SFX (tower shots, enemy deaths etc). Using ‘oldest’ and about 4-5 max instances on each event.
  • Spacialization seems pretty normal: Gradual silence to when a game object is ‘off screen’.
  • I am about to implement a ducking system that will help keep important sounds happening at full volume but other sounds quiet. Although, before I begin to do that… I have some broad question:

My main question(s) I have:

  • What do you think of that performance test? Does it all look normal? (I have little knowledge in this area)

  • What is the best way you think I can handle Events stopping to save on space?

  • In conjunction to this ^ first question, I want to still be able to hear things really well and in a ‘realistic manner’ - If say e.g, a player zooms up into a section of towers during a high intensity time and clearly be able to hear the towers they have zoomed to.
    So, how then - does my stealing/voice limit/max instance/spatialisation/ducking etc effect this?
    As in, is there a priority chain I should be aware of that overrides one another that I should be carful of?
    Basically, my brain is starting to find it overwhelming to calculate when/what/how to put in ducking ALONGSIDE event macro’s for stopping instances ALONGSIDE spatialisation and how the ‘oldest’ could affect when a player zooms in on something or just general realistic audio volumes… Obviously if I do ‘furthest’ stealing, that might be better for zooms etc but less better for general stealing when zoomed out to full-pan?

  • Further in conjunction to this^ Unity has that single button that can allow Events to stop outside ‘listening range’ - Could this cause issues too for realism?

Sorry for the muddled questions here.
Also, feel free to not answer this as you might be kinda doing my job for me.
But, if you have even just a bit of important info I should keep in mind or just some handyt hints, that would be much appreciated.
The FMOD manual is actually extremely helpful… however, I’m just finding it hard dealing with so many variables for such a spammy game.

Thanks either way, Rob

Hi Rob,

Thanks for providing such detailed info about your use-case.

Nothing stands out as particularly odd, but it very much depends on what your target platform is - for a PC or Console this seems like great performance, but for less capable platforms like WebGL there are probably too many voices. I would recommend taking a look at our platform-specific performance references in the Platform Details chapter of the FMOD Engine User Manual as a guideline. If you do find yourself concerned about specific things you’re observing in the profiler, feel free to let me know and/or upload a profiler session for me to take a look at.

What you want here can be accomplished by using the “Virtualize” stealing mode. Virtualization causes event instances that exceed the max instances count and drop below an audibility threshold to become “virtual”. This means that while playback positions and event behaviors (i.e. parameters, logic tracks) continue to be processed, the event instance produces no output, thus saving on CPU usage. When the event instance is no longer the least audible, it will be become “real” again and start producing an output. The priority setting can be used to set events as higher or lower priority; high priority events won’t have their voices stolen by lower priority ones. For more information, I would recommend reading over our FMOD Studio docs on Virtualization, and the API Documentation White Paper on Virtual Voices.

As for the ability to zoom in and have the instances that are “onscreen” be most audible, if events are spatialized and have distance-based attenuation, instances that are further away will be quieter, meaning that the Virtualize mode functions similarly to the Furthest mode. As a result, for a start I would recommend moving your listener (or its attenuation object) closer to the event instances when you zoom in so that the instances closest to the camera are the most audible.

You can then tweak Spatializer settings on your events (i.e. envelopment, minimum/maximum distance, attenuation curve type) to get more specific attenuation behavior. If you need finer control over attenuation, you can use Built-in Parameters such as Elevation or Direction that calculate the angle between an event and various listener planes, and use them to automate a gain effect or potentially Spatializer settings on your event instances. Setting all of this up as a preset effect(s) will make it easier to apply to multiple events in Studio.

It could cause issues for realism, for example if you were to move quickly away from and back to a specific position. Virtualization will handle this without stopping event instances anyway, so I wouldn’t recommend using it.

Hi, so sorry, I never replied to this.

I wanted to say thankyou very much for you promptness and thorough advise.
I have implemented these things and they work well.

One more thing, possibly related.
We are getting this error and wondering what the issue here could be?

That warning indicates that the FMOD system isn’t outputting enough audio fast enough to fill the output buffer.

If you’re only receiving this warning once or twice, for example on starting or stopping game playback in editor, then it’s probably not a cause for concern.

However, if you’re receiving this warning repeatedly, and/or are hearing audio artifact such as stuttering, then it indicates that the system is under too much strain - if this is the case, I would recommend connecting to your game with live update and profiling it to identify what the issue is.