Another Sound Question...

Posted By: quasarchangel

Another Sound Question... - 08/19/07 18:06

Why can we not set the sounds to play at a specific volume and a specific distince separately? Everyone knows that gun shots should be heard from quite a distance and so I would like to set them to be heard from quite far. I obviously can do that, but then I can not allow the player to lower the volume of all the sounds in the menu if I wanted to get his attention by playing a gun shot from a distance because he would not hear it if he set the volume to something like 10. Any suggestions to get around this? Or am I missing something?
Posted By: EpsiloN

Re: Another Sound Question... - 08/19/07 18:32

The user will set the volume to 100 and set the volume of his speakers to hear normaly if he wants to enjoy the game. If he's playing the game just because he doesnt have anything else to do,you dont need to get his attention with gun shots he doesnt want you to get his attention.
Btw , you can hear the sounds from far by increasing the volume , but it'll be too loud at the bullet possition. It is realistic if you do it that way,but after all this is a game you dont want to scare the player if he is shooting.
Posted By: quasarchangel

Re: Another Sound Question... - 08/19/07 18:50

lol, I meant to have him look in the direction from where the shot came.

Quote:

you dont want to scare the player if he is shooting




Anyway thats the whole point of being able to set a sound at a volume of 50 and then still be able to hear it from far. One can probably work around it but its always nice to have a bit more flexibility and it can't be dificult to change the function to take another parameter.
Posted By: Nowherebrain

Re: Another Sound Question... - 08/19/07 18:51

convert all sound volumes to a percent based on the player location. I have not tried it in practice, just an idea.
Posted By: EpsiloN

Re: Another Sound Question... - 08/19/07 19:12

Nowherebrain is right , use something like
snd_vol = ((vec_dist(player.x,sound emitting entity.x) / 20) * -1) + 100;
if snd_vol > 100) { snd_vol = 100; }
if snd_vol < 0) { snd_vol = 0; }

the math...if see(sound emitting entity) is 2000 quants away - snd_vol = 2000 / 20 = 100 * -1 = -100 + 100 = 0.
if see is 1 quant away = 1 / 20 = 0.05 * -1 = -0.05 + 100 = 99.95 (almost max snd vol for example)
Thats in case the sound distance is maximum 2000 quants. Divide by more for higher values. 200 / 2 or 20000 / 200...
© 2024 lite-C Forums