Build System

Sat, Mar 12, 2022 3-minute read

This is going to be a Windows focused article on creating a basic build system for your project.

At some point you’re going to release your mod (hopefully) and having some sort of automatic system to package it up for release will become crucial as more files get added to your project but you might not want to include all of them in your final package, like any test levels or source art.

There are a few options.

  1. Create a copy of your mod folder and then go through it and delete all the files you don’t want to include.

NOTE: This is still good to do as a final check.

  1. Do step 1. but have a batch file that you maintain to delete unwanted files as you go.

  2. Create a batch file that only copies over files that you want into a release build, or any type of build for that matter. And skip any files that already exist to speed up the process.

This is getting better but how about we…

  1. Automate the batch file creation and execution using a combination of a custom tool and some cleaner, basic batch syntax that reads in a manifest of files you want to include.

We’re going to focus on step 4. Presenting Buildshit.exe! A command line application that takes in a few arguments/switches/parameters and automates the batch file creating process by reading in an easy to maintain manifest text file reflective of your final build.

download Buildshit here

How does it work?

You place Buildshit.exe in the same directory as your Quake.exe (or engine of choice)…

C:\Quake
├── id1
├── Yourmod
└── Quake.exe/Darkplaces.exe etc...
└── Buildshit.exe
└── yourmod_manifest.txt

And run it with the following:

Buildshit.exe [source folder] [destination folder] [manifest] [output batch]

I.e.

Buildshit.exe yourmod yourmod_release yourmod_manifest.txt build_yourmod

The manifest.txt looks something like this:

autoexec.cfg
progs.dat
maps\test_model_static.map
maps\test_model_static.bsp
maps\test_particle_spawner.bsp
maps\test_particle_spawner.map
maps\test_breakable.map
maps\test_breakable.bsp
maps\test_surface.map
maps\test_surface.bsp

All entries are relative to the root of the source folder.

After that, build_yourmod.bat will appear in the same folder as Buildshit.exe. Simply run build_yourmod.bat and it will build a yourmod_release folder with the files from yourmod_manifest.txt.

NOTE: Buildshit currently generates xcopy syntax. Might look at adding an option for robocopy but right now it works fine.

Update yourmod_manifest.txt as needed… You may want to get fancy and just create a single batch file to run Buildshit and any batch files it creates by using the following:

Call this something like build_yourmod_release.bat:

if not exist "yourmod_release" mkdir yourmod_release
cd yourmod_release
if exist "version.txt" del version.txt
echo Build %time% %date% >> version.txt
if exist "run_yourmod_release.bat" del run_yourmod_release.bat
echo cd.. >> run_yourmod_release.bat
echo quake.exe -game yourmod_release >> run_yourmod_release.bat
cd ..

Buildshit.exe yourmod yourmod_release yourmod_manifest.txt build_yourmod
call build_yourmod.bat

With any luck you should see a new folder appear with all the files needed to run a fresh copy of yourmod, version.txt will currently update every time it’s run with the current date and time (add to this as necessary). From here, all you have to do is add to the manifest what files you want to include in your build and that’s it.

Happy modding!