SoundDoc-Music

Another Incomplete Sound Doc

To put your own music in the game you first have to understand the way the music works.

The music in the game is set up in the mission lua and consists of vehicle music, victory/defeat music, and battle arc music. All music is team specific, meaning each team has it's own set of tracks.

Victory music is the simplest and is triggered by a win or loss. These tracks must be short in length because the game will wait for the music to stop playing before displaying the stats screen (unless this has been fixed).

Vehicle music is music that a player hears when piloting or riding in a vehicle. This if you haven't noticed is the triumphant sounding stuff like you'd hear in the climax of battle.

Battle arc music is what you hear the most of as unit on the ground, and it is controlled by reinforcement count. In the mission lua the music is broken down into start middle and end music based on reinforcement count.

Now for the hardcore technical details.

Remember, the mission lua is run by the game executable, and in the mission lua lvls are loaded which contain assets. These assets take many forms, objects, geometry, texture, config files, and now sound streams. Every lvl is generated by a req of the same name that defines what that lvl contains and every req can include other file types including lvls and other reqs. If you trace the chain it takes you all the way to the raw resources and everything used to configure them. That has never been more important than it is now.

The files involved in sound configuration are:

(x 2 potentially) where era is cw or gcw

mission lua - where the lvls are loaded by the mission

Datamodid\Sound\worlds\modid\modid.req - the main file defining the sound.lvl

Datamodid\Sound\worlds\modid\modidera.req - the req defining the era-specific sub-lvl

Datamodid\Sound\worlds\modid\modidera_music.mus - an intermediate config file

Datamodid\Sound\worlds\modid\modidera_music.stm - a list of the music samples to include

Datamodid\Sound\worlds\modid\modidera_music_config.snd - the primary sound config file

In the mission lua you'll see lines that look like this:

ReadDataFile("dc:sound\\modid.lvl;modidcw"); (I put the dc: in front as a setup since you will need to do the same)

As you know this loads an lvl and a specific sub-lvl. In the shipped game each era has it's own sub-lvl inside a planets main sound.lvl. In the case of planets like geo where there is only one era, only one era is included. What is included is ultimately arbitrary, you can set them up anyway you like as long as you know how to reference them properly, which is what we will go through now. The above line tells the game to load whatever was defined in geo's sound geo.req. In geo's sound req it then referenced another req, geocw.req. Take a look at them both to familiarize yourself.

I'll start with modid.req, which should contain two sections like this:

ucft

{

REQN

{

"str"

"align=2048"

"your music.stm file name for each era goes here ex: modidera_music.stm = modidera_music"

}

REQN

{

"lvl"

"your era specific sound req file names go here ex: modidgcw.req = modidgcw"

}

}

The first section references streams, as contained in stm files. The second section references sub-lvls that are specific to each era. The streams are not included in the sub-lvls because sub-lvls are a means to manage memory, loading only assets needed into memory. Sound streams are streamed dynamically from the hard drive and do not take up memory. Only sound effects take up memory, sound effects being listed in the sfx and asfx files.

If you look at the stm files they contain a relative file path, and in most cases an alias. This alias is just a short name that when called uses the sample specified. The contents look like this:

// ----- Ambient Bleed Music -----------

Streams\rep_geo_amb_start.wav rep_geo_amb_start

Streams\rep_geo_amb_middle.wav rep_geo_amb_middle

Streams\geopubambmid2.wav rep_geo_amb_middle02

Streams\rep_geo_amb_end.wav rep_geo_amb_end

Streams\cis_geo_amb_start.wav cis_geo_amb_start

Streams\cis_geo_amb_middle.wav cis_geo_amb_middle

Streams\geocisambmid2.wav cis_geo_amb_middle02

Streams\cis_geo_amb_end.wav cis_geo_amb_end

// ----- Ambient Vehicle Music ----------

..\nab\Streams\rep_nab1_amb_veh01.wav rep_geo_amb_veh01

..\nab\Streams\rep_nab1_amb_veh02.wav rep_geo_amb_veh02

..\nab\Streams\rep_nab1_amb_veh03.wav rep_geo_amb_veh03

..\nab\Streams\cis_nab1_amb_veh01.wav cis_geo_amb_veh01

..\nab\Streams\cis_nab1_amb_veh02.wav cis_geo_amb_veh02

..\nab\Streams\cis_nab1_amb_veh03.wav cis_geo_amb_veh03

// ----- Win - Lose Music ----------

..\nab\Streams\rep_nab1_amb_victory.wav rep_geo_amb_victory

..\nab\Streams\rep_nab1_amb_defeat.wav rep_geo_amb_defeat

..\nab\Streams\cis_nab2_amb_victory.wav cis_geo_amb_victory

..\nab\Streams\cis_nab2_amb_defeat01.wav cis_geo_amb_defeat01

Mostly self explanatory if you understand that each peice of music is actually a collection of tracks that are randomized to play at varying intervals. Don't worry, we'll get to that, all you need to know is the simplest thing to do is copy a file like I did above and just change the paths to point to your own sound samples. Leave the aliases intact. Pretty simple so far, but it's getting more complicated.

Now that you know how the actual sound files are loaded into an lvl, you need to know how their properties are configured. That's where the contents of the sub-lvls come in.

In the modidera.req you'll also have two sections:

ucft

{

REQN

{

"bnk"

"align=2048"

}

REQN

{

"config"

"put the music config file name here ex" modidera_music_config"

}

}

BNK refers to sound banks and contains the filenames of sfx and asfx files, so disregard that here. The config section references all snd files, and for music that means it needs to include the modidera_music_config.snd.