Jump to content
The Dark Mod Forums

EFX preset spawnarg for Location entities?


Frost_Salamander

Recommended Posts

Currently if you are implementing EFX in your map, you need to maintain an .efx file: https://wiki.thedarkmod.com/index.php?title=Setting_Reverb_Data_of_Rooms_(EAX)

If you are using presets only, all this is is simply a 1:1 mapping of location entities to an EFX preset.  Doing this in a file is kind of tedious and error-prone, as you have to check each location entity in your map, and then check the file to make sure you got the location entity name correct, or didn't leave one out, etc.

Would it be a worthwhile feature request to be able to just set the EFX preset with a spawnarg on the location entity itself?  Something like:

"efx_preset"    "WOODEN_SMALLROOM"

Also, the location entity has other zone-related information, like ambient sound, ambient light, etc.  It would just make sense to have the EFX here as well.

This would only make sense for the presets, since you just need the preset name.  If you wanted to do anything more complicated, the file could still be used.  If both are used for the preset, one could take precedence over the other (the spawnarg pehaps).

I don't think anything would need to change in DR either, as it's just a new spawnarg on the entity.

 

 

  • Like 2

TDM Community Github: https://github.com/thedarkmodcommunity

My fan missions: The Hare in the Snare, Part 1

The Lieutenant Series: In Plain Sight  High Expectations Foreign Affairs

Link to comment
Share on other sites

On a related note, I would like to be able to change a room's EAX settings on the fly. Currently it's possible to change a room's ambient light and sound by using a script to swap out one atdm:location for another, though you do need to leave through an atdm:locationseparator and come back. However, the EAX settings do not update.

  • Like 2

My missions:           Stand-alone                                                      Duncan Lynch series                              

                                      Down and Out on Newford Road              the Factory Heist

                                                                                                  A House Call

                                                                                                  The House of deLisle                                                                                                  

                              

Link to comment
Share on other sites

8 hours ago, thebigh said:

Currently it's possible to change a room's ambient light and sound by using a script to swap out one atdm:location for another

I needed this functionality as well, but I found that simply updating the ambient spawnargs on the location entity (via a script) worked fine, although like you said you had to leave and come back into the room.

Anyways, getting slightly off topic :-).

 @stgatilov does the original ask make sense? I'm never sure if we should wait and hope for the dev team to see these, or just add a feature request to the bugtracker....

  • Like 1

TDM Community Github: https://github.com/thedarkmodcommunity

My fan missions: The Hare in the Snare, Part 1

The Lieutenant Series: In Plain Sight  High Expectations Foreign Affairs

Link to comment
Share on other sites

46 minutes ago, stgatilov said:

Yes, I think it is possible to specify efx preset in location entity.

Probably worth it to implement cross-fading of EFX settings simultaneously.
 

Thank you - feature request here: https://bugs.thedarkmod.com/view.php?id=6273

  • Like 1

TDM Community Github: https://github.com/thedarkmodcommunity

My fan missions: The Hare in the Snare, Part 1

The Lieutenant Series: In Plain Sight  High Expectations Foreign Affairs

Link to comment
Share on other sites

That'd be a great idea.

To dynamically change EFX, we have to know that it's a dynamic feature and not one permanently set during dmap or spawn time.

  • Like 1

What do you see when you turn out the light? I can't tell you but I know that it's mine.

Link to comment
Share on other sites

On 3/19/2023 at 12:55 AM, Frost_Salamander said:

I found that simply updating the ambient spawnargs on the location entity (via a script) worked fine, although like you said you had to leave and come back into the room.

True. However, if the EFX settings are read from a file I think you'd need to pull the switcheroo script trick because those are determined by the name of the atdm:location entity. I suspect that changing its name spawnarg during play would be asking for all sorts of trouble.

My missions:           Stand-alone                                                      Duncan Lynch series                              

                                      Down and Out on Newford Road              the Factory Heist

                                                                                                  A House Call

                                                                                                  The House of deLisle                                                                                                  

                              

Link to comment
Share on other sites

15 hours ago, thebigh said:

True. However, if the EFX settings are read from a file I think you'd need to pull the switcheroo script trick because those are determined by the name of the atdm:location entity. I suspect that changing its name spawnarg during play would be asking for all sorts of trouble.

Well you don't need to change the name of the entity, only the ambient/ambient_light spawnargs on it.  That's what I did anyways.

I did actually try the 'switcheroo' trick first, but kept getting errors about multiple entities with the same name even though I was removing the old one first.  No idea why.  Then I tried the spawnarg thing and that worked so I left it at that.

TDM Community Github: https://github.com/thedarkmodcommunity

My fan missions: The Hare in the Snare, Part 1

The Lieutenant Series: In Plain Sight  High Expectations Foreign Affairs

Link to comment
Share on other sites

If you're not using a preset, a custom EFX setting read from the file looks something like this:

eaxreverb "loc_streets_alcove_1" {
    density                    0.576
    diffusion                  0.633
    gain                       0.3162
    gainhf                     0.7655
    gainlf                     0.769
    decay_time                 1.79
    decay_hfratio              0.6267
    decay_lfratio              0.4433
    reflections_gain           0.4281
    reflections_delay          0.0167
    reflections_pan            0 0 0
    late_reverb_gain           0.9058
    late_reverb_delay          0.0133
    late_reverb_pan            0 0 0
    echo_time                  0.218
    echo_depth                 0.1
    modulation_time            0.25
    modulation_depth           0
    air_absorption_gainhf      0.9905
    hfreference                10364
    lfreference                192.2
    room_rolloff_factor        0
    decayhf_limit              1
}

where loc_streets_alcove_1 is the name of the atdm:location entity for that location. If you wanted to change such an EFX during play you would need another entry in the file, then refer to it by either changing the name of the location entity (BAD!) or exchanging one for another.

  • Like 1

My missions:           Stand-alone                                                      Duncan Lynch series                              

                                      Down and Out on Newford Road              the Factory Heist

                                                                                                  A House Call

                                                                                                  The House of deLisle                                                                                                  

                              

Link to comment
Share on other sites

  • 2 weeks later...
On 3/19/2023 at 12:55 AM, Frost_Salamander said:

I found that simply updating the ambient spawnargs on the location entity (via a script) worked fine

How did you get this to work? I cannot get the sound to update by scripting this sort of thing:

$location_room1.setSpawnArg( "ambient", "snd_somenewsound" );

if location_room1 is a location_info entity and snd_somenewsound has been defined in the atdm:location_settings entity. It just goes back to playing the original sound when I go back into room1.

  • Like 1

My missions:           Stand-alone                                                      Duncan Lynch series                              

                                      Down and Out on Newford Road              the Factory Heist

                                                                                                  A House Call

                                                                                                  The House of deLisle                                                                                                  

                              

Link to comment
Share on other sites

5 hours ago, thebigh said:

How did you get this to work? I cannot get the sound to update by scripting this sort of thing:

$location_room1.setSpawnArg( "ambient", "snd_somenewsound" );

if location_room1 is a location_info entity and snd_somenewsound has been defined in the atdm:location_settings entity. It just goes back to playing the original sound when I go back into room1.

I used setKey() instead of setSpawnArg(). Not sure what the difference is but it worked.

  • Like 2

TDM Community Github: https://github.com/thedarkmodcommunity

My fan missions: The Hare in the Snare, Part 1

The Lieutenant Series: In Plain Sight  High Expectations Foreign Affairs

Link to comment
Share on other sites

I think setSpawnArg is intended for setting spawnargs on entities that you're going to spawn. You can use it on sys followed by sys.spawn()

  • Like 1
Link to comment
Share on other sites

Yep, that did the trick. Thanks!

  • Like 1

My missions:           Stand-alone                                                      Duncan Lynch series                              

                                      Down and Out on Newford Road              the Factory Heist

                                                                                                  A House Call

                                                                                                  The House of deLisle                                                                                                  

                              

Link to comment
Share on other sites

  • 1 year later...
Posted (edited)
On 3/17/2023 at 11:50 PM, Frost_Salamander said:

Currently if you are implementing EFX in your map, you need to maintain an .efx file: https://wiki.thedarkmod.com/index.php?title=Setting_Reverb_Data_of_Rooms_(EAX)

If you are using presets only, all this is is simply a 1:1 mapping of location entities to an EFX preset.  Doing this in a file is kind of tedious and error-prone, as you have to check each location entity in your map, and then check the file to make sure you got the location entity name correct, or didn't leave one out, etc.

Would it be a worthwhile feature request to be able to just set the EFX preset with a spawnarg on the location entity itself?  Something like:

"efx_preset"    "WOODEN_SMALLROOM"

Also, the location entity has other zone-related information, like ambient sound, ambient light, etc.  It would just make sense to have the EFX here as well.

This would only make sense for the presets, since you just need the preset name.  If you wanted to do anything more complicated, the file could still be used.  If both are used for the preset, one could take precedence over the other (the spawnarg pehaps).

I don't think anything would need to change in DR either, as it's just a new spawnarg on the entity.

 

 

@stgatilov @nbohr1more I'm wondering if it would be possible to get this implemented for 2.13?  I'm really not loving the EFX files - it's way too easy to miss/forget locations and just a general PITA.

I am even considering offering to help implement - any reluctance on my part is purely down to lack of confidence.  But with some hand-holding I could possibly accomplish something that isn't a total disaster.

Maybe an alternative is to have a feature that allows DR to manage the EFX preset in the EFX file?  Basically what I'd like is to be able to manage everything related to a location entity in the one place, preferably in DR.   Not sure if that's ever been considered? @greebo?

Edited by Frost_Salamander
  • Like 1

TDM Community Github: https://github.com/thedarkmodcommunity

My fan missions: The Hare in the Snare, Part 1

The Lieutenant Series: In Plain Sight  High Expectations Foreign Affairs

Link to comment
Share on other sites

23 hours ago, Frost_Salamander said:

@stgatilov @nbohr1more I'm wondering if it would be possible to get this implemented for 2.13?  I'm really not loving the EFX files - it's way too easy to miss/forget locations and just a general PITA.

I am even considering offering to help implement - any reluctance on my part is purely down to lack of confidence.  But with some hand-holding I could possibly accomplish something that isn't a total disaster.

Maybe an alternative is to have a feature that allows DR to manage the EFX preset in the EFX file?  Basically what I'd like is to be able to manage everything related to a location entity in the one place, preferably in DR.   Not sure if that's ever been considered? @greebo?

If you wanna put together a prototype implementation, we could provide assistance. I think it mostly just requires adding EFX parser parts to the entity def parser. The big wrinkle is what to do if a mission has both EFX and Entity Def args?

Please visit TDM's IndieDB site and help promote the mod:

 

http://www.indiedb.com/mods/the-dark-mod

 

(Yeah, shameless promotion... but traffic is traffic folks...)

Link to comment
Share on other sites

On 3/18/2023 at 12:50 AM, Frost_Salamander said:

Doing this in a file is kind of tedious and error-prone, as you have to check each location entity in your map, and then check the file to make sure you got the location entity name correct, or didn't leave one out, etc.

Maybe it's possible to make a script that extracts all the info_locations from the map file and creates an efx file from that in the correct format (run again to update). Then you can simply fill it in. Possibly you could also edit in DR the efx-data as a fake spawnarg for that info_location entity and make the script write that to the efx file.

This might also be possible via a script/plugin inside DR.

image.thumb.png.d0a86cd74f91439fd4af8034a31a0433.png

Edited by datiswous
  • Like 2
Link to comment
Share on other sites

7 minutes ago, datiswous said:

This might also be possible via a script/plugin inside DR.

This should definitely be possible.  The python scripting API has functions to loop through entities and read their spawnargs, and then you could use standard python file functions to write the EFX file.

It would be cool to have a proper EFX editor in DR, but writing a script would be a lot less work.

@Frost_Salamander if you decide to write a script like this I'd be happy to help you out if you get stuck.  You can check out count_loot.py for a minimal example of looping through entities.

 

  • Like 3
Link to comment
Share on other sites

The script might not be too far off what I was thinking anyways, because one of the reasons I wanted to be able to do it in DR is because you could then have a test script like 'Check for missing EFX on info_location entities'.  So maybe we can just have a script called 'generate EFX file' or something like @datiswous is suggesting.

The problem is that if feels a bit like a halfway house instead of a proper implementation.  Also I think we all could probably agree the EFX file will never go away in case people want to do more than just presets, so we would have to support both the info_location method and the file method.

Just thinking out loud here, and good discussion 👍

  • Like 1

TDM Community Github: https://github.com/thedarkmodcommunity

My fan missions: The Hare in the Snare, Part 1

The Lieutenant Series: In Plain Sight  High Expectations Foreign Affairs

Link to comment
Share on other sites

On 5/12/2024 at 1:37 PM, Frost_Salamander said:

I am even considering offering to help implement - any reluctance on my part is purely down to lack of confidence.  But with some hand-holding I could possibly accomplish something that isn't a total disaster.

Do you really want to try? 🤩

I'd suggest looking at idSoundWorldLocal::MixLoopInternal.
That seems to be the only place where effect is found by area index, then by area name, then default.
If you manage to add a member like idSoundWorldLocal::listenerEfxPreset and ensure it is set properly, then you most likely can pass the preset name here (perhaps via something like idEFXFile::FindPreset).

In my opinion, the location spawnarg should get top priority.
If missing or empty, then the ordinary approach with .efx file works.

 

  • Like 1
Link to comment
Share on other sites

5 hours ago, Frost_Salamander said:

Also I think we all could probably agree the EFX file will never go away in case people want to do more than just presets, so we would have to support both the info_location method and the file method.

 

I use custom EFXs heavily, so I for one would not want to be restricted entirely to presets.

My missions:           Stand-alone                                                      Duncan Lynch series                              

                                      Down and Out on Newford Road              the Factory Heist

                                                                                                  A House Call

                                                                                                  The House of deLisle                                                                                                  

                              

Link to comment
Share on other sites

18 hours ago, Frost_Salamander said:

Also I think we all could probably agree the EFX file will never go away in case people want to do more than just presets, so we would have to support both the info_location method and the file method.

It would be nice to be able to create your own EFX presets, this will solve that issue.

https://github.com/kcat/openal-soft/blob/master/include/AL/efx-presets.h lists all the presets. Here they can be seen in the tdm source file. I think these could be read from an external file instead of inside game code? If TDM reads the presets from an external file, anyone could easilly make their own presets by overriding that file and these could be used inside a spawnarg when that gets implemented.

Edited by datiswous
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • Ansome

      Query: when was the last time a zombie in a video game was unnerving or scary to you? I'm chipping away at my anniversary submission and I've been trying to gather opinions on the subject. I'm perfectly capable of lighting them well, changing their sfx, and creating effective ambience, but I'm worried that zombies at their core are just too overdone to be an effective payoff to the tension I'm creating.
      · 3 replies
    • nbohr1more

      The Lieutenant 3 is out! Congrats Frost_Salamander! ( raising awareness )
      · 2 replies
    • OrbWeaver

      Has anyone had any luck with textures from Polyhaven? Their OpenEXR normal maps seem too washed out and give incorrect shading in the engine.
      · 5 replies
    • datiswous

      I tried to upscale the TDM logo video. First try:

      briefing_video.mp4 You can test it ingame by making a copy of the core tdm_gui.mtr and place it in your-tdm-root/materials/ , then edit line 249 of that file into the location where you placed the new briefing.mp4 file.
      What I did was I extracted all the image files, then used Upscayl to upscale the images using General photo (Real-Esrgan) upscale setting and then turn it back into a video.
      I might have to crop it a bit, the logo looks smaller on screen (or maybe it's actually better this way?). My video editor turned it into a 16:9 video, which I think overal looks better than 1:1 video of original.
      · 1 reply
    • nbohr1more

      Trying to be productive on my down-time before Capcom releases Akuma and my son is constantly on my PC playing Street Fighter...
      · 1 reply
×
×
  • Create New...