[Fixed for V0.44] muffling sounds

Messages are moved here (should anyone ever want to see them again) once they are no longer applicable to the current version (e.g. suggestions that have been implemented or bugs that have been fixed).

Moderator: George Gilbert

Forum rules
Please read the Forum rules and policies before posting.
Post Reply
User avatar
THOM
Artisan
Posts: 198
Joined: Sat Feb 28, 2004 9:22 pm
Location: Cologne, Germany
Contact:

[Fixed for V0.44] muffling sounds

Post by THOM »

we had this once before, but here is something new relating to that:

when you have a sound event i.e. opening a door and you are one tile away from it, it sounds as if it would be very far away.

scheme:

wdw
x


w= wall; d= door; x=party

even if you are faced to the wall and can see the door halfright the sound seems to be too muted. same with tiles SOUND_LOCAL.

is this fixable?

THOM
User avatar
George Gilbert
Dungeon Master
Posts: 3022
Joined: Mon Sep 25, 2000 11:04 am
Location: London, England
Contact:

Post by George Gilbert »

Yes, it should be fixable.

The sound muffling code is *very* simple, and it's probably muffling the sound because there's a wall "between" the party and the door. Clearly there's a trade off here between calculating exactly how much wall is between the source and the party and speed and it wouldn't surprise me at all if the balance is too far tilted towards performance...
User avatar
THOM
Artisan
Posts: 198
Joined: Sat Feb 28, 2004 9:22 pm
Location: Cologne, Germany
Contact:

Post by THOM »

where is the relation between speed/performance and the sound muffling??

I would be very glad if this could be fixed. I am always irritated when I have that experience.
:?
THOM
User avatar
George Gilbert
Dungeon Master
Posts: 3022
Joined: Mon Sep 25, 2000 11:04 am
Location: London, England
Contact:

Post by George Gilbert »

THOM wrote:where is the relation between speed/performance and the sound muffling??
Well, to calculate how loud a sound should be heard at (i.e. the degree of muffling compared to the loundness of a sound at the source) you need to know what's in the way. That involves looking at all the tiles in between the source and the party - simple so far.

However, you also need to look at tiles away from the straight line between the source and the party - for example, case 1 will be quieter than case 2:

Code: Select all

Example 1:

...d...
wwwwwww
...x...


Example 2:

...d...
..www..
...x...

So the question is, how many tiles away from the party do you look at to calculate the volume. To get it absolutely right, you need to look at every tile in the dungeon level which would make the game unacceptably slow; so currently, it only looks about 1 tile away from the diagonal.

My guess is that if it looks 2 or 3 away from the diagonal then that would be a good compromise and not slow the game down too much.
User avatar
Daecon
Expert
Posts: 329
Joined: Tue May 16, 2006 1:56 pm
Location: Upper Hutt, New Zealand

Post by Daecon »

What about a layout such as a 5x5 tile grid with the party in the middle tile?

Or is that what you're saying you'd do anyway...?
Child of Darkness,
Child of Light,
Cast your Influence,
Cast your Might!
User avatar
Paul Stevens
CSBwin Guru
Posts: 4318
Joined: Sun Apr 08, 2001 6:00 pm
Location: Madison, Wisconsin, USA

Post by Paul Stevens »

To get it absolutely right, you need to look at every tile in the dungeon level which would make the game unacceptably slow
Sounds happen rather seldom. Probably fewer than several
per second. In a millisecond you could compute a rather
exact solution to the 'differential equations' that include
such things as percent of sound that passes through the wall
versus percent that is reflected versus percent that is
absorbed. Screamers absorb more sound than rats, I
believe. :wink:
User avatar
Sophia
Concise and Honest
Posts: 4239
Joined: Thu Sep 12, 2002 9:50 pm
Location: Nowhere in particular
Contact:

Post by Sophia »

George Gilbert wrote:To get it absolutely right, you need to look at every tile in the dungeon level which would make the game unacceptably slow
I'm not sure about this. It is true you'd need to look at tiles that were directly in a straight line between the source and the party, but tiles that were in the complete opposite direction wouldn't matter.

What about creating a "triangle" (that is, drawing lines at -45 and +45 degrees to the line between the source and the party), deciding an absolute radius where the sound should hit zero, and checking tiles within that space?

Code: Select all

....d....
...***...
..*****..
.*******.
****x****
This case requires checking ((dist+1)^2)-1 tiles, but that's still far less than the entire dungeon...

Now that I think about it, you might even be able to fudge and get it down to dist^2-1, because I doubt if the tiles to the left and right of where the party happens to be right at that moment would matter much...
User avatar
George Gilbert
Dungeon Master
Posts: 3022
Joined: Mon Sep 25, 2000 11:04 am
Location: London, England
Contact:

Post by George Gilbert »

The triangular case is interesting, but actually wouldn't pick up the difference in the example I gave further up the thread!

The general point is true though; I only need check a subset of the total tiles; possibly anything within a range of ~4 tiles either side of the line between the party and the source.
User avatar
George Gilbert
Dungeon Master
Posts: 3022
Joined: Mon Sep 25, 2000 11:04 am
Location: London, England
Contact:

Post by George Gilbert »

Fixed for V0.44
Post Reply