# Range of sv_soundpos and Env_Sound

2 Antworten__1__

08.08.18 19:59:36

So as you all know, we have an entity called env_sound which creates a sound at everywhere or at the position within a range (which scales by the volume setting, I think). sv_soundpos is the almost same thing excluding the volume cannot be adjusted.

These are pretty cool features but I always mind that how much big is that range

I thought DC could be the only one who does know the answer but using the forum for this would make the information provided for everyone else.

Thanks.

These are pretty cool features but I always mind that how much big is that range

*in pixels*and how actually it scales (scaling is a thing for only the entity).I thought DC could be the only one who does know the answer but using the forum for this would make the information provided for everyone else.

Thanks.

Create and design your GUI easy and fast: GUI Framework (12) | Go deep of the darkness and try your intrepidity: Outlast 2 Modification (25)

Hi,

the calculation for the distance is ultra simple (and a bit wrong*):

with dx/dy = horizontal/vertical distance (absolute delta) between player and sound position in pixels

(*This is not very accurate because for a fully correct distance calculation you would have to do power of 2 and square root stuff [sqr(dx²+dy²)]. Moreover it would be better to multiply the reduction with the base value instead of simply subtracting it. But whatever. That's how it.)

In other words: The

The volume decreases linearly over distance. So 500 distance pixels (~15 tiles) mean half of the original volume already.

The map structure does NOT have any impact on the calculation.

Hope that helps to give you an idea.

... and I probably really should improve that formula like explained above. Ooops.

the calculation for the distance is ultra simple (and a bit wrong*):

volume=baseVolume-(dx+dy)/1000

with dx/dy = horizontal/vertical distance (absolute delta) between player and sound position in pixels

(*This is not very accurate because for a fully correct distance calculation you would have to do power of 2 and square root stuff [sqr(dx²+dy²)]. Moreover it would be better to multiply the reduction with the base value instead of simply subtracting it. But whatever. That's how it.)

In other words: The

**max distance**at which you can hear full volume sounds in theory (with game volume set to 100) is roughly 1000 pixels.**1000/32 = 31.25 tiles**.**In practice it will be way less**of course because ultra silent sounds are not perceivable / only perceivable if you use an insanely high overall volume.The volume decreases linearly over distance. So 500 distance pixels (~15 tiles) mean half of the original volume already.

The map structure does NOT have any impact on the calculation.

Hope that helps to give you an idea.

... and I probably really should improve that formula like explained above. Ooops.

Thanks, this certainly answers the topic.

By the way, sorry about the PM.

By the way, sorry about the PM.

Create and design your GUI easy and fast: GUI Framework (12) | Go deep of the darkness and try your intrepidity: Outlast 2 Modification (25)

__1__