Composing adapting music is something functional. Adaptive music appears as a necessity for your videogame, and you have to be sure about using it. I'll talk about some points you'll have to take into account for writing adaptive music.
Write your music as linear as the game is
There are games that have some scenarios or levels, but these scenarios don't change at all, or there is no narrative during the gameplay, for instance: Mario Bros, Braid and other platform video games; Fighting games like Street Fighter, Streets of Rage; Need for Speed or Grand Turismo sport games... They may have a story being told during all the game: Ryu and Ken have some friendship, Mario has to save a princess, but all these things don't appear during your gameplay, so there is no need for the music to excel any of these concepts. This is why most of these games have a linear music on it, because it really works. They give you a melody or an ambient that puts you into the game, but they let the action be the main source of attention to the player. You focus on the action, not on some in-game narrative that doesn't exist.
Main Example - Street Fighter V: They made a lot of versions of Street Fighter, and also in the last sequel of this saga music is linear because it works. They only change music in the beginning (there's some kind of intro before starting the battle) and in the end (when some player wins). We will name these as events.
Analyzing ingame events
Even if our game were the most linear game ever, we always want to have some dynamic part to break the monotony, and to mark some important things in the game. So we have this main video game concept called event. When you win, die, pick an item or kill a monster, music has to mark those events. To do this, we use the term stinger as a short phrase of music that helps marking an action. This allows us to reinforce some events, not only with SFX, but music.
Main example - Shadow of the Colossus: This is a typical stinger, on Shadow of the Colossus, when you open a new door, or discover some unseen secret, you get a short piece of music of 5 or 10 seconds to mark that event (minute 0:50).
The game is a state-changing action
Here we will add some dynamism to the game, because we add states. Not only a simple scenario with some events, but a complete set of states in which our main character feels different emotions or takes different actions.
Main Example - Final Fantasy IX: A well-known and classic two state games are RPG games like Final Fantasy. We have two linear music states: One when the story goes on, with a peaceful or melodic music related to the current scenario, and the other when a battle starts, turning on to a prog-rock riff with a lot of action. Sometimes these two events can merge in a single state, when the action continues outside the battles (because you're running out from a castle that is burning, for instance).
We have some states so we don't want to change between them drastically, we need some element to put them together. This element is called transition. We've just watched it on this video from FFIX, when the battle starts.
We want it to be as much adaptive as possible
Because games really need it. We have a lot of states, different moods, lots of actions coming in-game, so we need that our music goes up and down, backward and forward to emphasize that the action is continuously moving on. How can we achieve this?
Imagine that you have a lot of states in a single scenario, so you have a continuous music but you want this music to change for providing you with multiple structures and feel more interesting. It's like having a CD playing a track and you decide that the music will go to a point or another of the track when an event happens, or maybe only to play it differently, by using transitions between them. With this technique, you can make multiple combinations for putting your track in order and to obtain a new dynamic music every time you play.
For instance, your song has the structure: ABCDE, so the horizontal resequencing algorithm will give you more combinations: ABECD, ABDEC... And also, repetitions: AAADDDBCE, EEAABBCC... and so on.
This is almost totally related to the game action. Vertical layering offers you the possibility to mix layers of music on real-time. Imagine you're on a battle, and you know you're in danger, so we'll have basic percussion and bass creating some tension for the moment. When an enemy appears, the music doesn't stop, but adds some synth and violins to the track. And finally, when the big boss breaks on, choirs and metals are added to power the tension of the battle. It's like having a live technician mixing your music, depending on what happens in the game.
Mixing it all together like a cake
So finally we have the tools and we will compose a powerful track for our level. We have to mix the ingredients:
- Main melody and chords as the main theme of this scenario (linear material)
- Stingers related to the events (concrete actions)
- Identify the states of the game, and develop one or more tracks to all of them.
- Transitions (butter), to smooth music changes.
- Horizontal resequencing to diversify your track, and also the game ambient.
- Vertical layering to improve the action, more or less tension on the same track.
Main Example - Infamous 2: It mixes some string-percussion loops using horizontal resequencing. Themes appear and disappear during the song, and the game also uses vertical-layering depending on your level of energy or proximity to the enemies. The result is a percussion-ambient state music where you don't remember if you listened to that track before, so it totally avoids the sense of repetition.
All these concepts can be implemented by programming your own audio engine in your game, and by letting programmers know which parameters you will ask for to adapt your music. But there are some middlewares that help you to achieve this task, as a composer and as a programmer:
Just check out this tools and read tutorials about them, try to experiment with these techniques.
Now we have the tools to decide how many levels of in-game adaptation we want for our music, but as we use them, we always have to ask ourselves why we should use those tools and in which moments. It's important to get a good soundtrack for your game, with variations, multiple layers, but without intensifying actions the game doesn't have. Just let the game tell you how adaptive your music has to be.