Faction Architecture Inventory
This inventory captures the active faction boundary for the current pre-alpha faction rollout. It records what exists today, names the temporary compatibility shims, and points later phases at focused checks. It does not define the final faction catalog shape.
Compatibility Boundary
Faction work is pre-alpha and does not preserve compatibility with old replay artifacts, persisted match-history replay payloads, compact snapshot versions, or old protocol payloads. Later phases may break those formats when they add explicit faction identity. Preserve current live gameplay behavior for the existing faction unless a later phase explicitly changes it.
Active Faction Boundary Sources
This document owns the active faction lifecycle taxonomy and the current catalog-id status table.
server/crates/rules/src/faction.rs owns catalog facts, loadouts, and ability availability.
server/src/lobby/faction_validation.rs owns lifecycle admission. docs/design/protocol.md owns
wire vocabulary and payload shapes, and docs/design/server-sim.md owns the Game API and sim
boundary wording.
plans/archive/faction/* files are historical-only evidence from the earlier faction rollout. They
are not active checker inputs and must not be treated as lifecycle policy unless a future plan
explicitly copies a rule back into an active design document. Guard scripts may check that the
archive exists and is named as historical, but they must not read archived phase files as the source
of current faction truth.
Catalog Id Statuses
Lifecycle status is explicit and separate from catalog existence:
playable: allowed in normal product match starts where the owning lifecycle path accepts a playable faction id.playable-human-only: allowed for human selection but not for AI, prediction, or replay-capable starts until those lifecycle paths explicitly opt in. No current catalog id uses this status.test-fixture-only: allowed only by explicit fixture/test contexts and never by normal product selectors or replayable starts.reserved/future: named for future work and optionally represented by an empty catalog shell, but not admitted by lobby, replay, AI, prediction, or other match lifecycle paths.historical-only: retained as archive evidence and never treated as active lifecycle policy.
| Faction id or path | Status | Current lifecycle policy |
|---|---|---|
kriegsia | playable | Default faction for missing non-replay requests. Supported by normal human lobby, AI seats, dev starts, self-play defaults, replay/branch records, match-history replay, post-match replay, spectator metadata, and local prediction when version/build metadata is compatible. |
ekat | playable | Hidden from the normal lobby faction selector while its existing catalog, Lab palette, and internal wire selection remain available. Explicit playable validation accepts it for start/replay-capable contexts, and schema 3 replay records plus replay-branch metadata may carry it. Public AI seat creation has no faction selector and still defaults to kriegsia; current local prediction is disabled when the local player is ekat. |
cultivators | playable | Economy-first catalog: Nexus (shared ResourceDepot), Portal, Three Dao Pavilion, Tournament Grounds, Proving Grounds, Shop, Serf, Novice, the three distinct Dao Adept kinds, Steel Mine and Oil Pumpjack. Portal is a dedicated 3x3 building that produces Novices. Standard economy loadout without Riflemen; human beta/local selector enabled, normal playable lifecycle policy applies. No new AI profile; prediction remains unsupported. |
phase2_empty_fixture | test-fixture-only | Catalog and loadout exist for explicit Rust/test fixture coverage. It is rejected by normal lobby, AI, replay, branch, dev scenario, self-play, match-history, and post-match paths unless the caller uses the TestFixture validation context or a direct lower-level sim test helper that deliberately owns the fixture. |
plans/archive/faction/* | historical-only | Archived phase plans, handoffs, and lifecycle matrices are not active faction policy and are not checker lifecycle inputs. |
Current Entity Identity
Runtime identity is still global EntityKind. The current roster has 41 global kinds: 18 units,
19 buildings, 2 resource nodes, and 1 transient Shop delivery combat body. Server rules own the stable ids in
server/crates/rules/src/kind.rs; protocol mirrors expose the same string ids in
server/crates/protocol/src/lib.rs and client/src/protocol.js.
The current production catalog is in server/crates/rules/src/defs.rs:
- Units: Worker, Golem, Novice (Warrior), Wind Adept, War Adept, Magic Adept, Rifleman, Panzerfaust, Machine Gunner, Anti-Tank Gun, Mortar Team, Artillery, Rocket Truck, Scout Car, Scout Plane, Tank, Command Car, and Ekat.
- Buildings: Resource Depot, Portal, Three Dao Pavilion, Tournament Grounds, Proving Grounds, Shop, Zamok, Depot, Barracks, Training Centre, Engineering Complex, Factory, Gun Works, Tank Trap, Barbed Wire, Steel Mine, and Pump Jack. Tank Trap construction is server-authoritative after Training Centre eligibility and is exposed through the mirrored worker build menu; Resource Depots place Steel Mines and Pump Jacks directly on nearby matching resource patches.
- Resource nodes: Steel and Oil.
Temporary compatibility shim policy: direct global kind checks are approved in the current rules
catalog, protocol adapters, setup/loadout code, AI, dev scenarios, command execution, production,
economy, combat, world-query helpers, and tests. New production files that introduce direct
current-faction kind checks should either use the faction catalog API or be added to
scripts/check-faction-assumptions.mjs with a short reason. High-risk approved files have a direct
special-case count ratchet so newly added current-faction checks inside those large files are also
visible during review. The ratchet is an inventory review tool, not approval to expand Kriegsia,
Ekat, or fixture special cases casually.
Engineers and Serfs share EntityKind::Worker for building and selected vehicle repair. Worker-only repair admission,
queued promotion, and execution keep that shared body check; Golems do not repair buildings or vehicles.
Current Economy Shape
Steel, Oil, and Supply are the only player resources in snapshots, compact snapshots, replay
analysis, match history replay artifacts, and the HUD. Start-map resources are still only Steel and
Oil nodes. Current Kriegsia starting values are STARTING_STEEL = 25, STARTING_OIL = 0, and
STARTING_WORKERS = 1, and STARTING_RIFLEMEN = 4.
Compact snapshots encode resources as fixed scalar slots: tick, Steel, Oil, Supply used, and Supply
cap. Spectator/replay player_resources use the same Steel/Oil/Supply fields. Later generic
resource work must be a separate plan; this faction plan keeps the current resource payload shape.
Approved direct-resource modules are listed in docs/design/balance.md under the faction economy
contract. Future direct Steel/Oil/Supply references outside those owners should either route
through catalog-aware cost/loadout helpers or update that approved inventory deliberately.
Current Starting Loadout
The standard Kriegsia match start is defined by the kriegsia.standard faction loadout in
server/crates/rules/src/faction.rs and assembled by server/crates/sim/src/game/setup.rs: each
player gets one completed Resource Depot, one Engineer and four Riflemen in separate rings, nearby
Steel/Oil resource clusters, and starting Steel and Oil. Unknown non-empty faction ids receive no
catalog loadout, starting entities, starting Steel/Oil, or Kriegsia supply credit; lifecycle owners
must validate before building a Game.
The standard Ekat match start is defined by the ekat.standard faction loadout: one completed
Zamok and one Ekat hero, with no starting Steel/Oil or Supply requirement. Zamok trains Golems for
the current Ekat economy and recovery slice. The
phase2_empty_fixture.scout_depot loadout starts one Depot and one Scout Car for explicit
fixture tests only; catalog existence does not make that id product-playable.
The cultivators.standard loadout reuses Kriegsia starting resources and economy entities, without Riflemen.
It is structural catalog paperwork only and cannot reach simulation setup through a validated
lifecycle path.
Replay starts reconstruct from recorded per-player PlayerStartingLoadout records. Replay
validators reject missing loadouts, records for unknown players, faction mismatches, empty loadout
ids, and loadout ids that do not exist in the player’s faction catalog. Global starting Steel/Oil
constructors remain compatibility helpers for tests rather than replay/lifecycle reconstruction
APIs.
Current Tech Tree
Workers can place Resource Depot and Supply Depot immediately, and can place Pump Jacks contextually on live oil patches with no tech requirement. Barracks requires a completed Resource Depot; Training Centre requires a completed Resource Depot and Barracks; Engineering Complex, Factory, and Gun Works require a completed Resource Depot and Training Centre; Tank Trap and Barbed Wire require a completed Training Centre. Resource Depot trains Workers. Barracks trains Riflemen immediately and Machine Gunners after the Training Centre requirement is met. Factory trains Scout Cars immediately, Command Cars once an Engineering Complex is complete, and Tanks after Tank Production research. Gun Works trains Mortar Teams immediately, Anti-Tank Guns while owning a completed Engineering Complex, and Artillery after Artillery research.
Research unlocks live in server/crates/sim/src/game/upgrade.rs and client descriptors in
client/src/config.js. Training Centre researches Methamphetamines. Engineering Complex researches
Artillery, Tank Production, and Smoke Plus. The retired AT Guns research leaves its former command-card
slot empty so the remaining research hotkeys do not move.
Each remaining dependency may already be complete or earlier in the same Engineering Complex queue when its dependent is
ordered, while completion still gates the actual unlock. Tank Production unlocks Tanks; Command
Cars require the Engineering Complex itself but no completed research. The current Ekat tech tree starts
with Zamok training Golems;
Golem-converted tech buildings are still planned work.
Current Ability Surface
Current ability ids are Charge (legacy no-op compatibility only), Smoke, Mortar Fire, Point Fire,
Breakthrough, Ekat Teleport, Ekat Line Shot, Ekat Magic Anchor, and Ekat Consume Golem. The Rust
faction catalog in
server/crates/rules/src/faction.rs is authoritative for ability id, carrier, target mode,
range, cooldown/charge, resource cost, queueability, autocast support, and command-card affordance
metadata. client/src/config.js is the checked client projection, while
server/crates/sim/src/game/services/ability_orders.rs, server/crates/sim/src/game/ability.rs,
and server/crates/sim/src/rules/projection.rs own execution and projection hooks. Protocol
ability vocabulary and compact codes remain mirrored through server/crates/protocol/src/lib.rs
and client/src/protocol.js.
Scout Car Smoke requires the owning player to retain a completed Engineering Complex; the command card
keeps the ability visible but disabled with the missing-tech reason until that building is present.
Current Client Command Cards
The command-card renderer is local JS in client/src/hud_command_card.js; faction-sensitive
build, train, research, and ability descriptors are driven by the checked catalog mirror in
client/src/config.js. Kriegsia, Ekat and Cultivators command ids are namespaced by faction, unknown valid ids
fail closed to an empty catalog, and fixture catalogs expose no command
surface. Cultivators exposes Nexus, Portal, Three Dao Pavilion, Tournament Grounds, Proving Grounds and inert Shop construction; the Portal trains Disciples.
The beta/local human-seat selector lists Kriegsia and Cultivators; Ekat is hidden. node tests/hud_command_card.mjs
is the focused command-card guard, and node scripts/check-faction-catalog-parity.mjs compares
client-exposed descriptor data against the Rust catalog dump.
Current AI Coupling
AI is Kriegsia-only through the public lobby seat flow: the only faction-locked profile, the
internal jeffs_cult (Cultivators), cannot be seated in a human lobby. Legacy profiles and Rush AI select current
Kriegsia roster kinds directly; Resource Depots auto-build Steel Mines and Pump Jacks, Engineers
construct production and research buildings, and Steel/Oil/Supply budgets remain fixed fields.
Public addAi requests do not accept a faction id. An AI seat plays its profile’s faction:
Kriegsia, unless the profile is locked to another playable faction in
server/crates/ai/src/live/factions.rs (rts_ai::live_profile_faction_id). A locked profile
needs its own strategy written for that faction; jeffs_cult (server/crates/ai/src/jeffs_cult/)
is locked to cultivators and plays only in observer sessions and offline tools for now.
Rush’s roster policy and staging modules (server/crates/ai/src/rush.rs and rush/staging.rs)
intentionally select Riflemen, Machine Gunners, Panzerfausts and their production/research path.
They receive fog-filtered SDK frames and use catalog-derived costs and building footprints. The
faction assumption checker lists these two policy modules explicitly; they do not broaden the
generic SDK or public faction admission boundary.
Pressure’s copied policy (server/crates/ai/src/ai_core/profiles/pressure.rs), independently owned
staging (server/crates/ai/src/pressure.rs, with geometry in shared_tactics/staging.rs), and timed infantry production (pressure/production.rs)
likewise select the current Kriegsia roster directly. The checker lists those three policy files
explicitly. Pressure uses the same fog-filtered SDK and catalog-derived production costs; adding
it as an AI 2.3 member or standalone opponent does not admit another AI faction.
Eco (server/crates/ai/src/eco.rs) is another explicit Kriegsia roster policy, using one-to-four
bases, Machine Gunners, Panzerfausts and their research. It consumes the reusable SDK defensive
planner; the planner’s geometry is independent of the build order, while its economic scoring
(sdk/defense/scoring.rs) explicitly values the current Steel mines and production roster.
These current-roster policy files are checker-listed. Neither the planner nor Eco changes public
AI faction admission or replaces the catalog as the source of costs and prerequisites.
Current Prediction And WASM Coupling
Prediction/WASM assumes the current start payload, global entity ids, current command set,
Steel/Oil/Supply scalar resources, and compact snapshot version. Local prediction is currently
supported only for local Kriegsia players; local Ekat or fixture players disable prediction with the
stable unsupported-local-faction reason until the WASM simulation and adapter support those
contracts intentionally.
Lifecycle Paths
This section is the maintained source of truth for match creation, playback, replay branch, spectator, dev scenario, self-play, AI, prediction, match-history, and post-match replay paths. Later phases must update this section whenever they touch one of those lifecycle paths.
| Path | Faction source | Allowed factions | AI behavior | Prediction behavior | Replay/branch behavior | Tests or checks |
|---|---|---|---|---|---|---|
| Normal lobby start | LobbyPlayer.factionId and PlayerInit.faction_id, defaulted by lobby::faction_validation | Product selector exposes kriegsia and cultivators; internal explicit ekat remains accepted; fixture and unknown ids reject | No AI assignment by setFaction; AI seats are separate | Enabled only for local Kriegsia when build/version metadata is compatible | Schema 2 records player faction id plus per-player loadout record | tests/faction_integration.mjs, tests/prediction_controller.mjs, server/src/lobby/faction_validation.rs tests |
| AI add/remove/start | AI PlayerInit.faction_id, derived from the seat’s profile by rts_ai::live_profile_faction_id and lobby::faction_validation | Public AI seats default to kriegsia; no public Ekat selector; a profile may lock its seats to another playable faction | Each profile plays its own faction; no faction selector in public lobby controls | Not applicable | Schema 2 records AI faction and per-player loadout if match starts | tests/ai_integration.mjs, tests/server_integration.mjs |
| Fixture/dev faction start | Explicit Rust test/dev harness only | phase2_empty_fixture only in TestFixture validation or direct lower-level tests; playable catalogs reject in fixture-only context | Rejected unless a later phase explicitly adds fixture AI | Disabled when local fixture player is unsupported | Fixture ids stay in explicit test artifacts only | server/crates/sim/src/game/setup/tests.rs, tests/prediction_controller.mjs, scripts/check-faction-assumptions.mjs |
| Replay playback | ReplayArtifactV1.players[].faction_id and playerLoadouts[] in artifact schema 3 | Recorded playable ids kriegsia or ekat; missing, unknown, and fixture ids reject | From artifact only | Disabled for replay viewers | Schema 3 restores a checkpoint-backed start state; schema 2 and older artifacts reject; never lobby state | server/crates/sim/src/game/replay.rs tests, server/src/lobby/room_task.rs replay tests |
| Replay branch staging/launch | Branch seed seats copy recorded factionId from replay players | Recorded playable ids kriegsia or ekat; unsupported seat faction ids reject before live launch | From recorded branch seed only | Disabled unless supported by branch schema/WASM | Reconstruct from branch seed and cloned keyframe | server/src/lobby/room_task.rs tests, tests/protocol_parity.mjs |
| Dev scenarios | Scenario definition plus validation/defaulting | Current bundled scenarios default to Kriegsia; explicit playable ids may be accepted by an owning scenario | Not applicable unless scenario declares AI | Enabled only for local Kriegsia | Not replayed unless scenario recording exists | server/crates/sim/src/game/setup/dev_scenarios/tests.rs, docs/context/testing.md |
| Self-play | Self-play PlayerInit.faction_id, validated by lobby::faction_validation; profile matchups use rts_ai::live_profile_faction_id | Current bundled self-play defaults to Kriegsia; a faction-locked profile plays its locked faction; explicit Ekat needs a self-play script that owns it | Each profile matchup side plays its profile’s faction | Not applicable | Artifact schema 3 records a checkpoint-backed start plus faction ids and per-player loadouts | server/crates/ai/src/selfplay tests |
| Match history replay | Stored schema-3 match artifact | Recorded playable ids kriegsia or ekat; missing, unknown, and fixture ids reject | From artifact only | Disabled for replay viewers | Load from persisted schema 3; schema 2 and older artifacts are incompatible | server/src/main.rs replay compatibility tests, docs/design/match-history.md |
| Spectator/no-fog view | Live match start payload or replay schema | Match factions from start/replay metadata | Not applicable | Disabled | Preserve recorded faction metadata | tests/server_integration.mjs |
| Post-match replay | Captured schema-3 match artifact | Recorded playable ids kriegsia or ekat; missing, unknown, and fixture ids reject | From artifact only | Disabled for replay viewers | Load from captured checkpoint-backed start state with command log | tests/server_integration.mjs |
Current Guardrail Checks
scripts/check-faction-assumptions.mjsvalidates this inventory’s anchors and ratchets the current files that may contain direct current-faction kind or ability special cases.server/crates/rules/src/defs.rstests lock the current production catalog.server/crates/sim/src/game/setup/tests.rslocks the current standard and fixture start loadouts.tests/protocol_parity.mjslocks protocol kind, ability, upgrade, compact snapshot, and resource code parity.tests/hud_command_card.mjslocks representative current command-card descriptors.node scripts/check-faction-catalog-parity.mjscompares every client-exposed catalog with the Rust dump across catalog ids, loadout ids, train and research keys, builder/gatherer/production anchors, ability command-card metadata, costs, and playable selector ids. It verifies that all Rust catalogs are dumpable, that fixture and reserved catalogs stay mirrored, and that Ekat, fixture, and future catalogs are not exposed as normal lobby options. Every real-faction descriptor exposed inclient/src/config.jsmust be compared against the Rust dump by this gate.
Guardrail Map For Future Faction Work
When faction behavior changes, update the owning source and its guard in the same change:
- Faction catalog facts, loadouts, and ability availability: update
server/crates/rules/src/faction.rs, the Rust catalog dump,client/src/config.js, andscripts/check-faction-catalog-parity.mjs. - Lifecycle admission for lobby, AI, replay, branch, dev scenario, self-play, match
history, and fixture contexts: update
server/src/lobby/faction_validation.rs, this inventory’s lifecycle table, and focused server or Node tests for the touched path. - Wire vocabulary, payload fields, compact codes, default ids, and replay schema shape: update
server/crates/protocol/src/lib.rs,server/src/protocol.rsif it adapts the payload,client/src/protocol.js,docs/design/protocol.md, andtests/protocol_parity.mjs. - Client command cards, hotkeys, UI faction selectors, prediction compatibility, and client-visible
mirrors: update the relevant
client/src/*module,docs/design/client-ui.md,tests/hud_command_card.mjs,tests/hotkey_profiles.mjs,tests/client_contracts.mjs, ortests/prediction_controller.mjsas applicable. - Server simulation starts, loadouts, setup helpers, AI scripts, self-play artifacts, and replay
reconstruction: update
docs/design/server-sim.mdplus the focused Rust tests under the touched crate. - Guard wiring: keep
tests/run-all.sh,tests/select-suites.mjs, anddocs/design/testing.mdaligned so faction-sensitive files select the assumption checker and catalog parity checker. - Archive policy: archived plans under
plans/archive/faction/*are evidence only. Do not import lifecycle policy, status tables, checker allowlists, or source paths from archived plan files; copy any still-current rule into this inventory or another active design doc before using it.