Jump to content
Sign in to follow this  
SaBrE_UK

Different Sounds For Different Distances

Recommended Posts

Here's what I think is a new suggestion (sorry if it isn't).

A known problem with ArmA is the sound system, which means each gunshot will have the same sound (albeit lower volume) for all distances which means either near or far sounds don't sound right, and usually a poor compromise is made in sound mods.

I don't know much about scripting but I was wondering if it is possible to script in different sounds for different distances. So have a close-quarter "boom" if a gunshot is nearby, then after a certain distance have a different sound, then again after an even further distance have yet another sound.

Could this be done in theory with the "fired" eventhandler and detecting the weapon is fired? Perhaps the actual weapon would make no sound at all, then depending on the distance of the gunshot, the game would play the correct sound to the player's ears with a script. Would there be too much of a delay or lag with such a system in large battles?

I hope you know what I mean. I just wondered if scripting could give an alternative to a BIS made revamped sound system (which isn't likely). I expect it would need a lot of time or for some reason wouldn't work in practice but discussion is welcome smile_o.gif Perhaps it would also work for distance vehicle sounds as well?

What do you think?

Share this post


Link to post
Share on other sites

Hm.

If Say works like it should with sound occlusion and such (which AFAIK it does), then this could work. By messing with the db +/- values in the config.cpp/description.ext, you can decide how far a certain sound can be heard from the source. So for instance a db-0 will mean a few meters, whereas db+1000 could be for considerably longer. Haven't checked for HOW much longer exactly, but that's the theory.

Then, you could, using a fired eventhandler, have the unit Say sounds depending on the weapon and the muzzle: with some creative sound-mongering and the use of the dB system, it should in principle be possible to have the unit say all the various possible permutations of the sound (long, medium, short) - or possibly use a mix thereof (only use Say for medium and short, and make the default sound long distance, like Chammy's).

Here're the caveats:

1) Bunch of eventhandlers and extra code running on EVERY UNIT in the game which might in certain situations impact negatively on performance.

2) A unit can, I believe, only Say one thing at a time - consecutive says will be queued up, or not said at all. Which means you can't have someone talking while shooting in for instance cutscenes - might f*ck up the built-in VOIP too, not sure.

3) And the biggest caveat of them all: in cutscenes, all says are essentially converted to playSounds, meaning whenever a cutscene plays you'd hear the report of guns on the other side of the planet. On the other hand, if you just disable the scripts then all cutscenes that involve shooting would sound like crap.

So...interesting idea from a scripting standpoint, but I don't really know how well it'd pan out in reality. smile_o.gif

Regards,

Wolfrug

Share this post


Link to post
Share on other sites

Thanks for the feedback on my idea, interesting discussion smile_o.gif Could the problem of having the unit "say" it be overcome by "creating" a sound invisible object? I suppose that would have a very detrimental effect of performance in a large battle. So it seems it could be done but performance is always the limitation.

Still, we've seen various destructible buildings concept videos, how about someone (if they are interested) trying this sound system out with scripts?

Anyone else got any feedback? Or is ArmA's current sound system fine for most players?

Share this post


Link to post
Share on other sites

I played just for the fun of it with sounds played from "fired" event handler in Operation Flashpoint.

Here is some example I wrote for someone else about it, I think it was at www.ofpec.com forum.

This method means that the sound is played together with the original sound of the weapon.

The method worked well for me in single player mode. I did not test it in multiplayer at all.

Description.ext:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class CfgSounds

{

sounds[] = {};

class singleShot

{

name = "single";

sound[] = {"single.wss", db, 1.0};

titles[] = {};

};

class burstShot

{

name = "burst";

sound[] = {"burst.wss", db, 1.0};

titles[] = {};

};

class autoShot

{

name = "auto";

sound[] = {"auto.wss", db, 1.0};

titles[] = {};

};

};

single.wss, burst.wss and auto.wss are sound files in sound subdirectory in the mission directory. As you might have already guessed, they are meant to be played when a weapon has been fired in a corresponding fire mode.

Trigger (to collect the units from the trigger's area and add the fired EH to them):

<span style='color:Brown'>axis a = 100, axis b = 100

activation: anybody present

type: switch

condition: this

on activation:</span>

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{ _x addEventHandler ["fired", { if ( (_this select 2 != "throw") && (_this select 2 != "put") ) then { if (_this select 3 == "single") then {playSound "singleShot"} else { if (_this select 3 == "burst") then {playSound "burstShot"} else {playSound "autoShot"} } } }]  } forEach thisList

One tip is that do not start a script file from the event handler, but stuff the required code directly into the event handler initialization code as I have done in my example.

The same method should work in ArmA too, I see no reason why it wouldn't. But I haven't test it in ArmA.

I'm sure if there are any changes needed for ArmA, they are easy to do.

Share this post


Link to post
Share on other sites

Wow thanks, I'll give that a go some time. The system does have some inherent problems, though, as the "distant" sound is played even nearby when it should only be heard from far away.

Share this post


Link to post
Share on other sites

You could try "say" instead of "playSound" although I don't know if it works for the idea. Wolfrug above says some possible problems about it.

I don't know if the AI soldiers react to sounds played with playSound. I guess they don't, but I didn't verify it by testing.

The thing here with the example I showed, would be to keep the original weapon sound as the farthest distance sound, and when the listener is closer to the weapon, then you would add another sound on top of the original to make it louder and sound different.

That way it could be done without creating an addon. Replacing the original weapon sound requires you to create an addon I think.

But I think "say" should be used instead of "playSound" like Wolfrug says. The playSound works if it is used only for the singleplayer's weapon, as I did in my testing. For that the example I showed works very well.

And then the system should be disabled for cutscenes, if what he says is right.

Although I can see that it is not easy to get right. Probably requires a lot of tweaking to get right.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×