How to pack your Mission
This article describes how to pack The Dark Mod missions into so-called PK4 files for release.
Mission PK4s
Each TDM mission must be packaged in a PK4 file (a PK4 is just a renamed ZIP archive). The PK4 contains all the files needed to run the mission, including map, cm, aas, proc files, textures, models, scripts, defs, xdata, etc. The contents of the PK4 resemble the folder structure as found in the main darkmod/ directory: textures go into textures/, .def files go to def/ and so on.
At the very minimum, a PK4 archive needs to contain the compiled map and two text files:
maps/outpost.map maps/outpost.proc maps/outpost.cm maps/outpost.aas32 darkmod.txt startingmap.txt
Easy to see, the above example list of files is based on a mission called outpost. The two text files are needed to display your mission in the "New Mission" dialog in TDM's main menu. See their description below.
darkmod.txt
The darkmod.txt file describes your mission in the TDM's mission selection dialog:
Title: The Outpost Description: Break into a builder outpost to retrieve a gold ingot. Author: angua & greebo
The description text mustn't be too long, be sure to check the length of the texts when testing the package in the mission installation dialog.
Starting with release TDM 1.01 it will be possible for missions to specify a "required version", so that missions which are built upon undead (for example) can specify in their darkmod.txt that it needs TDM 1.01 and upwards to run. If the mission installer encounters a version mismatch, a notification appears and TDM will refuse to install it.
You can specify another line after Author:
Title: The Undead Outpost Description: Break into a builder outpost to retrieve a gold ingot. Author: angua & greebo Required TDM Version: 1.01
The "Required TDM Version" string is optional, so existing missions still work of course.
startingmap.txt
This file holds the name of the first mission to load when the player selects "Start Mission". This is interesting for multi-map campaigns, but for a single-map mission just put the name of your map file in here:
outpost
Before creating the PK4
You should always perform a full recompile of your map. Delete the .proc, .cm and .aas* files and run a dmap command from TDM console. Make sure the dates of these files are making sense and no old files are floating around in your maps/ folder.
Creating your PK4
A good way to create your initial PK4 is to copy the compiled map files to a temporary maps/ folder and to zip them up. You can use any compression program capable of handling ZIP files, like 7-zip, WinRAR, WinZip, whatever (important: do not create files using RAR, 7z or any other format, only the ZIP format will be recognised). The zip file can have any legal filename - it doesn't have to be the exact mission name. Then rename its suffix to .pk4.
Be sure that the maps/ folder ends up in the root of your ZIP. Then add the darkmod.txt and the startingmap.txt to the archive.
In case you haven't added any custom models, textures or other assets (i.e. you're just using vanilla TDM assets), you're done here. Proceed with #Testing the PK4
Adding custom Assets
Any custom models, textures, def, xdata files need to be added to the PK4. Be sure to put the files in the exact same folder structure as found in the darkmod/ main mod folder. Example: .mtr files need to go to the materials/ subfolder. If you were to extract the PK4 file to the darkmod/ folder, the files would end up in the correct place (note: don't do this actually, you might overwrite existing files in the darkmod folder).
In the (hopefully) rare case your mission needs to overwrite existing TDM content (e.g. modify a DEF file present in the main mod to change a setting), just include the modified file in your PK4. The file in your PK4 will "overrule" the ones in the mod base when the mission is installed (this is what the fs_game_base and fs_game parameters are for: "game" content will overrule "game_base" content).
Testing the PK4
Once created, add a new folder in your darkmod/fms/ directory and put the PK4 in there. Then start TDM, your map should be listed now in the list of available missions. Make sure to use a "good" foldername for your PK4, not conflicting with any existing ones and without spaces, special or foreign (=non-english) characters. Numbers are fine.
Install the mission and see whether it starts correctly.
Splash Image (optional)
When browsing through the mission selection dialog, a small background screenshot can be displayed in the menu. This file is named install_splash.tga and can optionally be provided by the mission creator. Just create a small 256x256 image (must be TGA format, DDS files won't work) and put them in your PK4, next to the startingmap.txt and darkmod.txt files. The loading code will find this image and extract it just in time for display in the menu.
FM Notes (optional)
It's possible to display a couple of lines as FM notes. Just add a file called readme.txt in the PK4. When this file is available, an additional button "Notes" will be displayed next to the "Install Mission" button.
Distributing your Mission
You need only distribute your pk4 for others to play your fan mission. They must, of course, have the Dark Mod resources.
You can include a readme.txt or similar in the pk4 for any extra info including credits etc.
There will be at least one website available that accepts Dark Mod fan mission pk4s for downloading.