Borderlands: Music and Level Streaming - Part 1

Importing Custom Music and Creating a Cooked Package

This tutorial assumes a minor-moderate functional use of the editor and tools and does not cover tasks not specifically related to the subject.

What is a "cooked package" and why should I care?
A "cooked package" is in reference to a content package for an Unreal Engine 3 title that has been finalized, compressed, and ready for distribution. When cooking, a new package a created containing only the data that is being used (reduces filesize by omitting any never used assets), compressed using file compression (further reducing filesize), and then locked so that it cannot be modified. The resulting package is far smaller in size than the original making not only distribution easier but decreasing the memory footprint when loading that package in the game.

You can't cook in Borderlands.
No, you can't. To make matters worse the SoundCue browser is not functional in Borderlands either. This doesn't mean creating cooked packages for Borderlands is impossible though. All that is necessary is a functional editor that can create cooked packages using a package version Borderlands can recognize. Given the amount of Unreal Engine 3 games that ship with a functional editor is one, it's pretty clear what direction we're heading. Granted there's also UDK, I personally can't comment on it's abilities to serve our purpose here (have not tested it). It might work, it might not but in either case it will involve more work just to set up a project in order to start cooking files opposed to diving right in with the tools from Unreal Tournament 3.

Getting Started

You have your audio, I hope. We're going to need that. Standard 44/16 redbook audio is fine if not mandatory. Loops should be looping and single shots should be well, not looping. Pay mind to all the normal content importing rules; no spaces or non-alphanumeric characters in the file name or import path. Underscores are fine but not dashes. Oh, and you'll need Unreal Tournament 3 too. So fire that bad boy up. The editor, that is.

What we're going to be doing here isn't much different than importing music for Unreal Tournament 3 and all the details can be found in that tutorial . Just so we're clear on this, I really think you should take a look . It's long but any questions you may have on specifics are more than likely to be covered there. Import the audio, create groups if you want to keep things tidy. Set the compression and create SoundCues and batch process those to Music. Make sure to add looping nodes for anything that should be looping. The only things in this package should be the actual audio (wavs) and SoundCues for each. Nothing else. This is where things get different.

The average music playback volume (values used to determine volume playback) is a lot lower in Borderlands than it is in Unreal Tournament 3, largely because music in UT3 is ducked, where in Borderlands it isn't (or at least not as severely). If you were to use typical values found in UT3 for your Borderlands package the music would not only overpower everything else but likely be so loud as to cause digital clipping. Volume settings in Borderlands for typical combat music range 0.45 - 0.55 with ambient falling as low as 0.40 in some cases. A good place to start is with your loudest combat song. Right click on that SoundCue and select Properties. Next to VolumeMultiplier, let's enter a value from 0.50 to 0.55. Then while playing this SoundCue as a baseline example, compare and adjust the other cues in the same manner to appropriate volumes. Once that's done, save the package.

Bring To A Boil

Now our music package is done but we still need a way to cook it that won't break Borderlands. This is done by creating a surrogate package that will be used to cook our music package. In the Generic Browser, right-click and select UTMapMusic. It doesn't matter what you call it, just create it in a new package. Once that has been done, navigate to this new package, right-click on the UTMapMusic and select properties. In this window expand as many sections under MapMusic and MapStingers as you have SoundCues in your music package. Leaving the properties window open, navigate to your music package in the Generic Browser. Click on each of your SoundCues and add them to the UTMapMusic by clicking on the green left arrow in the Properties window one at a time. The order or what you're adding them to doesn't matter, only that you're adding everything you want cooked. Once this is done you can save the UTMapMusic package.

Your music is ready, the surrogate is ready, now we just need to cook. Open a map, any map (personally I like smaller ones since they load faster). When that map has loaded open the WorldProperties from the file menu. Expand WorldInfo, then UTMapInfo. Below that there will be a line for MapMusicInfo. Select your UTMapMusic from your surrogate package and then click the green left arrow next toMapMusicInfo to add it to the map. Now save the map under a new filename and press the cook (flame) button. The cooker should skip the map (if it's a cooked map) but in the process will produce cooked packages for your music and surrogate. Delete the cooked and uncooked surrogate and the renamed map if you like and then move your cooked music package over to the Borderlands mod folder (\My Documents\My Games\Borderlands\WillowGame\Unpublished\CookedPC). It's time to turn your cooked UT3 package into a cooked Borderlands package.

Serve Hot

Start BLEd (or "Borderlands Editor" if you're uncool like the rest of us) and open your cooked music package in the Generic Browser. The first thing you'll notice (or not) is that Borderlands marks you cooked package as modified as denoted by the asterix next to the package name. Technically you might be able to use this package as it is but this is unsafe, especially in coop. If the game is modifying the file every time it is loaded this would lead to version mismatches between players.
Funny story, remember when I said cooked packages were finalized and locked , preventing any further modification?
I lied.

The reason Borderlands can even open a cooked UT3 package is because it doesn't have anything weird in it that Borderlands doesn't understand. Borderlands though, does put stuff in its packages and that is exactly what is taking place right now and why it says the package is modified. Borderlands is adding properties that do not exist in UT3 to your package. We don't care though, these are default values that are of no consequence, however we need to stop it from being modified each time it's loaded by saving it in the state it is now. Click on the Log tab in the generic browser and in the text field near the bottom type,

obj savepackage file=somefile package=yourmusicpackage

and hit enter. It may pause for a second but if correct you will receive no message. To elaborate, say the music package was named Music_Awesome.upk, it would look like this

obj savepackage file=somefile package=Music_Awesome.upk

"somefile" is just a temp/garbage name. Any name that doesn't exist as an actual package will do. The purpose this serves is to "unlock" our cooked music package. After this command has been entered you should now be able to save you package. Afterwards if you're thorough, restart BLEd and reload your music package to make sure it is no longer being flagged as modified. You should now have a cooked Borderlands package.
Now that we're done here, how about adding that to a map next?