View topic - Air absorption in spring



All times are UTC + 1 hour


Post new topic Reply to topic  [ 59 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: Air absorption in spring
PostPosted: 26 Feb 2010, 12:24 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
in latest master (since 23. Feb. 2010, or 195a5e71fbe1c95e63dd466dd4f5eba957cb8364), spring uses OpenAL air absorption. Details can be seen here (straight forward, easy to understand code):
http://github.com/spring/spring/commit/ ... a957cb8364

Effectively this means, in addition to decaying volume by distance, there is a low pass filter (also distance relative). So from far away, you will only hear the low frequency sounds. While the decay in volume does not happen when zooming out, just for (x,z) distance, the air-absorption uses the real 3D distance, so eg. laser sounds will not be hearable from far away, while explosions usually are still heard.

This is currently set to a fixed factor (0.1f). The reasons for the change are realism and to make the general sounds less annoying (additionally you could say for health, as high frequency sounds will damage the ears more over time, though... well ;-)).

soo.. please test this! and give feedback.
installer with this change can be found here:
http://buildbot.eat-peet.net/spring/ins ... b00aef.exe

side note: as you can see from the code, this needs the ALC_EXT_EFX OpenAL extension to work, and there will be an warning message in infolog if your system/OpenAL version does not support this, though it will work for most modern distributions.


Top
 Offline Profile  
 
PostPosted: 26 Feb 2010, 14:27 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
I found this very interesting, so I tested:

- I really couldn't hear the difference, and i was testing with a 24 by 24 map, used the sounds of thuds and llts firing.

Other stuff:
- If I zoomed out all the way, I could hear all sounds on the map just as if I was zoomed in, even from areas that were out of view. Meaning the sounds didn't get neither quieter nor low-passed as I increased Y. Is this intentional?
- If I zoomed in to normal view, I could only hear the sounds of stuff nearby, but also couldn't notice the low pass filter :(


Your avatar reminds of Mashed Potato Johnson btw :)


Top
 Offline Profile  
 
PostPosted: 26 Feb 2010, 14:32 
Spring Developer

Joined: 24 Jun 2007, 07:34
Location: 50┬░ 56' N, 11┬░ 35' O
Beherith wrote:
- I really couldn't hear the difference, and i was testing with a 24 by 24 map, used the sounds of thuds and llts firing.

Me neither

Beherith wrote:
- If I zoomed out all the way, I could hear all sounds on the map just as if I was zoomed in, even from areas that were out of view. Meaning the sounds didn't get neither quieter nor low-passed as I increased Y. Is this intentional?

That it won't become quieter is intentional. But what I get from hoijui, it still should be low-passed.


Top
 Offline Profile  
 
PostPosted: 26 Feb 2010, 18:28 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
did the two of you check infolog, relevant messages would be right after the OpenAL initial messages of vendor and version and such.


Top
 Offline Profile  
 
PostPosted: 26 Feb 2010, 19:11 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
ah ok, your right:
Code:
[      0] Sound:   Vendor:     Creative Labs Inc.
[      0] Sound:   Version:    1.1
[      0] Sound:   Renderer:   Software
[      0] Sound:   AL Extensions: EAX EAX2.0 EAX3.0 EAX4.0 EAX5.0 EAX3.0EMULATED EAX4.0EMULATED AL_EXT_OFFSET AL_EXT_LINEAR_DISTANCE AL_EXT_EXPONENT_DISTANCE
[      0] Sound:   ALC Extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_EFX
[      0] Sound:   Device:     Generic Software
[      0] Sound:   Available Devices: 
[      0] Sound:                       Generic Software
[      0] Sound: air absorption disabled, reason: ALC_EXT_EFX not supported
[      0] Sound:  parsed 25 sounds from gamedata/sounds.lua


That does beg the question though, what sound cards or drivers support this?


Top
 Offline Profile  
 
PostPosted: 26 Feb 2010, 19:13 
Redacted
User avatar

Joined: 11 Jul 2007, 16:47
soft-openal... does this work with creative's openal?


Top
 Offline Profile  
 
PostPosted: 26 Feb 2010, 20:27 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
that is what i get:
Code:
Sound: OpenAL info:
Sound:   Vendor:     OpenAL Community
Sound:   Version:    1.1 ALSOFT 1.9.563
Sound:   Renderer:   OpenAL Soft
Sound:   AL Extensions: AL_EXTX_buffer_sub_data AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_OFFSET AL_EXTX_sample_buffer_object AL_EXTX_source_distance_model AL_LOKI_quadriphonic
Sound:   ALC Extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_disconnect ALC_EXT_EFX ALC_EXTX_thread_local_context
Sound:   Device:     ALSA Software
Sound:   Available Devices: 
Sound:                       ALSA Software
Sound: air absorption enabled, value: 0.1


what you get is really strange, as ALC_EXT_EFX is in your list of supported extensions, but the explicit test seems to fail :/

this (Source.cpp:301):
Code:
alcIsExtensionPresent(NULL, "ALC_ENUMERATION_EXT")

seems to return true, while this (SoundSource.cpp:288):
Code:
alcIsExtensionPresent(NULL, "ALC_EXT_EFX")

returns true for you, according to your infolog, even doh both these extensions are listed there :/


Top
 Offline Profile  
 
PostPosted: 26 Feb 2010, 20:34 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
hmm.. maybe we have to use the actual device, instead of NULL for this test.


Top
 Offline Profile  
 
PostPosted: 26 Feb 2010, 21:02 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
done what i talked about in the last post, its on master now, windows executable here:
http://buildbot.eat-peet.net/spring/exe ... c8ae78.zip
that is enough if you have the installer i posted earlier, if not, new installer is here:
http://buildbot.eat-peet.net/spring/ins ... c8ae78.exe

please try again :-)
and sorry for tripple post


Top
 Offline Profile  
 
PostPosted: 03 Mar 2010, 00:08 
Modeler
User avatar

Joined: 02 Jan 2008, 21:55
On a somewhat related note, there should be a way to prevent being able to hear things that shouldn't be heard from across the map. For example, in the current spring you can easily guess the location of your opponent very early on in the game (most noticeably by the sounds of a lab building), because the sound is (as far as I know) only controlled by the position of your camera, not the position of your units. It'd be nice if sound volume was changed based on the location of your nearest unit, although I don't know how easy that would be to code or how well it would perform.

It's not a huge issue (it's not like it's hard to find the enemy with scouts), but it would be nice to have it fixed, to add some amount of unpredictability.


Top
 Offline Profile  
 
PostPosted: 03 Mar 2010, 08:31 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
Beherith wrote:
ah ok, your right:
Code:
[      0] Sound:   Vendor:     Creative Labs Inc.
[      0] Sound:   Version:    1.1
[      0] Sound:   Renderer:   Software
[      0] Sound:   AL Extensions: EAX EAX2.0 EAX3.0 EAX4.0 EAX5.0 EAX3.0EMULATED EAX4.0EMULATED AL_EXT_OFFSET AL_EXT_LINEAR_DISTANCE AL_EXT_EXPONENT_DISTANCE
[      0] Sound:   ALC Extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_EFX
[      0] Sound:   Device:     Generic Software
[      0] Sound:   Available Devices: 
[      0] Sound:                       Generic Software
[      0] Sound: air absorption disabled, reason: ALC_EXT_EFX not supported
[      0] Sound:  parsed 25 sounds from gamedata/sounds.lua


That does beg the question though, what sound cards or drivers support this?


I just noticed, I DO have this extension.


Top
 Offline Profile  
 
PostPosted: 05 Mar 2010, 13:02 
Map Creator
User avatar

Joined: 10 Mar 2006, 10:24
Location: waiting in line for The Expendables 2
why not have it depend on zoom out height too?


Top
 Offline Profile  
 
PostPosted: 05 Mar 2010, 13:18 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
now is says air distortion is enabled, with 0.1
Im testing with BA and still not hearing much of a difference.


Top
 Offline Profile  
 
PostPosted: 05 Mar 2010, 13:24 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
air absorption does use 3D distance, which includes zoom-out. volume uses a 2D distance (basically), this is nothing new though. the reason for this is, as i guess, so you do not have to manually adjust your speaker volume whenever you zoom in or out. this would be especially bad on big maps, where you TAB out while the game is quiet, adjust volume so you still hear stuff, and when battle starts, TAB right into the action -> BAWW! -> *heart attack* -> spring devs being sued -> community revolting -> civil war -> extinction of humanity -> NO MORE SPRING GAMES GETTING PLAYED!


Top
 Offline Profile  
 
PostPosted: 06 Mar 2010, 13:32 
Spring Developer

Joined: 24 Jun 2007, 07:34
Location: 50┬░ 56' N, 11┬░ 35' O
Distance is always 3d, so air absorption should be unaffected wherever you go away vertically or horizontally.


Top
 Offline Profile  
 
PostPosted: 06 Mar 2010, 13:37 
Moderator
User avatar

Joined: 26 Oct 2007, 15:21
Aus, can you hear the difference? Cause I cant, even tho its on :(


Top
 Offline Profile  
 
PostPosted: 06 Mar 2010, 14:14 
Spring Developer

Joined: 08 Oct 2006, 15:58
On a related dev-note, these commits mute (ie. totally silence, regardless of volume) all sounds for me, which I can fix only by commenting the airAbsorption = factor assignment in SoundSource::SetAirAbsorption. Any value > 0.0 will cause this, so it seems alSourcef is broken / unimplemented for AL_AIR_ABSORPTION_FACTOR. Details if you need them:

Quote:
Sound: OpenAL info:
Sound: Vendor: OpenAL Community
Sound: Version: 1.1
Sound: Renderer: OpenAL Soft
Sound: AL Extensions: AL_EXT_EXPONENT_DISTANCE AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS AL_EXT_OFFSET AL_LOKI_quadriphonic
Sound: ALC Extensions: ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE ALC_EXT_EFX
Sound: Device: ALSA Software on default
Sound: Available Devices:
Sound: ALSA Software on default
Sound: ALSA Software on Audigy 2 ZS [SB0350]
Sound: ALSA Software on USB Device 0x46d:0x8d9
Sound: OSS Software
Sound: Wave File Writer
Sound: air absorption enabled, value: 0.1


Top
 Offline Profile  
 
PostPosted: 06 Mar 2010, 14:39 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
hmm strange!
my AL version shows as "1.1 ALSOFT 1.9.563", and you two (Behe and Kloot) only get "1.1", pretty bad it does not show the full version.

and about the muting.. :/
guess i will leave it at 0.0 by default, and make it configurable through spring settings.

edit:
Behe, maybe try setting the factor to something higher (eg 1.0), and see if it changes anything... that would be VERY noticeable.


Top
 Offline Profile  
 
PostPosted: 06 Mar 2010, 15:09 
Spring Developer
User avatar

Joined: 22 Sep 2007, 08:51
talked to the OpenAL Soft chief again:
Quote:
if openal soft is only showing version "1.1" it's a really old version.

EFX was added to openal soft in 1.2, and I think I added the extended version info around 1.4 or so.

normally what I've seen done with binary apps in Linux, they provide their own libopenal.so.1 with their other libs (eg. SDL, stdc++). users that want to use the system openal can just rename the provided one, and it'll fall back to it.

Auswaschbar packaged OpenAL Soft with mingwlibs now, i do not know which version though, but.. this is likely to be the problem here (too old OpenAL versions).

about the last paragraph/sentence (libopenal.so.1): i would say it is not worth doing this for spring, just for air-absorption.


Top
 Offline Profile  
 
PostPosted: 08 Mar 2010, 20:01 
Cursed Zero-K Developer
User avatar

Joined: 07 Nov 2007, 21:48
Location: Horse
This idea sounds awesome, I hope it works for me on the next release.

But there are some infamous mappers who will grow angry at the use of air absorption because some maps don't have air. They will claim it ruins immersion and tramples on mapper's rights.


Top
 Offline Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 59 posts ]  Go to page 1, 2, 3  Next

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group

Site layout created by Roflcopter et al.