One thing that needed doing was to add some dynamism to the music. For most of the project, the only ways to do music or mood drone type sounds was either as a per-level looping music file, or as a location-specific sound effect.
Obviously the problem with either approach is that specifying a piece of music with a certain theme to it could mismatch with the action or lack thereof on-screen.
My first approach was to track the 'tension' of the current scenario, as measured by the total damage taken and given by the character. This worked ok in most cases, but failed to kick in when the player was taking fire, but not being hit yet, and kicked in even when two NPCs were fighting, possibly across the level.
I needed something that was more localized. I remembered that I already had a sound notification system in place to allow the AI to hear sounds. Each sound has an 'alert level' associated with it that will cause the sound to propagate a certain amount of alertness to nearby creatures, possibly waking them up to investigate. Footsteps have a low alertness value, whereas gunplay and pain sounds have higher ones.
That turned out much better, and is the current approach. Anytime one of these alert sounds goes off near the player, a counter of 'milliseconds of tense music' value gets incremented. When it reaches above a certain value, the default calm music fades out, and the tense one is faded in. Only when the tension drops all the way to zero does a transition back to calm take place.
I also added a dripping water particle system with sounds, some useful semi-scripting commands to the trigger system, like random execution, sequence execution, and simple conditionals. In the end, every script-like system wants to turn into a full-blown script system, just like, in the limit, every program turns into its own operating system...
Here is a recent shot of an updated portion of the first digsite level :