Forum

> > CS2D > General > Range of sv_soundpos and Env_Sound
ForenübersichtCS2D-ÜbersichtGeneral-ÜbersichtEinloggen, um zu antworten

Englisch Range of sv_soundpos and Env_Sound

2 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Range of sv_soundpos and Env_Sound

Masea
Super User Off Offline

Zitieren
So as you all know, we have an entity called cs2d entity env_sound which creates a sound at everywhere or at the position within a range (which scales by the volume setting, I think). cs2d cmd 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 in pixels and how actually it scales (scaling is a thing for only the entity).

I thought user 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.

alt Re: Range of sv_soundpos and Env_Sound

DC
Admin Off Offline

Zitieren
Hi,

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.
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antwortenGeneral-ÜbersichtCS2D-ÜbersichtForenübersicht