A lightweight, fully automated PowerShell build tool for Deadlock modders.
If you are tired of manually running csdk compiling your files, tracking changed files, and packing VPKs by hand, this script automates the entire workflow.
- Interactive CLI Menu: Select which mod to build directly from a simple list. You can also start or restart Deadlock without leaving the menu.
- Smart Incremental Builds: Uses MD5 caching to remember which files you've already compiled. If you only change one
.cssfile, it will only compile that single file, saving a massive amount of time. - Force Rebuild: Add
-Force(or-f) to do a full clean rebuild of a single mod when the cache gets out of sync. - Batch Processing: Automatically splits compilation tasks into batches of 25. This prevents Windows character limit crashes when building massive UI or model replacements.
- Auto-Routing: Automatically detects your Steam installation, Deadlock directory, and
addonsfolder. - Safe Vtex Compilation: Automatically strips unsupported algorithm parameters from
.vtexfiles on-the-fly to prevent compiler crashes. - Texture Refresh: Changed or removed PNG/TGA inputs requeue texture descriptors, including custom
.vtexfiles. CSDK resolves their dependencies. - MP3 Audio: Automatically converts
.mp3inputs to 16-bit PCM.wavin the build staging directory, then compiles them as.vsnd_c. Requires FFmpeg on PATH; source MP3s are preserved. - Direct Resources: TTF fonts and supported already-compiled resources are copied without compilation. Unsupported files are listed instead of silently omitted.
- Safe Output Replacement: Packing happens in a temporary directory. The previous VPK bundle is backed up before replacement and restored if replacement fails.
- Addon Slots: Uses the first available slot from
pak01topak99, ignoring stale registry entries. Orphaned numbered data archives also reserve their slot.
You need Reduced CSDK 12 to compile Source 2 files.
- Download it here: CSDK 12
- Extract it to
C:\Reduced_CSDK_12. (If you want to keep it somewhere else, run the script once. It will fail but generate atools/data/config.jsonfile where you can set your custom path).
Put the tools folder near your mods like this:
- Run
tools/build_mod.bat. - The script will scan your workspace and list all available mod folders. The menu also offers:
- [0] Settings — configure paths and behaviour (see below).
- [S] Start Deadlock / [R] Restart Deadlock — launch or relaunch the game.
- Type the number of the mod you want to build and press Enter.
- Choose your build destination (skipped if set in config):
- [1] Local: Saves the compiled
.vpkinsidetools/builds/. - [2] Addons: Directly packs and sends the
.vpkto your game'sgame/citadel/addons/folder.
- [1] Local: Saves the compiled
- The script will hash your files, compile the changes, and pack the
.vpk!
Incremental builds rely on a cache. If something gets out of sync (e.g. a failed
build, renamed files, or stale compiled artifacts), type the mod number followed
by -Force (or the short form -f) at the menu prompt:
Enter the number of the mod to compile: 6 -Force
This wipes that mod's temporary build folders and recompiles every file from
scratch. The flag also works as a launch parameter (build_mod.ps1 -Force).
GNU-style --force and --f are also accepted. Launch flags remain active when
you select a mod from the menu.
For a standalone mod, place the contents of tools in its build_mod directory.
Keep build_mod_helpers.ps1 beside build_mod.ps1. The builder selects the parent
mod automatically; its local output is saved in build_mod/builds.
Automation can select an explicit source and destination without menus:
.\tools\build_mod.ps1 -ModFolderName Example -Batch -Force -SourcePath C:\Mods\Example -OutputPath C:\Builds\Example.vpkBatch mode uses the configured CSDK path but does not discover game addons, install into the game or restart Deadlock. A failed compile stops before packing. If replacement and rollback both fail, the error identifies the preserved backup directory for recovery. Replacement is not crash-atomic across split VPK files. Texture descriptors are revisited for image changes; the tool does not implement a general dependency graph for every Source 2 resource type.
Place MP3 files under sounds, for example sounds/mods/alert.mp3. Install
FFmpeg and add its bin directory to PATH before starting the builder. The tool
generates sounds/mods/alert.wav in its temporary content directory and compiles
sounds/mods/alert.vsnd_c, preserving the original sample rate and channel count.
Use sounds/mods/alert.vsnd in sound event definitions, as with a WAV source.
Existing soundevents/*.vsndevts files compile normally.
Unchanged MP3s reuse their generated WAV and compiled sound; changes, missing
staging files and -Force rebuilds are handled automatically. A missing FFmpeg,
failed conversion, or MP3/WAV pair with the same path and stem stops the build
before packing. Keep only one source format per sound.
powershell -NoProfile -ExecutionPolicy Bypass -File tools/tests/build_mod_regression.ps1
powershell -NoProfile -ExecutionPolicy Bypass -File tools/tests/mp3_regression.ps1These checks parse the builder and exercise isolated logic with in-memory file operations. They do not run the builder, compiler or packer, create VPK files, touch game addons or prove client rendering.
The easiest way to configure the tool is the Settings menu ([0] from the main menu):
- [1] Build destination — cycles between
Ask,Builds, andAddons. - [2] Execution mode — toggles between
BuildOnlyandBuildAndRestart(close Deadlock, build, relaunch). - [3] Steam path — manually override the Steam location if auto-detection fails.
- [4] CSDK path — manually override the Reduced CSDK location.
- [5] Wipe CSDK citadel_addons folders — fully clears both
content\citadel_addonsandgame\citadel_addonsin the CSDK and resets the build cache. Use this for a clean slate across all mods (the-Forceflag only cleans a single mod). You'll be asked to confirm before anything is deleted.
These settings are stored in data/config.json, created inside the tools folder on first launch:
{
"BuildDestination": "Ask",
"ExecutionMode": "BuildOnly",
"SteamPath": "",
"CsdkPath": "C:\\Reduced_CSDK_12"
}- BuildDestination: Change to
"Builds"or"Addons"to skip the destination prompt. - ExecutionMode: Change to
"BuildAndRestart"to automatically close Deadlock, build the mod, and launch Deadlock again. - SteamPath / CsdkPath: Manually override paths if auto-detection fails.