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...