Skip to content
nldkPublic

About

A statically typed language and build tool for Hearts of Iron IV mods. It type-checks events, focus trees and effects, generates the Paradox script and comes with a language server. Written in Rust.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

MARCH

MARCH Assembles Readable Clausewitz Hacks — a statically typed language and build tool for Hearts of Iron IV mods.

You write events, focus trees and effects with braces, types and real names; march checks them (scopes, units like 5% and 70 days, missing references, localisation) and writes the Paradox script, localisation files, sprites and launcher descriptor for you. It also installs the mod, rebuilds on save, maps error.log lines back to your source, warns about conflicts with other mods and about changes that would break save games, and powers a VS Code extension. The core knows nothing about HOI4: game knowledge lives in a game pack, so other Clausewitz games can be added.

event BelgiumPeace for Country BEL {
    title = "A Peaceful Day"
    desc = "Nothing is happening in Brussels."
    when (!atWar && stability > 50%)

    option "Good" {
        politicalPower += 50
        capital.civilianFactories += 1
    }
}

Status: 0.1.0, unreleased. The whole pipeline works end to end: parser, formatter, type checker, code generation, build tool, installer, assets, translations, checks, in-game tests, the focus tree preview and the language server.

How this was made

march was my idea, and I designed its syntax together with Claude: braces and a simpler, more familiar syntax instead of indentation. Claude Code agents built the rest: the compiler, type checker, build tool, language server, the Studio editor and these docs. Commits made with Claude are marked Co-Authored-By: Claude.

Quick start

# Install (needs Rust from https://rustup.rs)
cargo install --path crates/march-cli

# Create a mod and build it
march new "Belgium Rework"
cd "Belgium Rework"
march pack sync          # read your installed game's effect list (once per game update)
march build              # → target/default/
march install            # copy into the HOI4 mod folder; enable it in the launcher
march watch              # rebuild + reinstall on every save

cargo install produces a self-contained march: the HOI4 game pack is compiled into the binary. To use pack data from a folder instead, set MARCH_PACKS_DIR to a folder containing hoi4/, or place packs/ next to the binary (or in <prefix>/share/march/packs/).

MARCH Studio

A Unity-style visual editor for MARCH mods: Hierarchy, focus tree and event editors, a schema-driven Inspector with conditions and effects as rows, live checking, and ▶ Play (save, build, install, start the game). Everything is saved as .march files, next to your hand-written code.

cargo install --path crates/march-studio   # self-contained, like march
march studio "Belgium Rework"              # or: march-studio <dir>
# from a checkout:
cargo run --release -p march-studio -- showcase

See MARCH Studio in the guide.

Platforms

OS Status Needs (to build from source)
Linux developed and tested here Rust (rustup), Git
Windows 10/11 compiles; the whole test suite passes (x86_64-pc-windows-gnu under wine) Rust (rustup, MSVC toolchain + Visual Studio Build Tools), Git
macOS (Apple silicon, Intel) compiles (cargo check); platform logic unit-tested on Linux Rust (rustup), xcode-select --install

Per-OS steps: Getting started. On Windows the mod folder follows the real Documents folder (also when OneDrive moved it) and Steam is found through the registry; on macOS the mod folder is ~/Documents/Paradox Interactive/Hearts of Iron IV/mod.

scripts/cross-check.sh runs cargo check for x86_64-pc-windows-gnu, x86_64-pc-windows-msvc, aarch64-apple-darwin and x86_64-apple-darwin (only rustup is needed); --test-windows also runs the test suite for Windows under wine (needs mingw-w64 and wine).

Documentation

The user guide, for modders:

  1. Getting started — install, first mod, launcher, VS Code
  2. Language tour — events, focus trees, functions, classes, …
  3. CLI reference — every command and flag
  4. Projects and libraries — mod.toml, dependencies, save compatibility, translations
  5. Troubleshooting — reading errors, march log, common error codes
  6. How it works — the pipeline and game packs
  7. MARCH Studio — the visual editor: focus trees, events, the Inspector, saving, ▶ Play

Reference material: the design and the contracts in docs/contracts/ (language, game pack format, project files, core interfaces). CHANGELOG.md lists what is in each release.

Repository layout

Path What
crates/march-cli the march binary
crates/march-syntax lexer, parser, formatter
crates/march-codegen, march-pdx, march-ir code generation, Paradox script model, typed IR
crates/march-build, march-project build tool, project files
crates/march-assets, march-check, march-preview images and translations, lints and checks, focus tree preview
crates/march-gamepack, march-hoi4, packs/hoi4 game pack interface, the HOI4 pack (Rust part, data and constructs)
crates/march-lsp, editors/vscode language server, VS Code extension
crates/march-studio MARCH Studio, the visual editor (march-studio binary)
crates/march-edit, march-studio-ui, march-studio-inspector, march-studio-focus, march-studio-event the Studio's document model, theme and widgets, Inspector, focus tree and event editors
crates/march-embedded-packs the game packs compiled into march and march-studio
examples/ example .march files (valid and intentionally invalid)
showcase/ "Belgium Rework", a complete mod written in MARCH (60 focuses, 28 events)

Development: cargo test --workspace, cargo clippy --all-targets -- -D warnings, cargo fmt --check.

Licence

MIT OR Apache-2.0.

About

A statically typed language and build tool for Hearts of Iron IV mods. It type-checks events, focus trees and effects, generates the Paradox script and comes with a language server. Written in Rust.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages