Sound
Moderator: Moderators
-
- Imperial Winter Developer
- Posts: 3742
- Joined: 24 Aug 2004, 08:59
Don't fade the sound in the vertical axis. Only fade according to the distance in the horizontal plane. But then when zoomed out we'll only hear the units in the middle. So maybe, never fade the sound of any unit visible. But then when in FPS mode we'll hear clearly the units on the other side of the map by looking at them.
So: calculate the distance H between the camera and the ground below the camera. Take that at the distance around which sound is heard normally. Then, anything at a distance D would have a sound volume of D/H.
So: calculate the distance H between the camera and the ground below the camera. Take that at the distance around which sound is heard normally. Then, anything at a distance D would have a sound volume of D/H.
Well given the fact that a player actually playing this game will be zoomed out a lot most of the time, I'd say I'd like to hear more sounds as well. At the moment I usually don't hear anything. In TA it didn't matter where you were on the map, your commander would still make a sound for you to hear when his build queue was finished. So i'd like to hear more sounds and be more part of the action.
-
- Spring Developer
- Posts: 374
- Joined: 14 Mar 2005, 12:32
You're on the right track, but that doesn't do the trick completely. If you use D/H the height H is dominant over the distance D when you're zoomed out, and D/H becomes a relativily small number. What happens then is that you hear sounds from all over the map (not just from the camera focus).zwzsg wrote:So: calculate the distance H between the camera and the ground below the camera. Take that at the distance around which sound is heard normally. Then, anything at a distance D would have a sound volume of D/H.
A better approximation turns out to be D/(H^0.25), ensuring that the size of the denominator stays 'within limits'. I haven't tried it on a full-scale battle yet, but with a lone commander this gives excellent results.
As a rule of thumb: the less sounds you want to hear when zoomed out, the smaller the power of the height has to be. In the limit that the power goes to zero (and thus H^0 = 1) we're back at the original situation (just using D).
Here's how you implement it in the code: edit Sound.cpp and change line 258
Code: Select all
float dl=dif.Length();
Code: Select all
float dl=dif.Length() / sqrt(sqrt(camera->pos.y));
I would assert that a Gaussian or normal distribution would be better for sound. With it, things near a low camera would be louder than things near a high camera, but things far from a high camera would be louder than things far from a low camera, but still softer than things near a high camera.
The code would look something like this:
The code would look something like this:
Code: Select all
float dl=camera->pos.y/exp(-dif.Length()*dif.Length()/2/camera->pos.y/camera->pos.y)
-
- Spring Developer
- Posts: 374
- Joined: 14 Mar 2005, 12:32
I'm afraid you'll have to break this down to me a bit more explicitly, because I have no idea of what you're proposing. A gaussian distribution of what exactly?ILMTitan wrote:I would assert that a Gaussian or normal distribution would be better for sound. With it, things near a low camera would be louder than things near a high camera, but things far from a high camera would be louder than things far from a low camera, but still softer than things near a high camera.
Also, the code you suggested doesn't work; perhaps you added one minus sign too many? Because, using zwzsg's notation, you have
dl = H*exp(D^2 / H^2).
When zoomed in (i.e. H is small) this behaves as exp(D^2), which gets big pretty fast: you won't be able to hear anything unless it's really close.
When zoomed out (i.e. H is of the same order of magnitude as D) this behaves as H, which is more or less the original situation.
-
- Imperial Winter Developer
- Posts: 3742
- Joined: 24 Aug 2004, 08:59
-
- Imperial Winter Developer
- Posts: 3742
- Joined: 24 Aug 2004, 08:59
-
- Spring Developer
- Posts: 374
- Joined: 14 Mar 2005, 12:32
Apart from the zooming business, we currently (i.e. with 0.50b1) hear sounds from all over the map, even from things that are not in our LOS.
You could for instance zoom in on the location of your opponents base (if you have an idea where that could be) and hear what he is doing. Or you can discover the location of his base by just listening very carefully ...
I propose that we only hear sounds from things that are in our LOS. Makes things a bit fairer (and more realistic, I'd say). Here's how you implement in the code: open up Sound.cpp, and add a
at the beginning. Find lines 251-258
and replace them with
This includes my 'zooming solution' (just for the sake of completeness ...)
You could for instance zoom in on the location of your opponents base (if you have an idea where that could be) and hear what he is doing. Or you can discover the location of his base by just listening very carefully ...
I propose that we only hear sounds from things that are in our LOS. Makes things a bit fairer (and more realistic, I'd say). Here's how you implement in the code: open up Sound.cpp, and add a
Code: Select all
#include "loshandler.h"
Code: Select all
if(noSound || id<=0 || id>=loadedSounds.size()){
POP_CODE_MODE;
return;
}
HRESULT hr;
float3 dif=p - camera->pos;
float dl=dif.Length();
Code: Select all
if(noSound || id<=0 || id>=loadedSounds.size() || !loshandler->InLos(p, gu->myAllyTeam)){
POP_CODE_MODE;
return;
}
HRESULT hr;
float3 dif=p - camera->pos;
float factor = 0.2;
float dl=dif.Length() / pow(camera->pos.y, factor);
I am realy for the idea that when you look at a tank coloum that is trundling along, you here the treads creaking and the engians. And with a k-bot group marching around you sould well... here marching. Also i would like a doppler effect for BB and indimidator shells. Namly cause iv been playing Silent Hunter III, a sub game, and it has the BEST ARTTILERY effects EVER.
Example: I was on the deck of my U-bot (in SHIII) and i was looking a the storm rageing around me. It was cool!. Then i saw a bunch of lightling that was REALY close to the ground. "Wait!" i said to my slef "Thats no-" the suddenly a bunch of shells peppered the water around me, and quite a few over shot me and i herd a WIIIIIIIIIIIIIIZ! noise. Then i herd the low rumbleof cannon fire in the distance.
So when a LRPC fire's on you you sould see a flash off in the distacne, then if the shell fly's past the camera POV then you sould hear a doppler effect and a boom! I have surround sound and i want the full mony's worth damn it!
Example: I was on the deck of my U-bot (in SHIII) and i was looking a the storm rageing around me. It was cool!. Then i saw a bunch of lightling that was REALY close to the ground. "Wait!" i said to my slef "Thats no-" the suddenly a bunch of shells peppered the water around me, and quite a few over shot me and i herd a WIIIIIIIIIIIIIIZ! noise. Then i herd the low rumbleof cannon fire in the distance.
So when a LRPC fire's on you you sould see a flash off in the distacne, then if the shell fly's past the camera POV then you sould hear a doppler effect and a boom! I have surround sound and i want the full mony's worth damn it!