Observation: There is obviously some bit of code in the game already that determines how loud something is and/or whether a sound is played, based on how far it is from you. For example, water and zombie sounds when you get near a cave.
Suggestion: Have a material (or modify an existing material, like Wool) with the property of exaggerating this distance calculation if it is between you and the sound.
Possible ways to code:
A) Whenever a sound would be played, trace a (block) line from the source of the sound to the approximate location of the player's head. For every block of wool that this line passes through, the volume is diminished (by a %age) possibly even rounding down to zero.
:cool.gif: Just draw a radius around the player and/or sound source, and count how many wool blocks there are there, whenever a sound would be played. Each one reduces the sound somewhat (by a %age)
C) When a sound is to be made, draw a handful (6-10, maybe) of rays out from the player and/or sound source. Count the proportion of these rays that do NOT collide with a block of wool first. Multiply whatever the volume would have been by this proportion. So if 4 out of 6 rays hit rock, and 2 hit wool, the volume is 2/3 of what it would have been. I like this one best, if it is done both for listener and source (averaged together? Added? Best muffler wins?)
D) Any combination of A and B and C!
Advantages:
Sneaking around secret passages in your base without invaders knowing where you are or that you're coming.
Soundproofing a TNT area so that somebody setting off a trap does not her the "SSSSssss" to know to run away.
Avoiding annoying animal sounds (depending on method used to calculate)
Hiding the reality of fire or flowing water in traps or for infrastructure around a construction, for added danger or aesthetics
Rollback Post to RevisionRollBack
Przerwap, upon looking at some code I had just written: "...Gav... That's not how programming works."
While this topic is quite old, something along these lines would be nice to have, but I think there are more things that could be done with it instead of just wool making sounds quieter.
Rollback Post to RevisionRollBack
"Victory is like a watermelon. It's hard to spell and it tastes good."
Suggestion: Have a material (or modify an existing material, like Wool) with the property of exaggerating this distance calculation if it is between you and the sound.
Possible ways to code:
A) Whenever a sound would be played, trace a (block) line from the source of the sound to the approximate location of the player's head. For every block of wool that this line passes through, the volume is diminished (by a %age) possibly even rounding down to zero.
:cool.gif: Just draw a radius around the player and/or sound source, and count how many wool blocks there are there, whenever a sound would be played. Each one reduces the sound somewhat (by a %age)
C) When a sound is to be made, draw a handful (6-10, maybe) of rays out from the player and/or sound source. Count the proportion of these rays that do NOT collide with a block of wool first. Multiply whatever the volume would have been by this proportion. So if 4 out of 6 rays hit rock, and 2 hit wool, the volume is 2/3 of what it would have been. I like this one best, if it is done both for listener and source (averaged together? Added? Best muffler wins?)
D) Any combination of A and B and C!
Advantages:
Sneaking around secret passages in your base without invaders knowing where you are or that you're coming.
Soundproofing a TNT area so that somebody setting off a trap does not her the "SSSSssss" to know to run away.
Avoiding annoying animal sounds (depending on method used to calculate)
Hiding the reality of fire or flowing water in traps or for infrastructure around a construction, for added danger or aesthetics
By the way, nice necro, Randavish. But probably a good thing.