L4D Campaign Add-on Tutorial
There are four basic steps to creating your own custom campaign Add-ons for Left 4 Dead:
- Make an Add-on folder and content sub-folders.
- Create game assets and place them in the proper sub-folder.
- Create metadata files and place them in the proper sub-folder.
- Pack the contents of the Add-on folder into a .VPK file.
- Create a homepage for the add-on where it can be downloaded by players.
Install the Left 4 Dead Authoring Tools
In order to author content for Left 4 Dead, you will need to install the Left 4 Dead Authoring Tools. This provides you with the applications and utilities you will need to create game content. Mainly, you will be using the Hammer application to create levels, and the other utilities to create custom textures and models.
A description of how to create these assets is beyond the scope of this tutorial, but you can find useful information in the L4D Level Design Basics Tutorial. Because the focus of this article is how to assemble the assets into a campaign Add-on, we will assume that you have already learned how to successfully create these assets from this point forward.
The Authoring Tools provides an example Add-on campaign called Dead Line that has source examples.
Create an Add-on folder
To begin, navigate to the "addons" folder of your Left 4 Dead game install location. For most users, this will be similar to:
C:\Program Files\Steam\steamapps\common\left 4 dead\left4dead\addons
Make a new folder inside the addons directory, and give it an appropriate name. This new folder will be the name of the .VPK file you'll ultimately create and distribute, so it's good practice to avoid spaces and use all lowercase letters. You may also include the game in the title, to differentiate it from add-ons for other titles. We'll use "deadline" instead of "l4d_deadline" for our example for the sake of readability.
C:\Program Files\Steam\steamapps\common\left 4 dead\left4dead\addons\deadline
Conceptually, this add-on folder will serve as the base “game” folder for your assets, and will mirror the layout in the shipped .VPK files as we shall see below.
Create primary game assets
The assets you create will essentially append those shipped with the game. For a campaign, the primary assets are the .BSP and .NAV files for your map levels.
Make a folder called '
maps' inside your add-on project folder:
C:\Program Files\Steam\steamapps\common\left 4 dead\left4dead\addons\deadline\maps
Into this maps folder, copy the .BSP and .NAV files you're using for your maps. For this Dead Line tutorial example, there are three map file bsp.nav pairs:
||Minimal starting map for co-op|
||Final map for co-op, survival|
||A variation of the above map that includes modifications designed for with versus mode|
The advantage of having a single map function for multiple game modes is size reduction, which can be worth the additional authoring complexity.
You may also optionally create custom .VTF texture images, custom .VMT material description files, and custom .MDL models which your maps can utilize. In order to keep the size of your add-on small, it's advisable to use as many textures and models from the game as possible.
Additional .VMT and .VTF materials for maps should go under this folder
C:\Program Files\Steam\steamapps\common\left 4 dead\left4dead\addons\deadline\materials
.MDL and related models files should go under here:
C:\Program Files\Steam\steamapps\common\left 4 dead\left4dead\addons\deadline\models
And materials for your models should go under here:
C:\Program Files\Steam\steamapps\common\left 4 dead\left4dead\addons\deadline\materials\models
Create secondary game assets
Secondary assets such as poster and thumbnail images are not strictly required, but they can give your campaigns an extra level of polish. (Besides, the poster/concept art was likely the first thing you created, wasn't it?) If you haven't already, go ahead and make a
materials folder and a
vgui folder inside of it:
C:\Program Files\Steam\steamapps\common\left 4 dead\left4dead\addons\deadline\materials\vgui
Inside the vgui folder you'll want to place at least two .VTF files, along with .VMTs that reference them:
- This is a poster image that is displayed while your campaign loads. Standard size is 1024 x 1024 pixels with an alpha channel for transparency.
- This is a title image that appears behind the end credits/stats. Standard size is 1024 x 256 pixels. Your design should look good against a black background and also allow white text in the foreground to be readable.
Map Thumbnail Previews
In addition to these two, you'll also want to make thumbnail images for each map in your campaign. These serve to provide a visual reinforcement indication for users while they're selecting map "chapters" in the UI.
To do so, create a new folder named '
maps' under the vgui folder:
C:\Program Files\Steam\steamapps\common\left 4 dead\left4dead\addons\deadline\materials\vgui\maps
In this folder, you'll want to create a .VTF/.VMT pair for each map you wish to create. They should each be 256 by 128 pixels. If appropriate, you may use a single thumbnail image to represent multiple .BSP maps, such as when you have a versus or survival variant of the same level.
Create metadata files
There are a few more files that you will make in order to allow your add-on content to function in game. The first is the addoninfo.txt file. This should go inside your add-on root folder, which was the first one we created way back at the top:
C:\Program Files\Steam\steamapps\common\left 4 dead\left4dead\addons\deadline
This file is used by the game in the Extras->Add-ons screen. It describes your add-on in general and what it provides. The example Deadline AddonInfo Full includes full comments and instructions for using it as a template for your own add-on. Another optional file you can create in the root folder is an image named addonimage.vtf. This serves as an icon to help differentiate your add-on. No .VMT is required in this case.
The second required file is the mission file. This describes the structure and content of your campaign and is used by the campaign selection UI, matchmaking, and the game server. This can be a .TXT file of any name in the '
missions' folder, which you will need to make:
C:\Program Files\Steam\steamapps\common\left 4 dead\left4dead\addons\deadline\missions
The example Deadline Mission File includes full comments and instructions for using it as a template for your own mission.
Test it out
At this point, your add-on should be fully functional. You should be able to launch the game, go to Extras->Add-ons, and enable your add-on. If you type
path into the console, you should see the root directory of your add-on near the bottom. This means that the game will search your add-on folder for files that it cannot find in the standard game .VPK files. You can continue tweaking your content in folder form until you're ready for that magical moment: Release into the wild.
Packaging and shipping
The final remaining step is to package your add-on into a .VPK for distribution.
The .VPK serves as a convenient, one file method for others to install your add-on folder. They need simply put the .VPK in their own add-on folder. Or, assuming they, like most non-authoring players, haven't associated the .VPK extension with something else, they can double click on it and it will install itself in the correct place.
Every .VPK file contains a unique ID that allows the game to ensure everyone is running the same content. If you've put in meta-data properly, the game will also prompt users to download a newer version if it is required to play.
Navigate to this folder:
C:\Program Files\Steam\steamapps\common\left 4 dead\bin
vpk.exe packaging utility and make a shortcut to it on your desktop. Drag your add-on root folder and drop it onto the shortcut. The utility should make a new .VPK next to your original folder. By default it will not include source files such as .VMF, .TGA, .SMD, .QC etc., and it will always strip out executable binaries. Remove the folder version of the add-on (or move it to a safe location) so that the .VPK is alone and test it out. The .VPK should function exactly as the add-on folder does. If it works, you're ready to upload it to a location you specified in the metadata files and from which it is available.
A minimal example can be found here: http://media.steampowered.com/apps/513/deadline.html
Ideally, you'll want an add-on "homepage" that includes ratings, screenshots, and player comments.
At this point, you should test out the download prompt. Start a lobby with a local server, and invite a friend to join. When they accept, they should be prompted to download the neccesary add-on, after which a browser window will opened to your add-on homepage. They should be able to download and install the add-on without having to restart the game, and then join your lobby.