Final Major Project - Music
Updated: Apr 29, 2021
I love music in games, the majority of music I listen to in my free time is music from my favourite videogame soundtracks, Dragon Age, Witcher 3, Thronebreaker, Mass Effect, Cyberpunk 2077, Skyrim, I love all of it. So, when it came to implementing music in my FMP project, I wanted to do it with care and quality, since I am keenly aware of how much a good music track can add to the atmosphere of a game.
One feature I knew I wanted the music to have was for it to be adaptive, this is a feature seen in almost all games where the music smoothly transitions between combat and non-combat music. I already had good idea of how to implement this and it wasn't particularly challenging to get it working in its basic form. I created an empty game object and place on it two audio source components and put the combat and non-combat music into them and set them to loop, play on awake and set the volume to zero. I then created an 'Adaptive Music' script to put on it that just linearly interpolated the volume values of the audio sources in and out on function calls. These functions were then called by the Combat Zone objects that detect when the player is in and out of combat. The audio sources are set to always be playing so that when they are switched to, they start at a seeming random point and the player isn't stuck listening to the opening of a track over and over every time they enter combat.
In addition to the combat and non-combat tracks I also wanted to employ specific tracks at certain moments in the story to better suit the atmosphere. For example, there is a moment in the story where even though the player is not in combat, combat is looming and imminent and they know it's coming so the slow and suspenseful non-combat music that suits the investigative opening of the game does not suit here and so instead I have made it so that a piece of percussion music plays the ramps up the tension and amps the play up for the fight to come. Adding these additional tracks was simple matter of adding more audio sources and clips that would be faded in on function call.
The fantastic music I am using I managed to source come from a humble bundle that I purchased that included dozens of tracks by Andrey Sitkov and I sourced one track that I plan to use in the main menu from Free Stock Music by Alexander Nakarada. The adaptive music can be seen in action in the video posted displaying combat, I will also put the video in this post for ease of access.