CPU Performance

Hello,

Just thinking ahead on the performance in our game and wanted to get a good understanding of the CPU impact of our soundscape. I have read this in the docs (https://www.fmod.com/docs/2.00/api/white-papers-cpu-performance.html) and have a rough idea of how to interpret the CPUMixer% but not sure how that relates to ms in the Unity context.

So we’re trying to keep as much, if not all audio on prefabs so it makes iterating and building the worlds much faster, this does of course mean we have less control over the soundscape and CPU resources in a way, as we end up with environment objects in the distance which we can’t even reach having emitter components running on them and it raises a concern for CPU time.

So I ran a performance test in unity, here’s the setup, bearing in mind I put more events in the soundscape than probably neccessary just to test. The scene is a city environment with buildings, abandoned cars and fences mainly and everything is fairly close together.

  • Each building (120 total) has 2 spaced emitters on (scatter instrument with rubble sounds, set to 2 max instances and no stealing)
  • Around 150 fences with one emitter on (scatter instrument with wind rattle, set to 2 max instances and no stealing)
  • Maybe 100 abandoned cars (scatter instrument with metal creak, set to 2 max instances and no stealing)
  • Music
  • This is a multiplayer game so I set up 3 player simulators (scatter instrument with a bunch of player audio on which spawns more frequently than possible) and placed on the player so they follow you
  • Some test tone on lamp posts just to raise the instance count for testing

So yes that’s a few hundred emitters in the scene with the prefab setup but I have set unity to stop events outside max distance.

So here are the profiler results, specifically focused on the point with the most activity

According to this post by Jeff (On average, How much CPU and Memory should an FMOD build be using in a large scope game?) a rough estimate on low activity would be 5-10%? so technically my profiler session results even with all that audio should be somewhat decent?

Just need some help on the ms hit in Unity, I profiled in the Unity profiler and could only find RuntimeManager.Update() [Invoke] which at the time of all the activity was around 0.4ms which is way above what the developer is hoping for from the audio side.

Just checking if this setup and readings are normal under the circumstances?

Here’s a question from the dev also -

We wanna make sure that we know how much CPU ms is being affected by FMOD on the Main unity thread. We’ve been doing this by filtering the Unity profiler on RuntimeManager.Update() but is there anything else we need to check?

We’re assuming all other performance impacts from FMOD (i.e. FMOD studio stuff) happen on separate threads.

We’re running

Unity 2.1.2f1
FMOD 2.03.08

Apologies for the long question and really appreciate the time! Thanks!

Hi,

The main thing to check on the main thread with regards to FMOD would indeed be RuntimeManager.Update(). Since updating the FMOD system submits all API commands enqueued in the command buffer since the last update call to the Studio update thread, a spike in ms during high activity areas would be caused by the command buffer being particularly full due to ongoing calls on event instances like setParameter and set3DAttributes. A spike of 0.4ms during high density areas like this doesn’t seem particularly concerning to me, unless you’re observing that it’s impacting the main thread in some way. You can read more about Studio’s asynchronous processing model here: https://www.fmod.com/docs/2.02/api/studio-api-threads.html#studio-asynchronous-mode

The Studio profiler is a much better way of understanding the impact that FMOD is having on your game, and based on the screenshot you’ve attached of your profiler, I’d say that level of resource usage is on the low end. FMOD’s virtualization system is likely virtualizing a lot of the playing sounds in the profiler session, which you can observe for yourself by clicking on the “Voices” view to the right of the transport controls.

Thanks for the information Leah, this clears thing up nicely, I’ll look more into it!