ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
Grenade Audio Fade

Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  09:26:54  28 July 2013
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
Messages: 567
Grenade Audio Fade

Fellow Stalkers,

I like explosions. I especially like nifty code. In SoC, there is some kind of code somewhere that decreases the game world's volume (of everything) when a grenade goes off close enough to the player while, simultaneously, increasing the volume of an ear-ringing audio sample. After a few seconds, they re-balance and things go back to normal.

This is interesting because it has to measure the distance of the explosion to the player, fade the game world volume, and fade the ear-ring audio. These would be very nifty things for me to know!

A similar thing happens in sr_psy_antenna.script, where the game world volume again fades out while the psy damage audio fades in based on how psy damaged you are.

Where can I get access to that grenade script? I can't find it. I'm guessing the same code to do what I need is in sr_psy_antenna.script, but it is so hard for me to parse and split apart into a separate script that I could mess with. I can't fully understand it and am not sure what I need from it. Can anyone help?


Thanks!
  14:52:39  30 July 2013
profilee-mailreply Message URLTo the Top
NatVac
Senior Resident
 

 
On forum: 06/15/2007
 

Message edited by:
NatVac
07/30/2013 15:00:00
Messages: 4263
Maybe mute_sound_threshold in that script is what you seek.

The update() function is called in bind_stalker.script's actor_binder:update() function. It in turn calls update_sound which modifies the volume via level.set_snd_volume(). You could do something similar to the sr_psy_antenna.psy_antenna test in actor_binder:update() to call your sound update() function in your grenade sound script.
  19:11:19  30 July 2013
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
Messages: 567

---QUOTATION---
Maybe mute_sound_threshold in that script is what you seek.

The update() function is called in bind_stalker.script's actor_binder:update() function. It in turn calls update_sound which modifies the volume via level.set_snd_volume(). You could do something similar to the sr_psy_antenna.psy_antenna test in actor_binder:update() to call your sound update() function in your grenade sound script.
---END QUOTATION---


Thanks, NatVac. I think that gives me enough to work with for now.

About the existing function - any idea where that is? I'll need to find it somewhere so I don't overwrite it/create complications. I am assuming it is hard-coded, though, because I haven't found it yet.
  20:36:39  30 July 2013
profilee-mailreply Message URLTo the Top
NatVac
Senior Resident
 

 
On forum: 06/15/2007
 

Message edited by:
NatVac
07/30/2013 20:41:28
Messages: 4263
The engine plays sounds\affects\tinnitis3a.ogg for the explosion sound; see actor.ltx, the [actor_hit_snds] section, referenced by xrGame.dll via hit_sounds. It's just another pain sound.

I think you are correct that it is hard-coded. Perhaps the game shuts all sounds off, then plays that sound. There might be some useful clues in the grenade .ltx files or in weapons.ltx.
  09:14:20  1 August 2013
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
Messages: 567
Darn. All of the ideas I get really excited about are often off-limits.

Thanks, guys. I'll see if there still isn't something I can do, but with that stuff hard-coded, I don't see a way I could implement any significant changes without conflicting with the existing functions.
  01:14:54  3 September 2013
profilee-mailreply Message URLTo the Top
{imperialreign}
Звуковой Шаман
(Resident)

 

 
On forum: 10/29/2008
Messages: 3075
I know I'm a little late to the party here, but, yeah... as was pointed out, it's a hard-coded "feature" of the engine. From my testing back in the day, basically the engine prioritizes sounds based on their declared sound type in the commenting. Playback of certain sound types takes precedence over others. IIRC, the order sound types are displayed in the editor is the order of precedence (from top to bottom). World ambient takes the least amount over anything else. This is fairly easy to duplicate in heavy gunfire with AI, or around numerous chatty NPCs - ambient sounds are played far more quietly than normal. In some cases, they're barely discernible. It gets further complicated by the sound's declared base volume, as the engine will adjust volume for different factors (hence why I've always recommended leaving a sound at 1.0, if possible), and also the distance from the source... actor footsteps are a good example of the engine adjusting sound volumes - sprinting is played louder than the base (1.25 or 1.5), walking/crouching is played more softly (.5 or .75), and low-crouch is as quiet as it will go (.25 or .5). To make stealth a little more interesting, I had set volume sounds for specific materials a bit louder, as the material is simply inherently louder than others (i.e. metal, water). Again, this is all mostly theory from spending countless hours trying to understand how the engine handles audio processing, and how those audio commenting values affected the work I was trying to do, lol.
Anyhow, I think you probably get the general gist of how it's handled. In some cases you an use this to your advantage by declaring a sound to be of a different type... buuutt, then there's the issue of NPC behavior, as certain sound types they won't react to. Other sound types they will only react if the engine's adjusted/modified playback volume is over a certain threshold (these values, IIRC, can be sound in m_stalker, under the heading [sound_percieve])... the biggest reason why I used to advise many modders to not fiddle too heavily with those values (especially for stealth), and focus instead on the audio commenting values. Basically, if the modified playback volume is *above* the perception value, and the AI is within the "max range" of the sound's source, and is within a range that the volume attenuation makes the sound "hearable," the NPC will react to said sound. Prime example of back when modders were fiddling with the perception values, and not the commenting, left us with AI reacting/engaging with gunfights with enemies 250M+ away, etc.

Alas, until the engine source code is granted to us, one aspect where there's not much we can do :/
  07:21:26  9 October 2013
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
Messages: 567

---QUOTATION---
I know I'm a little late to the party here, but, yeah... as was pointed out, it's a hard-coded "feature" of the engine. From my testing back in the day, basically the engine prioritizes sounds based on their declared sound type in the commenting. Playback of certain sound types takes precedence over others. IIRC, the order sound types are displayed in the editor is the order of precedence (from top to bottom). World ambient takes the least amount over anything else. This is fairly easy to duplicate in heavy gunfire with AI, or around numerous chatty NPCs - ambient sounds are played far more quietly than normal. In some cases, they're barely discernible. It gets further complicated by the sound's declared base volume, as the engine will adjust volume for different factors (hence why I've always recommended leaving a sound at 1.0, if possible), and also the distance from the source... actor footsteps are a good example of the engine adjusting sound volumes - sprinting is played louder than the base (1.25 or 1.5), walking/crouching is played more softly (.5 or .75), and low-crouch is as quiet as it will go (.25 or .5). To make stealth a little more interesting, I had set volume sounds for specific materials a bit louder, as the material is simply inherently louder than others (i.e. metal, water). Again, this is all mostly theory from spending countless hours trying to understand how the engine handles audio processing, and how those audio commenting values affected the work I was trying to do, lol.
Anyhow, I think you probably get the general gist of how it's handled. In some cases you an use this to your advantage by declaring a sound to be of a different type... buuutt, then there's the issue of NPC behavior, as certain sound types they won't react to. Other sound types they will only react if the engine's adjusted/modified playback volume is over a certain threshold (these values, IIRC, can be sound in m_stalker, under the heading [sound_percieve])... the biggest reason why I used to advise many modders to not fiddle too heavily with those values (especially for stealth), and focus instead on the audio commenting values. Basically, if the modified playback volume is *above* the perception value, and the AI is within the "max range" of the sound's source, and is within a range that the volume attenuation makes the sound "hearable," the NPC will react to said sound. Prime example of back when modders were fiddling with the perception values, and not the commenting, left us with AI reacting/engaging with gunfights with enemies 250M+ away, etc.

Alas, until the engine source code is granted to us, one aspect where there's not much we can do :/
---END QUOTATION---


I might still have a few tricks up my sleeve, we'll see. This is all super-helpful though, thank you.
 
Each word should be at least 3 characters long.
Search:    
Search conditions:    - spaces as AND    - spaces as OR   
 
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
 

All short dates are in Month-Day-Year format.


 

Copyright © 1995-2019 GSC Game World. All rights reserved.
This site is best viewed in Internet Explorer 4.xx and up and Javascript enabled. Webmaster.
Opera Software products are not supported.
If any problem concerning the site functioning under Opera Software appears apply
to Opera Software technical support service.