[MOD] Better Ambience

A curated forum for compatible and maintained mods. Users are unable to create new topics in this forum but can reply to existing topics. Please message a moderator to have your mod moved into this forum area.
Post Reply
User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: [MOD] Better Ambience

Post by Ralzar »

You know what. I'll just leave it like that.

User avatar
joshcamas
Posts: 87
Joined: Mon Sep 21, 2020 7:01 am

Re: [MOD] Better Ambience

Post by joshcamas »

Ralzar wrote: Thu Oct 01, 2020 5:13 pm Hey, so I've been using this mod for a bit now and I generally love it. However, the dog effect seems to make the dungeon too bright?
It works fine at standard light setting, but I usually set dungeon light to 0.2. With your mod a lot of places far away get much lighter. I sort of figured fog in the dungeon would make it harder to navigate, not easier? :D
This is probably due to the fact that fog is additive, and thus brightens things up if the random fog has too high values. I'll fix this by making fog colors stick to the darker end. I can also put in a setting that lets the user tweak how dark the fog is.

I'm also thinking about making fog disabled by default, since several people have complained about it xD It's a cool feature but it's the most radical change the mod brings, and I feel like an ambience mod shouldn't be too radical.

User avatar
joshcamas
Posts: 87
Joined: Mon Sep 21, 2020 7:01 am

Re: [MOD] Better Ambience

Post by joshcamas »

One feature I'm currently working on is a "Extendable Ambient System". Basically, I'm going to replace the built in ambience system with my own, which will allow for much more complex soundscapes:
- Layers
- Loops
- One-Offs (With defined rarity)

And most importantly, it'll be extendable, allowing users to add their own ambiences. This is going to take a bit, so stay tuned :))

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: [MOD] Better Ambience

Post by Ralzar »

That sounds really cool. Long term I might hook Climates & Calories into that.

User avatar
Ralzar
Posts: 2211
Joined: Mon Oct 07, 2019 4:11 pm
Location: Norway

Re: [MOD] Better Ambience

Post by Ralzar »

Btw, a thing that's bothered me about the weather since I started making C&C:

Raining and Storming is almost indistinguishable. Storming plays a thunder clap once in a while, but other than that I notice no difference.
If you haven't looked at it, you could consider making Storming more, well, stormy :D

User avatar
Azteca
Posts: 143
Joined: Tue Mar 26, 2019 12:38 am

Re: [MOD] Better Ambience

Post by Azteca »

joshcamas wrote: Thu Oct 01, 2020 7:55 pm One feature I'm currently working on is a "Extendable Ambient System". Basically, I'm going to replace the built in ambience system with my own, which will allow for much more complex soundscapes:
- Layers
- Loops
- One-Offs (With defined rarity)

And most importantly, it'll be extendable, allowing users to add their own ambiences. This is going to take a bit, so stay tuned :))
That sounds great. One thing that halted my progress working on sounds was knowing that all I could do was replace the classic sounds that people have burned into their brains. They're hard to compete with. Expanding the whole system is really enticing. Why not 6 different foot-steps that cycle, way more water sounds, bird sounds, etc.

User avatar
joshcamas
Posts: 87
Joined: Mon Sep 21, 2020 7:01 am

Re: [MOD] Better Ambience

Post by joshcamas »

Right, it's really exciting. I wish DFU's sound system supported sound lists, as opposed to a single sound per... sound. Instead, the extendable sound system has to be kept separate from builtin sound system, and thus is pretty limited on how it can be used. In our case, footsteps (since the mod already has its own footstep sound manager) and the ambience system.

It would be REALLY cool if daggerfall core could be redesigned for random sound selection when it wants to play a certain sound. Here is an idea that could *possibly* work: When a sound clip is requested from the database with an ID, look for a folder with that name. If it exists, grab a random file and return it. This would only work if the sound clip is requested every time it wants to play. (IE every time an audio clip is desired to play, using dfAudioSource.GetAudioClip). IF this is the case, then the only change (in theory!!!!) that would need to be introduced is the sound loader function (TryImportAudioClip). I'll look into this to see if this is reasonable. It MAY be possible to introduce this change with very little affect on the code, which would be really cool.

EDIT: Luckily dfAudioSource.PlayOneShot is used a lot, which would support the above idea. So far I've only been able to find one class that actually caches an Audioclip, EnemySounds. Which would be a effortless fix that wouldn't break anything. If the devs wouldn't want me to mess with anything but the single sound load function, this idea would still work - it just wouldn't work on every single sound in the game. Better than nothing, by a huge margin! So far so good!

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: [MOD] Better Ambience

Post by TheLacus »

That would give you the ability to get a random effect within a list instead of a specific one. No doubt the next step would be to request more control over which sound is played, so i don't think this is the best solution in the long term. I believe what you would need is the ability to extend AmbientEffectsPlayer class and register your own handler of ambient effects, much like we are already doing in several other places (UI, npcs, ...) That would be the most elegant and future-proof solution. :)

User avatar
joshcamas
Posts: 87
Joined: Mon Sep 21, 2020 7:01 am

Re: [MOD] Better Ambience

Post by joshcamas »

TheLacus wrote: Thu Oct 01, 2020 11:45 pm That would give you the ability to get a random effect within a list instead of a specific one. No doubt the next step would be to request more control over which sound is played, so i don't think this is the best solution in the long term. I believe what you would need is the ability to extend AmbientEffectsPlayer class and register your own handler of ambient effects, much like we are already doing in several other places (UI, npcs, ...) That would be the most elegant and future-proof solution. :)
An additional feature could be able to instead register a function to override what sound is being played. This could be extended to instead register an object which contains an importance value (higher importance gets checked first in the stack), a function that returns whether this sound will be overriden by this object, then the function that actually returns the sound.

By default, a "RandomSoundRequestOverride" can sit at the bottom of the stack. Its importance is 0, it always returns true in OverrideSound, and it returns a random sound in the folder if it exists, otherwise returning the default sound. Or this stuff can be hardcoded. Doesn't really matter.

Code: Select all


abstract class SoundRequestOverride
{
    public int importance;
    public bool OverrideSound(SoundClips clip);
    public AudioClip GetSound(SoundClips clip);
}

....

List<SoundRequestOverride> soundOverrides;

....

void AddSoundRequestOverride(SoundRequestOverride override)
{
    soundOverrides.Add(override);
    SortOverridesByImportance();
}

AudioClip GetSound(SoundClips clip)
{
    foreach(var override in soundOverrides)
    {
        if(override.OverrideSound(clip))
            return override.GetSound(clip);
    }
    
    return _GetSoundDefault(clip);
}

This allows for any mod to inject sounds depending on... whatever logic they desire. Note this is designed for general stuff, not specifically ambience. Ambience will probably have its own system, like you mentioned

User avatar
TheLacus
Posts: 1305
Joined: Wed Sep 14, 2016 6:22 pm

Re: [MOD] Better Ambience

Post by TheLacus »

The ourpose of TryImportAudioClip is to load an asset with the requested name and this should be and simple as performant as possible. I don't think is a good idea to introduce custom logic inside a core method.

If you want to alter which sound is played or when or where is played, the best option is to create a custom player behaviour. This can works in parallel to default one or replace it using an interface or inheriting from it, much like UI overrides.

Post Reply