Hi Welcome,
I encountered this before however didn’t pay too much attention since I am not making a stealth game but I understood the problem.
As you say, listener and sound origin are different concepts.
When you make a noise event Max Range defines how long distance this sound can travel apart from the the listener configs. EX: If you have an noise event range of 500 and Listener Range : 1000. It can be only heard/sensed inside 500 for Listener. Once event outiside of 500 its zero.
However you can
Make range 0 and simply it can be heard by any listener but it depends on the listeners config, how ears are sensitive.
Once an event with some strength is made in listeners range it can be sensed. You can have a big range config on listener (SenseConfig). Then you can simply make a calculation of travelling how this source of noise should be perceived by listener. This is generally called in technically Sound Propagation and depends on many physical aspects however lets call if Sound Fall Off for easy to understand.
So on Listener side, we know,
- Location of event and our location : Simply Distance to Origin
- Strength (Intensity of Sound decibel)
I also made sense range super big something like 10000
This simply enables us to detect an event with correct strength variable in a big range.
So this simply decouples us from the engine’s calculation of range since now our audible range is very high. Now we can calculate a fall of ourselves depending on the gameplay feel and balance we want.
Simply I can calculate a linear falloff for this intensity.
The closer we get intensity gets higher. So it behaves like the closer you get the strength reaches its actual value. If you don’t use fall off it will be always 0.2 in the hearing radius of listener.
As an example we can do something like
and with a treshold we can define what happens like alerted
AI still hears the faint noise however we can trigger things as Alerted, Agroed etc on the moment of reaching a certain treshold.
A faint footstep, slow walk-> detected in a closer range
A big footstep, run->detected from far away.
Let me know if it helps, there is more aspects to actual sound propagation however the underlaying principles is the same. / similar. It is a really important aspect of the game for stealth and competetive games.
If you want to simulate these kind of propagations there are some plugins that do it like Wwise also I can show the simple ways of doing it for your game like, hearing difference for AI behind a wall vs open area.