Page 1 of 1
[Fixed for V0.44] muffling sounds
Posted: Sat Sep 30, 2006 11:38 pm
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
Posted: Sun Oct 01, 2006 12:28 am
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...
Posted: Sun Oct 01, 2006 1:16 am
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
Posted: Sun Oct 01, 2006 11:54 am
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.
Posted: Sun Oct 01, 2006 3:11 pm
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...?
Posted: Sun Oct 01, 2006 5:45 pm
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.

Posted: Tue Oct 10, 2006 7:16 pm
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...
Posted: Tue Oct 10, 2006 8:11 pm
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.
Posted: Sat Oct 21, 2006 9:15 pm
by George Gilbert
Fixed for V0.44