We hear sounds up to 16 blocks away. But ever found it a bit ridiculous how you hear sound just as loud when underground, as if all that stone around you was mere air ?
You hear a mob, and it makes the same "quality" and "volume" of sound wether it is 16 blocks away from you in the same straight tunnel, or 16 blocks away from you in some other unseen tunnel, whether the amount of intervening stone is only 1 block this or 15 doesn't count at all.
Here is how it could be improved.
#1 - Real facing should count
Currently, sound volume is determined by distance to sound source (max 16 blocks) using the entire X-Y-Z coordinates. But the actual left-right sound channels split "kinds of" ignores the 3rd dimension, which feels a bit weird. If a mob is at same elevation as you, you hear the left/right sound split properly. But if mob is much higher or lower, then the split progressively disappear and basically you end up having no idea if the sound comes from above or below or even from the front or the back.
Proposed: Sounds are heard "as if" standing 1 block closer to them when pointing straight at them, and heard "as if" standing 1 block away from them, when pointing straight away from it, and as if from the normal distance when pointing perfectly 90 degrees away. Thus, this would allow the full 3D vector of your sight to count, and it would also be much easier to tell if a monster is in front of you or on the back. This change in volume is thus minor, but still enough to discern direction of a sound without too much hassle.
In real-life, it is very easy to tell if a sound comes from above or below: you just twist your neck a little bit to the side so that one of your ears points either up or down, then your "left/right" instantly becomes "above/below". But that is impossible to do in the game ! So, realistic ? Not really. After all in real-life the volume of a sound doesn't change according to the angle of your head. But, would it be way better for the actual gameplay ? Definitely !
#2 - Obstacles dampen a sound
A thick wall should not feel like "air", and cut sound level faster than air.
We make the "effective" "sound distance, the sum of these three distances:
+ Going from player straight towards sound source, distance from player to FIRST obstacle in the way.
+ Going from sound source straight towards player, distance from sound source to FIRST obstacle in the way.
+ Three times (or whatever other factor you fancy) the total wall thickness, which would simply be the remaining player-to-sound-source distance after removing the two "to reach first obstacle in the way" distances above.
Basically, a player and a sound source each on their own side of a 5-blocks thick wall (even with air in the middle) and each right next to the wall, would make the player hear the sound source as if he was the maximum distance of 16 blocks away from the sound.
Also, a filter would be applied to the sound, making if feel "fuzzier". This would not affect the sound's volume a second time (the volume being already affected by the distance above), but it would affect the "'clarity" of the sound. The amount of "fuzziness" would depend on the amount of "total wall" thickness, so thicker walls make sound less clear. This is like hearing a clear THUD from someone slamming a hammer on a table near you, vs the same thud slam, but heard through a big thick pillow wrapped around your head. Thus total effect = Less total volume AND less clear sound quality.
Note again according to this algorithm, a pair of 1-thick walls with 3 blocks of air in between them will count EXACTLY the same as a single 5-thick wall.This is not a real problem: in real-life, two thin walls can cut sound just as well if not better than a single thick wall, so no need to check ALL the intervening blocks in between player and sound source, just finding the first obstacle is quite sufficient and requires much less processing.
Doing it that way greatly simplifies things up: you just have to check distance to nearest obstacle, instead of all intervening blocks.
Note that the actual nature of the "blocking" obstacle on each side could be used too, changing a few of the variables. For example, wood could cut sound much more than stone. Wool could fail to cut the sound a lot, but excel at making it way fuzzier. Glass or metal could make the sound "ringy".
Water could make you able to hear sound from much behave a bit differently: sound could actually travel further away, but feel "bubbly". Any kind of sound filter could be added later on, the only really important one is water -- it shouldn't cut sound like a solid obstacle.
#3 - What about the sound going AROUND an obstacle ?
Yeah that is important too. Otherwise you would have mob standing only a few blocks from you around a corner, and you would heard it as if it was super-far away. That would be bad.
So, the "through obstacle" sound level above, is just half of the equation. I call it the "straight vector" sound.
In addition, you would have the "pathing" sound. We know hostile mobs already path to the player to move to attack. We'd just use the same pathing for all sounds. When a "straight vector" sound does not have any obstacle in the way, then the pathing sound is not used at all. But if the "straight vector" sound has some obstacle, then a pathing sound is also determined.
This is the path from sound source to player, if there is one, through non-obstacle blocks only, maximum 16 blocks of distance.
What would give a "'sound distance" equal to the path length. That sound would then get an "echoing" filter effect that would be applied to it. The ore the path is longer that the "purely straight line without checking for obstacles" player-sound-source distance, then the more it is assumed that the sound has to "reverberate" according to a tortuous path in order to reach the player, and the more the final sound will feel like it "echoed" along several walls, giving the sound a "cave" feeling.
Depth could be taken into account or even the nature of the blocks around the path, so that hearing someone in another room of your wooden house would not feel like you are standing in a cave.
The true final sound would "combine" the "straight vector" and the "pathing" sounds together (or just use the louder one directly).
#4 - Sounds have priorities
We need a better sound manager for the available sound channels.
Say you are standing in the middle of 500 chickens and opening a chest. Currently, odds are, you won't hear the chest at all.
You are striking a zombie and kill it, but you do so right after it starts a long moan. Currently, that zombie somehow has gained a second distinct set of vocal chords, because it is both "saying" it's normal moaning AND it's also making it's hurting sound, too, both at the same time. Also, after the zombie is not only down on the ground but already gone , it will STILL make some moaning noise for nearly a second more. That is just way too weird !
So I say: Sounds would have a "priority". If a sound is being played, another sound -or event- can IMMEDIATELY stop that sound, it would not have to "play to the end".
More important sounds would stop less important sounds. If you have say 32 sound channels on your PC, and 5000 chickens are fighting for them all, opening a chest would immediately free a channel, instantly killing one of the multiple chicken sounds going, so you can hear the chest properly. Because player actions would ALWAYS be much higher priority. Player sounds would be highest priority, then mobs, and son on, with farmable animals at the bottom of the sound priorities because those often generate TONS of sound sources.
Also, when multiple sounds exist that use the SAME type of source:
#1 The closest ones are heard first, but similar types of sound would not not "cut in line".
Currently in vanilla, when there are enough sound source they start "fighting" for the channels and the result is not simply a cacophony of distinctive sound, but a cacophony of partially-played sounds. If this was a visual instead of audible thing, the feeling would not be like seeing a lot of plates on a table, so many that you don't see the surface of the table. Instead the feeling would be of a lot of BROKEN plates on the table. that is what we have now.
Instead, when sounds are of the same general type, the sound sources try to "play nice". So you'll hear a lot of chickens when standing in your huge chicken farm. But you would not hear "rips" in the resulting noise. Just lots and lots of cackling,
#2 The amount of sound channels the game would try to allocate would NOT be proportional to the number of sources. It would actually grow "slower"'.
The following example list is totally arbitrary just to demonstrate the concept. The actual numbers would vary a lot on the fly according to how many total and currently free sound channels there are, and so on.
1 chickens -> 1 channel
2 chickens -> 2 channels
3 or 4 chickens -> 3 channels
5 to 8 chickens -> 4 channels
9 to 16 chickens -> 5 channels
17 to 32 chickens -> 6 channels
The progression could be less exponential of course -- I just wanted to use simple to understand numbers.
Basically, even standing in the middle of hundreds of chickens, it would not "ruin" the entire rest of the game's sounds.
Finally, sounds should not make heardable "rips". Personally I find it grating on my ears - almost painful. If cutting instantly a sound to make room for another sound would "hurt ears", then instead the 1st sound will still plays with a real quick "fade out", and THEN the new sound will fade-in, but not at it's starting "time zero" point, but where it would have reached by now if it could have started immediately when it was needed.
Currently:............COOOKADOODLEDOOO#WIIIIIIIIAAAAAAANNNNH (chest sound starts too late)
XXX#XX indicates unpredictable noise with # moment potentialy an "ear-hurting grating ripping" effect, a too strong "break" in the sound flow.
It should be:
Fadeout then fadein:..COOOKADOODledooiiiiiaAAAAANNNNH
with the lowercase part being the fadeout of the chicken, not going to the end of chicen sound once fadeout is sufficiently low volume, then fade-in of chest sound, but without a feeling of too late sound.
This is beautifully explained, though some of this seems like more trouble than it's worth. The game has an infinite possibility of block placements, and this idea would means that sound would have to properly "bounce" or be muffled by that. Still, I do agree how annoying the sounds can be, especially if there's an animal farm not far from you.
More or less, support.
Rollback Post to RevisionRollBack
Yeah, that guy in the avatar is me. I'm *that* strange. It happens. Sometimes people act like that. Just go with it. I can offer help with suggestions even before you post them - NOT make your suggestions - but help you with them.
This is awesome! Sound is one of my favorite factors in a game, and I'd love having this. Support.
Something else that I'd love having would be 3D binaural sound. You can look it up if you don't know what is is. Basically, it's the audio version of 3D. It mimics the way our ears work, so that you can pretty much pinpoint anything just by the sound. Above, below, or to the side. The only thing is, I'm not sure how it would work in a game.