PILLS OF INSIGHT
A modest blog about my journey in the games industry
Middleware and the man in the middle
INSPIRATION IV - Prologue makes use of FMOD for its dynamic music. However, it doesn't rely entirely on this middleware. Instead, I opted to make a system on Unreal Engine that acted as an interface between UE and FMOD.
The main reason to do this approach was because we needed a very granular control of the tracks volumes. In a nutshell, the music is constantly making a lot of subtle changes that depends on, for instance, player's orientation.
But before we get into technical details, I'll give a brief explanation on the rules the music follows.
The music being used in INSPIRATION IV is composed by five tracks and some of them are associated to specific elements of the game:
- Bass - Associated to Jupiter
- Synth - Associated to intriguing moments
- Strings - Associated to making progress
Moreover, there are 6 intensity presets (from -1 to 4), which were used to increase or decrease the tracks volumes, useful to have a general control on what the player should be listening. I won't list their exact values here, but it's pretty straightforward, each intensity plays more tracks than the prior one and it sometimes decreases the volume of other tracks.
On top of that, some of the tracks varies their values based on the player's behavior, being the following:
- Bass. It varies depending on how much Jupiter covers the screen. To
make it subtle, its volume varies between 100% and 70% and the decrease occurs
slower than the increase.
The idea behind this is to give the sense of greatness.
- Synth When approaching the places of interest designated in the level, the
Synth's volume starts being controlled by a function that increases its volume by 20% when the
player is facing to where the place of interest is.
This change is less subtle than the Bass because we wanted the players to notice it more easily.
Having these rules on the table, the only thing left to be able to develop this middle-middleware is to know how the tracks change their volume
The track manager follows these simple rules:
- For each track, there is a variable called Watcher, which watches FMOD and copy its parameters, for interpolating the desired values later on.
- As a rule of thumb, the intensity can change every 4 beats.
- In case of receiving a request of setting the intensity to 3 or 4, it will change at the end of a 4/4.
- It's possible to force the change to occur at the end of a 4/4.
- These rules can be overridden by a flag.
- It's possible to ignore the intensity presets and create an specific volume set at runtime.
- It is possible to remove the Jupiter volume control from the Bass track.
- When changing volumes, they interpolate over the course of 4 beats.
- It's possible to change volumes without interpolating for 4 beats.
These rules form the flow chart shown below, which is pretty straightforward.
Now, the system is complete. It's just a matter of placing triggers on the level to have the dynamic music up and running.
Here is a map containing the music behavior throughout the whole demo.