Skip to content

About

Rust postcompiler for HammerAddons/Source Engine map compile pipelines

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Postcompiler

A drop-in replacement for TeamSpen210/HammerAddons postcompiler. Runs between VBSP and VRAD in the Source Engine map compile pipeline to transform entities, auto-pack assets, and combine static props.

Single native binary, zero runtime dependencies. Cross-platform Rust workspace.

Usage

postcompiler [OPTIONS] <MAP>

Arguments:
  <MAP>                  Path to .bsp (or .vmf — converted to .bsp)

Options:
  -c, --config <FILE>    Path to hammeraddons.vdf
  -g, --game <DIR>       Game directory containing gameinfo.txt
  --nopack               Disable auto-packing
  --nosaving             Don't write the BSP back (dry run)
  --regenerate           Force regeneration of cached models
  -v, --verbose          Verbose logging (repeat for trace logging)
  --propcombine          Enable static prop combining
  -V, --version          Print version
  -h, --help             Print help

Typical Hammer Expert Compile Setup

$bsp_exe $path/$file
$postcompiler_exe --propcombine $path/$file
$light_exe $path/$file

Build

# Debug
cargo build

# Release
cargo build --release

The Linux release binary is at target/release/postcompiler.

Windows cross-compile from Linux

rustup target add x86_64-pc-windows-gnu
cargo build --release --target x86_64-pc-windows-gnu

The Windows release binary is at target/x86_64-pc-windows-gnu/release/postcompiler.exe. This target requires the MinGW linker configured in .cargo/config.toml.

Release Checklist

Run these before tagging a release:

cargo fmt --all -- --check
cargo clippy --workspace -- -D warnings
cargo test --workspace
cargo build --release --workspace
cargo build --release --target x86_64-pc-windows-gnu
target/release/postcompiler --version

Configuration

The postcompiler reads three config files:

File Format Location Purpose
hammeraddons.vdf Keyvalues (VDF) Walked from map path [postcompiler] options: game dir, auto_pack, disabled_transforms, crowbar_location, pack filters
hammeraddons_paths.vdf Keyvalues (VDF) Next to hammeraddons.vdf |name| -> path variable expansion
hammeraddons_game.dmx DMX binary Next to gameinfo.txt HAGame v1: tags, steamid, studiomdl paths, searchpaths, particles manifest

Architecture

18 crate workspace under crates/. See PLAN.md for full breakdown.

Core pipeline:

  1. Parse CLI args & config
  2. Read BSP (header, lumps, entities, pakfile, game lumps)
  3. Mount existing pakfile as virtual filesystem
  4. Run transforms (sorted by priority, gated by inhibit_tags + disabled_transforms)
  5. Apply I/O remaps (recursive output rewriting)
  6. Inject VScript code
  7. Auto-pack referenced assets (FGD-driven entity scan + BSP lump scan)
  8. (Optional) Propcombine: cluster, merge, and recompile static props
  9. Save modified BSP

About

Rust postcompiler for HammerAddons/Source Engine map compile pipelines

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Used by

Contributors

Languages