Tracker: Adjust volume with scaling / distance

Started by strazer, Sun 25/04/2004 04:29:43

Previous topic - Next topic

strazer

If you assign (footstep) sounds to a character view, shouldn't they be less audible the farther he is away?

..

That's a good idea. And the same could be applied to talkie games possibly. Where you could have characters talking as they walk off (Muttering Maybe).

Pumaman

That's a pretty neat idea, actually.

So it would only apply to view-linked sounds, and only if they were part of a character animation?

strazer

Right, the volume would depend on the scaling factor of the character that is using the view the sounds are linked to.

Ben

Heh.. I was just thinking about that yesterday. I just put a long, narrow hallway in my game, and thought the character was awfully loud when he was fifty feet away. This would be a great feature :)

Hmm.. I just had an idea. With the repeatedly_execute_always function, you could add an echo at the same time that stays the same volume.. That would bake it even more realistic.

TerranRich

Quote from: strazer on Sun 25/04/2004 13:58:22
Right, the volume would depend on the scaling factor of the character that is using the view the sounds are linked to.

1. Would this be possible to do using a workaround code?

2. Don't forget to make it optional for each room, like maybe a global variable (game.footsteps_scaled perhaps?), because there might be a larger room or a room with sizing effects where scaling doesn't necessarily relate to virtal distance from the player.

Know what I mean? :P
Status: Trying to come up with some ideas...

strazer

1. I wouldn't know how, as you can't seem to assign a certain channel to view-linked sounds, can you? They just play in a free channel.

2. It should be optional, absolutely. I was thinking of making a checkbox for each character?

Ashen

How about something like:

if (character[EGO].walking == 1) PlaySoundEx (3, 3);

in 'Repeatedly Execute' (where sound 3 is the footstep sound), to force the footsteps into a specific channel, then a series of

if (GetScalingAt(player.x, player.y) == n) {
 SetChannelVolume (3, 50);
}
else if (GetScalingAt(player.x, player.y) == n=1) {
 SetChannelVolume (3, 60);
}

etc., to set the volume. It's not particularly elegant, but it should work.

TerranRich

Quote from: Ashen on Mon 26/04/2004 17:35:40
How about something like:

if (character[EGO].walking == 1) PlaySoundEx (3, 3);

in 'Repeatedly Execute' (where sound 3 is the footstep sound), to force the footsteps into a specific channel...

Nah, that wouldn't match the footsteps of the animation. Perhaps a frame check? Something like:

if ( (character[EGO].frame==2) || (character[EGO].frame==7) ) PlaySoundEx(3, 3);

Hmm, good stuff for the Tech Archive.
Status: Trying to come up with some ideas...

Ashen

Yeah, I was worried about it not syncing up. For some reason character[].frame just didn't occur to me, even though I'd read it about 5 times. Funny that. Does it work otehrwise? I haven't had a chance to try it out.

Alynn

#10
Could this be expanded to character to character... so if you have multiple characters in the room, say a scrolling room, and the character is walking or animating outside the viewport, as the viewport gets closer to the character, or even as the PC gets closer to the character, the sound gets louder...

Currently I have to do a bunch of scripting to change the volume of a character chopping wood in a certain scene. This feature would get rid of the need of all that scripting. Maybe something like camera_is_ear and player_is_ear for each character... so you could set the pc as camera_is_ear so the farther away the quieter his view sounds, and all other characters as player_is_ear so their sounds get louder as the PC gets closer to them.

Just a thought....

On second thought why not have a combonation of both... for instance an animating character with a sound is in a walkable area at 50% height so his sound affect is at 50% volume, as long as the character is within the current viewport, the farther the character is away from the viewport edge the volume is slowly decreased from there....

thinking about it... it may take some coding to check the viewport and character position and all that jazz to make it work properly, but if anyone can do it... its CJ!!!!!!one!11one!!1

a-v-o

Could it be implemented in the region like scaling in the walkable area?
Regions have a sound level which could be the same for the whole region or continous between the two different values for front and back.
Characters have a checkbox "ignore room area sound volume".
Then the volume for all sounds that a character produces (footsteps, voice) is adjusted to the current volume.
And a variable giving the current volume level of a character would be good for scripting: something like character[].volume. Then other sounds could be adjusted to the character's sound.

Pumaman

There are two different issues here - adjusting with scaling and adjusting with distance. I'll add it to my list.

With the repeatedly_execute_always function, it's fairly easy to do it yourself using the manner Ashen suggested, for the time being.

SMF spam blocked by CleanTalk