Thanks for your interest! OpenConquer is an unofficial, faithful macOS reimplementation of Command & Conquer: Tiberian Dawn. This guide covers how to build, how the test harness works, and the conventions that keep the project healthy.
- Never commit game assets. No
.MIX,.SHP,.AUD,.VQA,.PAL, extracted PNG/WAV, or any Electronic Arts content. Assets are the user's own, extracted locally..gitignoreblocks the common formats, but be careful. - License: by contributing you agree your contributions are licensed under the project's GPLv3.
- Match the original. When implementing a behavior, cross-check EA's released C++ (see Reference sources below) and cite the file/line in a comment where a choice mirrors the original — the existing code already does this (e.g.
// mirrors building.cpp:560-634).
brew install sdl2 pkg-config
swift build # debug
swift build -c release
swift run # build + launch- Target: macOS 13+, swift-tools 5.9 (language mode 5).
- SDL2 is wired via the
CSDL2system-library target (pkg-configsdl2). - Swift version range: CI builds on a matrix of Swift 5.10 (macos-14) and
Swift 6.x (macos-15), so keep code compatible with both — avoid Swift 6-only
stdlib APIs (e.g.
Sequence.count(where:); usefilter{}.count). We do not use the Swift 6 language mode (strict concurrency); this is a single-threaded, deterministic sim built on global state, so strict concurrency is all cost and no benefit here.
The simulation is deterministic given a seed — identical across separate processes and across two initGameWorld calls in one process. This is the project's safety net: it lets contributors change gameplay code without fear, because a change that unintentionally perturbs the simulation shows up immediately as a changed digest.
# 3 clean subprocess trials, assert identical digest (the regression net):
./.build/debug/TiberianDawnMax --determinism SCG01EA 2500
./.build/debug/TiberianDawnMax --determinism SCG01EA 4000
./.build/debug/TiberianDawnMax --determinism SCB01EA 4000
# Print a state digest for a run (stableSeed — NOT comparable to --determinism):
./.build/debug/TiberianDawnMax --headless SCG01EA 600
# Focused behavior self-tests:
./.build/debug/TiberianDawnMax --test-repair SCG01EA
./.build/debug/TiberianDawnMax --test-crush SCG01EA
./.build/debug/TiberianDawnMax --test-fogpath SCG01EA
./.build/debug/TiberianDawnMax --test-stacking SCG01EA
./.build/debug/TiberianDawnMax --test-harvester-economy
./.build/debug/TiberianDawnMax --test-flags SCG01EA
# Asset-free determinism/logic tests — these build a world in code (no MIX),
# so they run in CI as well as locally:
./.build/debug/TiberianDawnMax --test-synthetic 500
./.build/debug/TiberianDawnMax --test-harvester-economy
./.build/debug/TiberianDawnMax --test-triggers-ex
./.build/debug/TiberianDawnMax --test-two-event
./.build/debug/TiberianDawnMax --test-regions
./.build/debug/TiberianDawnMax --test-wingate
./.build/debug/TiberianDawnMax --test-winlose
./.build/debug/TiberianDawnMax --test-initteams
./.build/debug/TiberianDawnMax --test-enemy-superweapon
./.build/debug/TiberianDawnMax --test-eventparity
./.build/debug/TiberianDawnMax --test-team-former
./.build/debug/TiberianDawnMax --test-prebuilt
./.build/debug/TiberianDawnMax --test-campaign-graphRules of thumb:
- Simulation randomness (anything mutating world/object/house/AI state during
gameTick) MUST use the seeded helpers inGame/GameRandom.swift(rndInt/rndDouble/rndBool/.rndElement()), neverInt.random(...). - Cosmetic randomness (screen shake, debris/explosion offsets, sprite flicker, audio, menus) deliberately stays on the system RNG and must not use the seeded helpers.
- If your change intentionally alters the simulation, the digest will change — re-run
--determinismto confirm it's still deterministic (all 3 trials match), then update the documented baselines inCLAUDE.md, explaining why in your PR. - Interactive-only features (e.g. fog-aware pathfinding) are gated so headless/AI stay omniscient and baselines hold. Keep it that way.
CI note: most
--determinism/--test-*flags load scenarios from MIX, which require the user's own extracted assets, so those run locally. But the asset-free tests above —--test-synthetic(a full-tick determinism net over an in-code scenario) plus--test-harvester-economy,--test-triggers-ex,--test-two-event,--test-regions,--test-wingate— build their world in code and run in CI on every push/PR.--test-syntheticasserts equality between two in-process runs; it does not pin a hex digest, because the digest can legitimately differ across the Swift 5.10/6.x matrix.
- Architecture: a single global
session: GameSessionowns all mutable state via nested containers (world,production,scripting,combat,campaign). Game objects are a singleGameObjectclass; behavior is attached viaextension GameObjectblocks in topically-appropriateGame/*.swiftfiles. - Fixed-tick loop: the sim runs at a fixed 15 FPS (
Game/GameLoop.swift), decoupled from render FPS; rendering interpolates.gameTick()phase order is load-bearing (= RNG-consumption order) — don't reorder or fuse phases; re-verify--determinismafter touching it. - New behavior goes in an
extension GameObjectin the rightGame/file, not a catch-all. - Split files on contact, not in dedicated passes: if you're editing a file that's crossed ~800 lines or clearly mixes two concerns, split it along its natural seam as part of that work.
- Prefer guards over force-unwraps.
See CLAUDE.md for a deeper architecture guide and current status.
These are EA's GPLv3 releases, kept alongside the repo as behavior references — not part of the build and not redistributed here:
../CnC_Tiberian_Dawn/— the original Westwood C++ (UNIT.CPP, BUILDING.CPP, CELL.CPP, MAP.CPP, CONST.CPP, …). The authoritative behavior reference.../Vanilla-Conquer/— the modern open-source port; cleaner C++, good for cross-checking constants and frame layouts.
Before guessing at a behavior, grep the C++ for the relevant Mission_*, LAND_*, BSTATE_*, or data table.
docs/PARITY.md— the verified-vs-approximated checklist. Every 🟡 and ⬜ row is a known, scoped piece of work with the reference C++ already cited. A few are marked [good first issue].- Data/rules (no deep Swift needed): unit/structure stat tables, mission INI tuning, classic-vs-enhanced toggle values.
- Missions: authoring or fixing campaign scenarios and triggers.
- Bugs: anything labeled
good first issue.
Filing counts too: a well-described Parity gap issue (what the original does, what we do, ideally a C++ line ref) is directly useful even if you never touch the Swift.
- Branch from the default branch.
- Keep changes focused; explain gameplay-affecting changes and any baseline updates.
- Run
swift buildand the relevant--determinism/--test-*checks locally before pushing. - No assets, ever.
The PR template walks through the checks. Two things reviewers always look for: whether
the three --determinism digests moved (and if so, why, with CLAUDE.md updated), and
whether any non-1995 behavior sits behind a ruleset toggle that is off in Classic1995.