For the game to feel very high-quality it requires a high-fidelity ambience system, so that it effortlessly creates appealing visuals and soundscapes. The Ambience manager does that.
An ambience can be changed on a Chunk Unit level, or with manually placed volumes. Unlike the old ambience system which can only have one ambience at a time, the new Ambience system has a layer-based approach
The system has 2 separate parts: Visual ambience and Sound ambience:
Handled via Ambience UObjects. It stores information about the HDRI, its brightness and rotation, the fog color, distance and density as well as a post processing layer. Each ambience also has a Priority value as well as a Blending mode [Add, Multiply, Override]
The ambience is situated in a VisualStack. The stack is sorted by the priority, as it works bottom to top in applying the final visuals. For every Ambience layer:
Similar to the implementation in the Source engine, but with way more additions
This system uses a SoundStack system, which applies sounds depending on their Priority and blends all the sounds together. As the stack updates, the volume shift to show the highest priority to be the loudest.
The first layer is a simple 2D texture, which is present everywhere (The room tone). This layer also handles random sounds for variety (Eg: Drone hits, distant weird sounds, etc) and plays them with random panning, volume and at a random interval. This is biome-centric and is defined in the Biome properties, and should represent the biome’s sound ambience if it were devoid of everything.
The second layer is the Blackout layer. It activates during the Blackout and simply adds a priority 1000 sound layer to the stack
The third layer is the Music layer. It plays a track in the back, usually with a low priority. It changes its volume dynamically, with it reacting to the player’s health
The fourth layer is the Soundscape Injectors, which when present in a Zone will add onto the Sound Stack, creating additional soundscape levels. These can have conditional volume, pitch and whatever, as well as conditionally turning off. This is handled via a ISoundscapeInjector interface, which defines what and when sounds are injected into the player’s SoundStack
Soundscape injectors are usually objects (fluorescent lights, air vents, etc) and are Zone-based, however the properties of the Zone itself can affect the soundscape without requiring objects to be present. The zone itself is an injector. It injects new sounds depending on the moisture, wall innard presence (termite crackling) and the danger level of the zone.
Parallel to the sound stack, this system also handles the Reverb on a Zone level. Depending on the volume of the zone the player is currently placed multiplied by the Reverb multiplier (defined per-biome), this system will dynamically apply a needed reverb preset to all sounds in the area.