A quick overview of the audio code in Kentucky Route Zero.

The AudioManager


The Kentucky Route Zero code makes use of a pretty simple pattern in which there are a handful of unique components called "managers," which are responsible for orchestrating the interactions of other objects within a certain domain. So one example is the StageManager which controls what overall "state" the game is in, for example "dialog," "exploring," or "paused." A game component like, for example, the bit of code that watches where the player clicks and tells Conway to move to that location, can register itself with the StageManager and receive updates when the state changes so that it knows whether Conway should be walking around or not. He shouldn't be walking around during dialog, for example.


This last week or two, while Tamas continues to crank away on this cavernous landscape he's building, I've been working on a component called the AudioManager, which handles musical and sound effects cues.
Any given area in KRZ has three different musical layers: the band, the score and what we call the "drone." The band is the bluegrass trio who appear around the map & also function as waypoints within an area for quick travel (once discovered). Their music is only audible when they're pretty near by, and fades in as Conway approaches. The score is the electronic music pieces Ben Babbitt composed for the game. These pieces are usually triggered by entering specific areas in the environment, but sometimes just loop continuously. The "drone" is really just parts of the score slowed down and looped -- it's often barely audible and serves as background music when exploring.


So in addition to these three musical channels, there are an arbitrary number of environmental audio elements, eerie mood-setting tones, and so on, in addition to very localized sound elements like Conway's idling truck. The AudioManager lets all of these elements register themselves as belonging to a named "audio layer" such as "band," "drone," "machinery," "rain," etc. Then, path triggers and other game elements can ask the AudioManager to temporarily silence one of these layers, fade them in or out, etc. This way we have a lot of expressive possibilities for sound design, without having to worry about so many sound sources becoming unmanageable when we want to easily swell the music, mute the rain, etc.

More soon!
jake+tamas