Sign in to follow this  
  • entries
    235
  • comments
    509
  • views
    172052

Sound Paths

Sign in to follow this  

409 views

Ran some in-game profiling over the past couple of days and found sound pathing tracing taking more time than I'd like.

Ancient Galaxy has a system to trace sounds from their source through portals into other cells, and then to the listener itself. This has the effect of making sounds appear to come through portals rather than a straight shot from the sound source if the listener is at least one room away from the sound.

It works really well most of the time, but can be a bit expensive to trace the sound paths from room to room every so often.

I was considering adding a precomputed data structure to speed this up. Basically the sound path goes

SoundSource->Portal->Through Cell->Portal->Through Cell->Portal->Listener

The paths are re-computed every so often, if the sound source moves or the sound is a looping sound.

I realized, though, that only the SoundSource->Portal and Portal->Listener parts need to be recomputed. The interior part, which could be 7-12 rooms longin some cases, doesn't need to be recomputed, and could actually be cached or completely precomputed. Each Cell or Portal could store its potentially connected portals, up the the limit of some level-specific sound distance cut-off. That way, only the ends of the sound path would by dynamic.

It turned out, though, that looped sounds were getting recomputed every frame, rather than only several times per second, so after fixing that, it doesn't look like I will need to speed things up any further in this regard.

In the future, I'd like to revisit this part of the engine and add environmental effects.

Also sped up the particle system, a couple of camera tweaks, and confirmed that the re-factored AI is still working well...


Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now