[Fixed for V0.44] muffling sounds
Moderator: George Gilbert
Forum rules
Please read the Forum rules and policies before posting.
Please read the Forum rules and policies before posting.
[Fixed for V0.44] muffling sounds
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
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
- George Gilbert
- Dungeon Master
- Posts: 3022
- Joined: Mon Sep 25, 2000 11:04 am
- Location: London, England
- Contact:
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...
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...
- George Gilbert
- Dungeon Master
- Posts: 3022
- Joined: Mon Sep 25, 2000 11:04 am
- Location: London, England
- Contact:
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.THOM wrote:where is the relation between speed/performance and the sound muffling??
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...
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.
- Paul Stevens
- CSBwin Guru
- Posts: 4318
- Joined: Sun Apr 08, 2001 6:00 pm
- Location: Madison, Wisconsin, USA
Sounds happen rather seldom. Probably fewer than severalTo get it absolutely right, you need to look at every tile in the dungeon level which would make the game unacceptably slow
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.
- Sophia
- Concise and Honest
- Posts: 4240
- Joined: Thu Sep 12, 2002 9:50 pm
- Location: Nowhere in particular
- Contact:
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.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
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****
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...
- George Gilbert
- Dungeon Master
- Posts: 3022
- Joined: Mon Sep 25, 2000 11:04 am
- Location: London, England
- Contact:
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.
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.
- George Gilbert
- Dungeon Master
- Posts: 3022
- Joined: Mon Sep 25, 2000 11:04 am
- Location: London, England
- Contact: