Sound in complex environments

Started by
12 comments, last by dragongame 15 years, 4 months ago
Hi,

just an idea, could you not make a graph for the sound system and on the edges you make your modifier.

So for example you have a wall between room A and B with a door and a air vent system.
The graph would have three edges from A to B one for each "path" the sound could take.
The door could have different attributes depending on if it is open or not.
If a sound is made in room A you broadcast to all neighbours that a sound was made modified by the attributes at the edge. So an enemy in B would get the three informations or just the loudest. You could also integrate some system, that reduces the accurance with which the agent could tell from where the sound exactly came ...

So if B is in between A and C you just broadcast the reduced sound from B to C along the graph. Of course at some point the sound is so small, that you don't broadcast it any further.

Just some "random" thoughts ...
“Always programm as if the person who will be maintaining your program is a violent psychopath that knows where you live”
Advertisement
Yep, one of the ideas was to make a relation table between all sectors through its portals. Only problem is that rooms are not always connected. For example, what if another character is walking 1 floor higher? I should be able to hear his footsteps through the ceiling, but there is no connection between the 2 rooms, unless I mannually create one via an editor. That is an option, but probably a very expensive one. To make it worse, in my case the worlds not restricted to any 'building rules' either. We just create any shape we like in a modeller program, define the sectors/portals, and import it.

Thanks for helping,
Rick
Quote:Original post by spek
Sorry for the late reply, busy busy busy. It's rude forgetting to thank you guys :)

No problem. :)

Quote:Since the collision data is used by the physics and renderer as well, I still need to use the DLL in such a way that the data is shared. To keep things a little bit modular, I think I'll go for a callback function like
"int listener_CanHear( sourcePos, targetPos, maxRange ) // result > 0 means there is still 'volume left'"
Don't know. Have to look at that. This is the first time I'm NOT mixing up all game elements (rendering, physics, sound, specific stuff) into 1 big messy 'engine', so it would be nice not to make both modules dependent on each other :)

The way I see it is that the collision module doesn't have to share it's data, it just has to offer it's services. The sound reaction system would make some requests (tell me if the line from A to B is unobstructed -- if not, then tell me how much empty space there is from both sides -- and tell me the material type of the first obstructing surfaces). The collision module performs these tests and returns the results, which are then used by the sound reaction system to calculate how much volume is left. "Leave the ray-tracing to the collision boys, they know how to do that kind of stuff. Our focus is on sounds!"


Neither data nor functionality needs to be shared. Only the interface of such a module needs to be known. Of course, this means that the sound reaction system (which, again, is not the system responsible for actually playing the sounds!) will depend on the collision system and on the sound system to do it's job, but only on their interfaces - their implementations can be changed without the sound reaction system having to worry about it, as long as they still do what they promised. Those dependencies are ok, because at some point, you do need some collision checks to be done and some sounds to be played. It's not like the sound reaction system is a low-level module either, it's a piece of game-specific code.
Create-ivity - a game development blog Mouseover for more information.
Quote:Original post by spek
Yep, one of the ideas was to make a relation table between all sectors through its portals. Only problem is that rooms are not always connected. For example, what if another character is walking 1 floor higher? I should be able to hear his footsteps through the ceiling, but there is no connection between the 2 rooms, unless I mannually create one via an editor. That is an option, but probably a very expensive one. To make it worse, in my case the worlds not restricted to any 'building rules' either. [ ... ]


If your world is spatial correct (eg. you don't have rooms that would overlap in reality) than you could create a sound tool that imports the sectors and portals and generate the graph. If you want to automatically create also edges for walls, just cast a ray from each sector center to each other an if no sector is in between you could create an edge.

Sure this does create an extra step in you art work pipeline but if sound is important for your game it might be worth it.

Just look at the following room configuration:

+-------+    +------+|       +----+      ||   A            B  ||       +----+  +---++-------+    |  +---+             |      |+------------+   C  ||                   ||     D      +------+|            |+------------+


I would expect that sound form D to A that would "travel" via C and B would be louder than through the "thick" wall that is between D and A.

But again, you might not need so much power for you audio system. It just depends on how important audio is in you game.
“Always programm as if the person who will be maintaining your program is a violent psychopath that knows where you live”

This topic is closed to new replies.

Advertisement