4. JS client — modules & exported APIs
Preferred color appears as the final row of the Game settings tab in lobby and match contexts, with the label and swatch dropdown on one line. Choices are No preference plus the eight server palette colors; arbitrary colors are unsupported. The browser stores the preference and sends setPreferredColor after each join or a setting change. Changes during countdown, a match, or its post-match replay apply when the room returns to the lobby or the player joins another lobby. The dropdown supports keyboard navigation and tears down its document listener with the settings panel.
client/ (ES modules, no bundler; index.html imports src/main.js as a module).
PixiJS v8.19.0 is pinned to its CDN ESM build and imported only by the Pixi render module worker.
The worker uses the native async Application.init({preference:"webgl"}) lifecycle after receiving
the sole visible transferred canvas. The production backend bundle creates the existing
orthographic semantic camera and asynchronous Pixi worker host for live play, Lab, spectators, and
replays. Match owns the only animation-frame loop.
index.html # PINNED — #app + module entry + screens markup; no main-thread Pixi script
styles.css # HUD, lobby, menus, command card
hud_command.css # Command-card ability status, cooldown clocks/countdowns, and Dao choices
lobby_map_selector.css # Custom lobby map picker layout and responsive preview popover
live_pause.css # live-match pause overlay and actions
assets/decals/ # SVG decal source art plus generated worker-decodable PNG mask atlas
src/
protocol.js # PINNED — message tag constants + builder helpers (mirror of §2)
config.js # PINNED — stable public facade for render/UI constants and balance mirrors
config/ # timing.js, presentation.js, rules_mirror.js, factions.js
net.js # Net: WebSocket wrapper, typed send helpers, event emitter
snapshot_stream_net.js # Offline static snapshot-frame clock using Net's normal decoder/events
stress_test.js # App-owned shareable Hellhole benchmark lifecycle and result UI
stress_test_profile.js # Pure JS Self-Profiling trace analysis and SVG flame graph rendering
stress_test_launch.js # Bounded /stress-test route/query parser
report_window_aggregate.js # bounded rolling-window aggregation helper for telemetry reports
prediction_controller.js # PredictionController: local command sequence/buffer bookkeeping
prediction_runtime_startup.js # WASM runtime readiness and latest-snapshot catch-up
prediction_compatibility.js # server/client prediction-build compatibility guard
prediction_frame.js # allowlisted composition of sparse owned pose/progress prediction patches
prediction_settings.js # localStorage-backed prediction toggle
unit_range_settings.js # localStorage-backed selected-unit range overlay toggle
health_bar_settings.js # localStorage-backed always-show HP-bar toggle (damaged-only by default)
unit_shadow_settings.js # localStorage-backed detailed-unit-shadow toggle (on by default)
experimental_graphics_settings.js # opt-in directional Rifleman graphics (off by default)
sim_wasm_adapter.js # optional WASM prediction adapter
state.js # GameState: holds prev+current snapshot, selection, control groups, display overlays
state_runtime_reset.js # shared clearing of state derived from one authoritative timeline
state_auto_build.js # authoritative Auto-Build snapshot normalization and command acknowledgement
state_ground_decals.js # authoritative ground-decal revision/cache, normalization, repaint queue, building-footprint sizing
match_ground_decal_sync.js # snapshot-revision repair requests, retry coalescing, seek/view reset
client_intent.js # ClientIntent: browser-local placement, command targeting, lab tools, previews, feedback
command_interaction.js # shared Input/HUD/Minimap command issue-and-planned-order recording
command_budget.js # client mirror of command-supply selection admission and outgoing command guard
camera.js # Camera: pan/zoom, world<->screen transforms, edge/keyboard/pointer-lock scroll
auto_spectator.js # spectator/replay battle director: tick-paced combat clustering and camera framing
spectator_controls_panel.js # floating live-spectator/replay camera and all-unit range controls
ai_diagnostics_panel.js # opt-in recorded AI rule tree, independent move/collapse preferences
match_auto_spectator.js # Match availability, camera-limit, and director-construction wiring
renderer/ # Pixi app facade plus layers, terrain, entities, units, buildings,
# decals, resources, fog overlay, feedback, rig schema/import, and renderer-local palette helpers
renderer/pixi_worker_host.js # sole main-thread Pixi surface: bounded queue, lifecycle, capture, diagnostics
renderer/pixi_render_worker.js # sole Pixi runtime/Application owner and WebGL presentation task
renderer/worker_environment.js # minimal OffscreenCanvas Pixi DOM adapter; no event/accessibility systems
renderer/worker_rehydration.js # revisioned map/grid/decal worker-owned staging
renderer/map_editor_worker_renderer.js # Map Editor Pixi display objects behind the same worker
renderer/decals.js # GroundDecalLayer permanent decal texture, stamping, diagnostics, teardown
renderer/tank_tread_layer.js # approximate authoritative history plus precise visible-tank tracks
renderer/decals/ # SVG source manifest, generated PNG atlas metadata, worker-safe loader, deterministic selection
renderer/trenches.js # Authoritative trench terrain pass and deterministic nearby-trench connectors
renderer/feedback_view_model.js # Builder for renderer feedback's narrow per-frame read model
renderer/lab_tool_preview.js # Armed Lab unit/remove-tool cursor ghosts
renderer/lab_ruler_overlay.js # Persistent Lab tile ruler geometry and screen-readable labels
fog.js # Fog overlay: apply authoritative visible/explored grids; local stamping fallback
input/ # lifecycle facade plus selection, commands, placement, shared camera navigation, UI input routing
audio.js # Audio: Web Audio context, buses, one-shots
audio_spatial.js # renderer-neutral distance, pan, low-pass, and priority profiles
sound_manifest.js # Stable sound ids and asset URLs
hud.js # HUD: resources/supply bar, minimap status row, selected panel, command card
hud_command_card.js # Command-card descriptors, faction command ids, and grid hotkeys
hud_train_card_helpers.js # Train/research command-card slotting, affordability, and one-unit limits
hud_selection_panel.js # Selected-unit strip/details panel
hud_unit_commands.js # Unit tactical command descriptors
hotkey_profiles.js # Local hotkey presets, custom profile storage, import/export
hotkey_editor.js # Settings Hotkeys tab editor
tab_menu.js # hold-Tab Auto-Build controls with optimistic state through authoritative acknowledgement
chat_overlay.js # App-owned docked lobby chat plus game direct-text overlay
resource_icons.js # Shared DOM resource icon helpers for HUD and observer analysis
minimap.js # Minimap: draw terrain+entities+viewport; click to move camera/command
minimap_road_layer.js # Cached post-fog dotted road-marking overlay
minimap_forest_layer.js # Cached pre-fog foliage-centered tree-symbol overlay
lobby.js # Lobby screen controller: browser polling, joins, ready/start, host controls
lobby_map_selector.js # Host map picker: minimap previews, creator credits, keyboard navigation
lobby_browser_view.js # Pre-join lobby browser rows, state rendering, and age/status formatting
lobby_view.js # Lobby roster renderer: stacked teams, compact seat rows, spectators
match_history.js # Lobby match-history table and replay launch affordance
scoreboard.js # Shared score/result formatting helpers
status_badge.js # Compact network/frame status badge
observer_analysis_army_value.js # viewport combat-unit value calculation
observer_analysis_overlay.js # replay/live spectator analysis overlay
observer_analysis_preferences.js # persisted observer analysis tab/visibility/window preferences
observer_analysis_research.js # completed-research tab renderer for observer analysis
observer_analysis_resources.js # resources tab renderer and wire normalization for observer analysis
observer_analysis_rows.js # observer analysis player row metadata joiner
floating_panel_positioner.js # shared app-shell move-only panel interaction and placement
observer_analysis_signatures.js # dirty-body signatures for observer analysis DOM updates
match_observer_diagnostics.js # Match-owned resource/loss observer analysis composer
client_perf_report.js # bounded client frame-profiler upload field shaping
match_health.js # match network/render health reporter
client_performance_window.js # bounded minute frame-gap histogram, independent of exceptional reports
frame_profiler.js # bounded client frame phase profiler and debug summary API
live_pause_overlay.js # live-match pause state overlay and unpause affordance
branch_staging.js # replay branch staging panel
lab_catalog.js # LabCatalogScreen: app-owned `/lab` setup/blank selector
interact_bridge.js # InteractBridge: launch-gated narrow local automation facade
interact_game_bridge.js # Isolated normal-match inspection/move/surrender/tab-menu automation facade
clean_presentation.js # app-shell reversible DOM chrome mode for Interact capture
lab_client.js # LabClient: lab request ids, pending results, state/result subscriptions
lab_scenario_authoring.js # pure lab setup metadata defaults, slugging, and local validation
lab_scenario_authoring_flow.js # LabPanel setup validation and JSON authoring orchestration
lab_panel.js # LabPanel: app-owned lab controls/status UI mounted around Match
lab_tool_detail.js # Pure armed-tool instruction text for LabPanel status
lab_panel_window.js # draggable/resizable chrome helper for the app-owned LabPanel
lab_control_policy.js # Lab control collaborator placeholder injected into Match
control_policy_projection.js # frozen read-only ownership/command-surface projection
visual_profiles.js # Lab-scoped visual experimentation profile registry and resolver
settings_container.js # Reusable settings shell: opener, tabs, focus, teardown
settings_panels.js # Portable settings tab panel descriptors
minimap_size_control.js # Persisted Game-tab minimap size preference; CSS fits both viewport axes
main.js # Entry point: starts App
app.js # Lobby/app shell lifecycle and persistent Net/Audio ownership
launch_url.js # Namespaced rtsLaunch URL parsing and pure lobby automation decisions
map_editor_app.js # Dedicated `/map-editor` lifecycle; never constructs Net, Match, or GameState
map_editor_minimap_preview.js # In-editor authoritative minimap hover and clipboard flow
map_editor_preview_button.js # Preview button hover/focus/click UI binding
map_editor_launch.js # Bounded editor route/handoff query parsing
map_editor_handoff.js # Short-lived HTTP map handoff create/consume client
map_preview_app.js # Capture-only authored-map route composed around existing renderers
map_preview_bridge.js # Bounded minimap-only PNG capture surface
map_editor_session.js # Flat authored-map state, undo/redo, and stroke transactions
map_authoring/ # Pure browser/Node geometry, symmetry, and serializable map operations shared by the editor and CLI
map_editor_panel.js # Dedicated editor controls for maps, terrain, start/base locations, JSON files, and Lab launch
map_editor_panel_workflow.js # Pure editor category/operation availability and current-tool labels
map_editor_terrain_palette.js # Cosmetic-ground and semantic-feature palette descriptors
map_editor_viewport.js # detached editor-presentation assembly plus editor-only pointer/keyboard input
map_editor_presentation.js # cloneable terrain/overlay/camera record consumed by the Pixi owner
map_editor_elevation_controls.js # elevation palette and tool arming
map_editor_sun_controls.js # always-enabled map sun sliders plus preview/commit behavior
match.js # Match lifecycle, module dependency wiring, render loop, transient events
match_startup_inbox.js # semantic buffering while asynchronous Match construction completes
match_combat_audio.js # Match-owned combat sound routing and machine-gunner sound cleanup
match_ability_audio.js # Visible Dao cast cues and authoritative Anchor sustain lifetime
match_notice_presenter.js # Match-owned existing-notice fanout and under-attack incident admission
match_room_time.js # authoritative room-time presentation clock and combat-audio synchronization
match_command_issuer.js # gameplay command gate, budget, prediction, and issue metrics
match_live_pause.js # live pause state actions and prediction visual suspension
match_net_reporter.js # Match ping cadence and client net-report upload collaborator
match_settings_context.js # Match settings action/tab context builder
frame_recovery.js # Frame-loop soft-failure logging and rescheduling diagnostics
visual_clock.js # Render-only normal/capture clocks; never used for networking, health, input, or timeouts
frame_entity_views.js # One-RAF entity view builder shared by render, fog, HUD, minimap, analysis
presentation/ # Frozen semantic layers, cloneable revisioned grids/projection data, static map, and frame assembly
replay_controls.js # Capability-driven RoomTimeControls plus replay-only vision/branch controls
replay_seek_notice.js # Shared replay-seek direction/duration notice formatting
replay_seek_overlay.js # Dismissible center-screen authoritative seek progress notice
room_time_panel.js # Floating, draggable chrome around shared room-time controls
room_capabilities.js # Client-side room capability parser for controls/diagnostics affordances
alerts.js # Notice/toast alert ids and viewport alert behavior constants
bootstrap.js # DOM lookup, ws/dev-watch/lab launch config, startup helpers
/map-editor is a separate frozen client session. main.js constructs MapEditorApp for that route,
so it never opens a WebSocket or constructs App, Match, GameState, Lab controls, fog, resources,
orders, replay controls, or a simulation clock. It reuses the normal worker-owned Pixi Renderer, terrain cache,
Camera, map schema, and player palette, but MapEditorViewport never constructs Pixi or reaches
into renderer layers/application state. Input, hit math, session edits, and camera stay on the main
thread; MapEditorPresentationV3 carries revisioned terrain replacement/patch data, complete
authoring-layer visibility, and detached grid, symmetry, start/base, selection, label, and
paint-preview records. The main-thread adapter owns
the stable transferred HTML canvas while the same Pixi module worker owns display objects, ordered
resize, present, and teardown. The removed
map-editor.html implementation and Lab-embedded editor are not compatibility routes.
4.1 Module export contracts
net.js
export class Net {
constructor(url, diagnostics?) // ws url; auto-derived from location in main.js
connect(): Promise<void>
on(type, handler) // type ∈ ServerMessage tags + "open"/"close"
off(type, handler)
join(name, room, spectator?, replayOk?)
setName(name) // update own display name while waiting in the lobby
ready(isReady)
start()
setTeamPreset(preset) // deprecated compatibility command; server ignores it
setTeam(id, teamId) // host-only scripted lobby team assignment
setFaction(factionId)
addAi(teamId?, aiProfileId?) // AI profile id
setAiProfile(id, aiProfileId) // AI profile id
removeAi(id)
setSpectator(spectator, id?)
chatSend(channel, text)
command(cmd, clientSeq) // lower-level sequenced gameplay command envelope
giveUp()
pauseGame()
unpauseGame()
returnToLobby()
ping()
netReport(report) -> bool // true only when WebSocket.send accepted the upload
createSnapshotReportStats()
consumeSnapshotReportStats()
noteSnapshotFrame({bytes, parseMs, decodeMs, snapshotCodec, snapshotCodecVersion, frameKind})
setRoomTimeSpeed(speed) // room-controlled replay/speed-only live/dev-scenario/lab time
stepRoomTime() // paused dev-scenario/lab room time
seekRoomTime(ticksBack) // room-controlled replay/lab time; pass huge N for full reset
seekRoomTimeTo(tick)
setVisionSelection(selection)
lab(requestId, op) // lab rooms only; request id allocated by LabClient
requestBranchFromTick()
claimBranchSeat(playerId)
releaseBranchSeat(playerId)
startBranch()
selectMap(map) // host map selection; capacity limits Add AI, spectator return, and the optional empty team target while preserving reassignment for same-team two-player lobbies
get playerId()
get bufferedAmount()
}
Net isolates each subscriber during dispatch. The first occurrence of a stable failure signature
(event type truncated to 64 characters, local weakly-held handler id, and Error or NonError
thrown-value class) is reported with console.error("[rts-net] subscriber failure", detail) and is
optionally mirrored to diagnostics. Each instance retains at most 32 signatures; the next distinct
failure emits one fixed saturation report and all later new signatures are suppressed. Reports
never inspect thrown-value properties or message payloads, survive reconnects for the lifetime of
the Net, and cannot prevent delivery to later subscribers even if console or diagnostics throws.
App owns one ChatOverlay for the lifetime of the socket and moves it between the joined-lobby
chat column and game overlay context. Lobby chat keeps an all-chat composer visible, retains at
most 50 messages only in the current browser while it remains in that room, and clears on room
change; the server neither persists nor includes lobby messages in replays. Replay branch staging
keeps lobby-scope chat in the floating, bounded, fading presentation because the ordinary lobby
screen and its chat dock are hidden. In game, Enter opens a
transparent single-line composer over the current screen; Enter sends and closes it, Escape
cancels, and Tab cycles team/all only when the local active player has at least one teammate.
Singleton-team 1v1/FFA players and spectators use all-chat. While the composer is focused, its
capture listener consumes those keys and marks the match input surface interactive so gameplay
hotkeys, the hold-Tab menu, camera input, and desktop cursor recapture do not compete with typing.
Reliable game deliveries render with textContent, keep at most six visible lines, and fade after
eight wall-clock seconds. Replay context is read-only; replay seeks clear the transient lines before
tick-timed messages resume.
prediction_controller.js
export class PredictionController {
constructor({sendCommand, predictor?, enabled, now?, commandTimeoutMs?, uiConfirmationSnapshots?})
issueCommand(cmd) // allocates clientSeq, records pending, calls sendCommand(cmd, seq)
applyAuthoritativeSnapshot(snapshot, {allowStale?}?)
// consumes snapshot.netStatus sim-consumption ack metadata
applySimAcknowledgement(clientSeq, serverTick?)
recordSocketReceipt(clientSeq, detail?)// diagnostic only; idempotent for duplicate receipts; does not reconcile
recordCommandRejection(clientSeq, reason?)
recordAckSnapshotApplied(clientSeq, snapshotReceivedAt)
enterPredicting(), beginResync(correction?), finishResync()
predictionDisplayOverlay() // view data for optimistic production/rally display only
reset({enabled?, preserveClientSeq?, reason?})
debugSummary() // pending count/seqs, latest authoritative tick, ack/correction metrics
consumeCommandReportStats(now?)
peekCommandReportStats(now?)
get pendingCommandCount()
}
Match composes one CommandInteraction from its command issuer, ClientIntent, and current
selected-entity snapshot. Input, HUD, and Minimap receive the same interaction and call
issueCommand(cmd, options?); it issues once and records a synchronous accepted result once for
planned-order feedback. Promise-returning Lab issue-as commands stay non-optimistic and record no
planned order. The controller owns browser-local clientSeq allocation and
passes the sequenced envelope to Net.command(cmd, clientSeq). Replay viewers, spectators, and
dev-watch passive viewers keep prediction disabled and do not allocate gameplay command sequence ids.
Resource quantities are server-owned last-known knowledge. GameState stores only the delivered
projection for display, replaces it on resourceReset, and otherwise applies changed quantities.
Neither visibility nor death effects infer depletion; seeks wait for a replacement snapshot instead
of restoring initial amounts. Observer changes replace resource knowledge in the same snapshot as
fog and remembered buildings. See protocol.md for checkpoint and transport semantics.
Match.create owns buffering before any asynchronous renderer work, including settling a warmed
renderer or disposing an incompatible preparation. App passes the preparation promise without
awaiting it. The startup inbox retains the newest complete entity/fog view, folds resource patches
by id, and preserves the most recent resourceReset plus subsequent changes. A reset discards all
pending resource rows from the previous projection. The handoff is consumed once and temporary
listeners are removed on success, failure, or stale startup. Memory is proportional to resource ids,
not the number of snapshots received while loading. Resource amounts remain server-authored; this
buffer only preserves delivery semantics.
GameState.applySnapshot remains authoritative. The partial WASM predictor returns a sparse
PredictionFrame whose entity patches may identify an existing locally owned entity and claim only
predicted position and an optional explicit motion presentation. Body facing remains authoritative
even when the predictor supplies a facing value. The predictor never returns an
EntityView, cannot create or replace entity identity, and cannot claim health, gameplay activity,
weapon facing, gathering, combat, ability, or future snapshot fields. A missing motion
claim preserves the authoritative gameplay state; a motion claim is admitted only when a modeled
pending local command owns that presentation transition. The compositor maps that claim onto the
frame-local display entity’s move/idle state for existing renderer and HUD consumers; it never
mutates the buffered authoritative entity, and no baseline-derived activity may produce the claim.
An owned worker with active build intent and a scaffold targetId is construction-locked in the
prediction baseline. Non-Shift movement and Hold Position replace its predicted future queue but
cannot claim movement or idle presentation until an authoritative snapshot releases construction.
Shift continues to append; Stop releases the lock immediately. A worker travelling to or waiting
at a build site has no scaffold target and remains interruptible. Local movement previews retain
the active construction marker and replace only its future markers for a non-Shift follow-up.
The same frame carries a separate progress array whose patches contain only an existing owned
building id, construction/production kind, active-item identity, and a normalized fraction. The
WASM runtime derives those claims from the latest authoritative owner baseline and Rust-authoritative
durations, samples the render clock at a fractional tick for smooth bars, and caps claims below
completion until the server confirms completion. The client admits a patch only while the current
authoritative building still has the same active identity and activity signal; a patch cannot create
an entity or alter queue, health, state, economy, or supply.
prediction_frame.js is the sole allowlisted compositor for both patch types. Rendering, current-state
UI reads, and entityById() start from the authoritative entity and apply the same compositor; they
never spread or substitute a predicted entity record. Prediction display writes go through
GameState.applyPredictionDisplayOverlay({optimisticCommands?, predictionFrame?, diagnostics?, smoothCorrections?, includePose?}), so controller bookkeeping and prediction patches stay outside
broad snapshot mutation. Progress is composed before train/rally optimism. Live pause clears pose but
retains the last frozen progress frame until the first post-unpause authoritative snapshot rebases the
WASM clock. The progress runtime is available in compatible active live-player matches independently
of the Movement Prediction preference and supported-pose faction list; replay and spectator views do
not predict progress. If WASM is loading or unavailable, authoritative progress is the fail-safe rather
than a second JavaScript calculator.
renderer/rigs/schema.js
export const RIG_SCHEMA_VERSION = 1
export const REQUIRED_ANCHORS = ["origin", "selection", "hp"]
export const TINT_SLOTS = [
"team", "team-light", "team-light-soft", "team-light-strong", "team-light-08",
"team-light-10", "team-light-14", "team-light-24", "team-stroke",
"team-fill-stroke", "neutral", "fixed",
]
export const GEOMETRY_TYPES = ["rect", "circle", "ellipse", "line", "polygon", "polyline", "path"]
export const ANIMATION_INPUTS = [
"now", "teamColor", "recoilProgress", "recoilPx", "recoilKickX", "recoilKickY",
"setupVisual", "vehicleMotion", "selected", "damaged", "shotRevealAlpha",
"visibility", "mapTileSize", "facing", "weaponFacing", "weaponFacingCos",
"weaponFacingSin", "weaponVisualFacing", "carriageVisualFacing",
"weaponVisualDoubleCos", "weaponVisualDoubleSin", "weaponRecoilX", "weaponRecoilY",
"scoutGunnerX", "scoutGunnerY", "scoutMountX", "scoutMountY", "setupVisible",
"setupMostlyDeployed", "setupBarrelVisible", "busy", "breakthroughTicks",
]
export const ANIMATION_PROPERTIES = [
"transform.x", "transform.y", "transform.rotation", "transform.scaleX", "transform.scaleY",
"transform.localX", "transform.localY", "geometry.scaleX", "geometry.scaleY",
"alpha", "visible", "tintSlot",
]
export function validateRigDefinition(definition, options?)
// Pure validator. Returns { ok: true, definition, errors: [] } or { ok: false, errors }.
// options.expectedKind rejects rigs whose kind does not match the importer/runtime caller.
Normalized rig definitions are plain objects with id, kind, schemaVersion, ordered parts,
semantic anchors, semantic bounds, optional animations, and requiredRuntimeInputs. Parts
use stable ids, integer drawOrder, normalized primitive geometry, local transform, pivot, one
tint slot, and optional normalized paint {fill, stroke, strokeWidth, opacity} for SVG-authored
literal colors. The validator is independent of Pixi and SVG DOM APIs; it fails closed with
path-addressed structured errors for missing required anchors, duplicate part ids, unsupported
geometry or transforms, non-finite coordinates, invalid tint slots or paint, invalid animation
bindings, and unit-kind mismatches.
renderer/rigs/svg_importer.js
export function compileSvgRig(svgText, metadata?)
// Pure SVG authoring importer. Returns validated normalized rig data or structured errors.
// metadata.id/kind may override the authored id/kind; metadata.expectedKind enforces callers.
The SVG importer accepts only the Phase 3 authored rig subset: root <svg> with viewBox,
data-rts-rig-kind, data-rts-rig-version="1", and data-rts-origin="center"; geometry elements
g, path, polygon, polyline, rect, circle, ellipse, line, and metadata; direct
hex fill/stroke, numeric stroke-width/opacity, data-rts-tint, data-rts-pivot, and
semicolon-separated data-rts-animation bindings. Part ids use part.*, anchors use anchor.*,
and bounds use bounds.*; required anchors remain origin, selection, and hp, with weapon
fixtures adding semantic anchors such as muzzle, bipod, or turret. The importer rejects
scripts, foreign objects, images/use/external hrefs, filters, masks, clip paths, gradients,
patterns, CSS classes or style attributes, percentage units, duplicate ids, lowercase or unsupported
path commands, non-finite values, and transforms that cannot decompose into translate/rotate/scale.
renderer/rigs/animation.js
export function createRigRenderContext(entity, options?)
export function sampleRigAnimation(definition, entity, renderContext?)
Rig animation sampling is pure data math: it derives a narrow render context from existing client
entity state and renderer-local visual state, then applies normalized animation bindings to part
transforms, alpha, visibility, and tint slots without creating Pixi objects. The sampler accepts
only the schema-approved runtime inputs such as facing, weaponFacing, recoilProgress,
setupVisual, vehicleMotion, Scout Car gunner/mount offsets, selected/damaged flags,
shot-reveal alpha, map tile size, worker busy state, breakthrough ticks, and oil cue flags.
renderer/rigs/runtime.js
export function createDefaultPixiFactory(pixi?)
export function createUnitRigInstance(kind, definition, pixiFactory?)
export function renderLiveUnitRig(renderer, entity, colorByOwner, state, definition, options?)
export class UnitRigInstance {
update(entity, renderContext)
destroy()
}
UnitRigInstance owns one Pixi container and one graphics child per normalized rig part, redraws
primitive geometry with sampled transforms and tint slots, and tears down all owned children through
destroy(). Live rig routing is per-kind through _liveRigDefinitionsByKind. Worker, Golem,
Command Car, and Ekat still compile authored SVG sources as raster metadata and fallback layers.
Command Car renders its body from a production PNG atlas while preserving SVG effects; Rifleman,
loaded Panzerfaust, Machine Gunner, Anti-Tank Gun, Mortar Team, Artillery, Scout Car, Scout Plane,
and Tank use
raster-native normalized metadata plus their production PNG frame strip or atlas. Missing rig
definitions and missing production PNG textures fail closed; raster units never fall back to a
duplicate SVG depiction. Shadow and body parts route through separate live pools so normal unit and
shot-reveal layer ordering stays intact.
Local lab visual profiles may supply per-entity unit rig overrides to Renderer.render through
visualUnitOverrides. The renderer resolves those rules against the current frame’s real unit
entities with local-only selectors, validates candidate ids through the checked-in
renderer/rigs/visual_override_rigs.js registry, and then passes the candidate rig definition
through the same renderLiveUnitRig runtime path. The checked-in registry is currently empty; the
generic compiler remains available for local experiments on SVG-authored units. Overrides never change entity.kind, snapshots,
selection ids, command targeting, HP bars, fog, minimap inputs, or scenario authoring data; broken
selectors or candidate rigs publish local diagnostics and fall back to the normal live rig for that
unit.
SVG unit art workflow:
- Author the SVG under the approved importer subset: root rig metadata, stable
part.*ids,anchor.*ids for at leastorigin,selection, andhp, semanticbounds.*, direct hex paint, approved tint slots, and schema-approveddata-rts-animationbindings. - Keep source SVGs mirrored by the checked-in runtime strings in
renderer/rigs/*_svg.jsand fixture SVGs intests/fixtures/svg/when a fixture is useful for importer/runtime tests. - Verify new or changed rigs with
node tests/rig_schema.mjs,node tests/svg_rig_importer.mjs,node tests/rig_runtime.mjs, andnode scripts/check-client-architecture.mjs. - Runtime contract changes are accepted through schema, importer, animation, renderer smoke, and architecture tests rather than static design previews.
Raster rig workflow:
- Three Dao Pavilion uses the approved circular-shrine PNG on its 3x3 footprint, with fixed-color
timber/stone/scrolls and a team-tinted canopy/finial.
scripts/art/pavilion-pipeline.mjsrebuilds the square two-frame atlas from its magenta source without changing the image aspect ratio. - Barbed wire uses the selected tangled-barrier PNG in a single fixed-color building part,
retaining neutral steel/wood colors, the one-tile footprint and native footprint shadow.
scripts/art/barbed-wire-pipeline.mjsrebuilds its chroma-keyed runtime texture from the checked-in magenta source; the building SVG remains its standard loading fallback. - Lab frame-strip previews may declare
suppressRocketRack: trueto hide the legacy overhead loaded-rocket overlay while displaying their own registered static rack. This is scoped to the active Lab override and does not change gameplay, projectile feedback, or normal routing. - PNG-backed units are defined by
renderer/rigs/raster_rig_definitions.js, frame-strip metadata, orrenderer/rigs/*_png_atlas.js, then routed throughpng_routing.js,png_runtime.js, and the shared rig animation sampler. Raster-native metadata owns anchors, animation bindings, semantic part ids, recoil, facing, shadows, effects, and route splits; frame strips may declare a base facing offset plus a firing-frame override when authored locomotion and attack poses use different forward axes. Cultivator combat strips retain the original character row and carry image-generated golden attack-effect cells in a second row (attackTrail). Their four-row team-color atlases add fixed-material and shaded paint layers (teamPaint.baseRow=2,teamPaint.paintRow=3,sheetRows=4) for every idle, movement and firing cell.team_paint.jscomposites those shared source layers into match-owned palette textures, cached by player color; ordinary batchable sprites then preserve skin, black hair, weapon metal, source alpha, fog/shot-reveal alpha and sunlight without a whole-body multiply. Neutral original cells still supply item bloom, and gold effects are unchanged. HUD and animated minimap icons compose the same fixed/paint rows with an alpha-preserving tint matrix. Match teardown destroys every cached palette.scripts/art/cultivator-team-color-pipeline.mjsaligns authored poses and packs both additional layers while retaining original rows byte for byte. Kriegsia Rifleman, Panzerfaust, Machine Gunner and Scout Plane strips, plus Tank, Scout Car, Rocket Truck, Artillery, Anti-Tank Gun and Mortar component atlases use the same fixed/paint contract.teamPaint.renderRows=1allocates only their composited character/component row; the existing Cultivator default remains two rows for independent attack effects. Atlas palette textures are cached by owner color just like strips and remain ordinary batched sprites. HUD portraits and animated minimap parts split the same component frames into fixed and paint layers while retaining sampled rig transforms. Mortar tubes receive paint; gunmetal, wood, skin, tan equipment, tires and tracks stay fixed. The Tank roof gun is packed as fixed artwork at its original attachment coordinates.scripts/art/kriegsia-team-color-pipeline.mjsreproducibly packs all original frame counts, alpha silhouettes and fixed muzzle tips from retained sources. The body uses the same palette throughout every pose; Novice adds six intermediate body and effect frames, while Magic Adept/Master gather hand-centered energy instead of weapon swooshes. Novice firing poses use a calibratedfiringWorldScaleand firing-origin overrides so their head size and world anchor match idle; the minimap applies the same scale correction. Magic effects render at twice the authored diameter, mapping measuredsourceCentersto per-frame handcentersso enlargement keeps the energy attached to the caster. The separate effect sprite stays gold, follows the same facing, lunge and recoil envelope, and is omitted from silhouette shadows. Attack state alone never starts a trail.scripts/art/cultivator-golden-pipeline.mjsreproducibly packs the checked-in effect sources while preserving original body cells and appending the new Novice poses. Workers have no combat trail. No SVG source or vector-art fallback exists for those units. Command-card and selection-panel portraits use an atlas’s assembled reference when available; setup-capable component-only atlases declare an explicit deployed composition so the UI shows the complete set-up silhouette, including support legs, instead of substituting different art. The current tank atlas is an enabled visual experiment, not final art: it uses the pass-11 white-painted Tiger I hull/body, turret/coax, and separate main-barrel cells while transparent track frames suppress track rendering. The separate barrel cell maps topart.barrel, so raster-native metadata keeps cannon recoil separate instead of merging that motion into the turret. The activepass11-white-dim30atlas is an imagegen repaint of pass 10; it keeps the no-guide semantic sheet, bakes 30% lower brightness and 20% lower saturation, relies on visible-alpha postprocessing plus explicit 1.2x world-scale compensation, and intentionally applies runtime team tint over the dimmed white base using the semantic atlas tint slots. Mortar Team rendering uses a generated three-cell M2 4.2-inch-inspired wheeled mortar sheet: assembled reference, team-tinted carriage/frame and tube/barrel assembly, plus fixed-color tire overlays. The carriage sprite follows the raster-native carriage recoil binding while the separate tube sprite follows the stronger weapon recoil binding. Packed, deploying, and deployed states use only the carriage, tires, and tube; the retired square base plate is no longer rendered. See raster-unit-art-handoff.md for the asset-authority boundary, production inventory, and validation contract. - Keep generated PNG sources, the production derivative, prompt, and manifest together under each
client/assets/rigs/unit directory. Retired SVG contact sheets and their generator are not part of the production asset contract. - Browser-facing rig PNGs use 8-bit channels and fit within a 2048x2048 texture ceiling, enforced
by
scripts/check-deploy-assets.mjs. Oversized generated sources may remain checked in beside a downsampled production derivative; runtime frame geometry and scale preserve world-space size.
renderer/feedback_view_model.js
export function buildRendererFeedbackView(state, options?)
// Per-frame read model builder. Returns placement, command feedback,
// selected entities, resource mining previews, support-weapon previews,
// ability target previews, ability objects, smokes, transient projectile/
// target markers, relationship helpers, and entity lookup for renderer
// feedback drawing without exposing the full mutable GameState. `options`
// may inject frame-local entities and selectedEntities arrays.
state_ground_decals.js
export class GroundDecalBuffer {
applyAuthoritativeBatch(message, context)
reconcilePending() // stage shared pre-assembly batch used by Match
acknowledgeReconciled() // release it after a successful backend frame
consumePending()
requeueAuthoritative() // repaint retained records after renderer reset
get pendingCount()
clear()
}
export function normalizeAuthoritativeGroundDecal(record, context?)
Snapshots advertise the requesting perspective’s groundDecalRevision and repeat a fog-safe,
64-revision groundDecalDelta { afterRevision, decals } tail. GroundDecalSync applies a
contiguous or overlapping tail immediately; stable ids deduplicate repeats, and the buffer retains
pending rows across skipped or failed presentation frames. A forward gap may queue the entitled
rows for immediate display but cannot advance the complete cache cursor. In that case
GroundDecalSync coalesces the mismatch into one reliable
requestGroundDecals { requestId, afterRevision } repair and retries with bounded backoff. A later
covering snapshot tail cancels an obsolete outstanding repair. The echoed repair request id rejects
delayed responses from a prior replay tick or vision perspective. Replay seeks clear both the cache
and painted presentation. Observer-view changes clear the authoritative cache but keep the old
painted surface visible while a hidden replacement resynchronizes from revision zero. Possibly
pre-reset inline tails remain blocked until a correlated repair establishes replacement authority.
The worker hydrates the hidden surface in bounded batches across ordinary presentations, then swaps
it atomically; an empty correlated repair publishes a clean replacement explicitly.
Transient combat events still drive short-lived
effects and audio, but are not used to create permanent decals.
renderer/decals.js
export const GROUND_DECAL_TEXTURE_WORLD_SCALE
export class GroundDecalLayer {
resetForMap(map)
beginPerspectiveTransition(map)
completePerspectiveTransition()
stampBatch(decals, options?)
displayObjectCount()
diagnostics()
destroy()
}
GroundDecalLayer normally owns one downsampled OffscreenCanvas-backed Pixi texture and one sprite
on the decals world layer. Its persistent canvas is clipped to non-water tiles at map reset,
so ground marks (including shoreline blast footprints) never paint water. During an observer-perspective repair it temporarily retains the old
visible surface and hydrates a hidden replacement in batches of at most 48 durable records per
presented frame. Completion atomically adopts the replacement and destroys the old surface; a
newer reset cancels only the unfinished replacement. A ready decal atlas transfers to the hidden
surface rather than being fetched and decoded again. SVG files remain source art;
scripts/generate-ground-decal-atlas.mjs creates
the checked-in ground-decals-v1.png plus deterministic rect metadata, and runtime loads that one
PNG through fetch/createImageBitmap. New visible death and impact decals stamp from those rects;
an unavailable or failed atlas remains a reported blocking asset error and never silently chooses a
procedural replacement. Historical decals are retained as normalized records in GameState for
rehydration but are not retained display objects or iterated during ordinary frames. diagnostics()
exposes total stamped decals, queued decals, texture update
count, texture dimensions/downsample, child count, and asset-load status for stress checks. The
renderer tears down the decal sprite, texture, canvas, tint scratch canvas, loaded atlas masks, and
late async asset loads through Renderer.destroy() / rematch cleanup.
renderer/tank_tread_layer.js
export class TankTreadLayer {
resetForMap(map)
stampVisibleTankPoses(entities)
stampAuthoritativeTrails(trails)
revealAuthoritativeTrails(fog)
diagnostics()
destroy()
}
TankTreadLayer paints approximate checkpointed trail history learned through the normal durable
ground-mark discovery cursor. It derives precise live tracks for every tank currently present in
the client’s fog-filtered entity snapshots, using its x/y/facing poses; those client-retained
pixels are presentation state rather than historical server authority. Reconnects, replay seeks,
and later visits to previously fogged ground rebuild a coarser but directionally representative
version from server trail chunks. Received chunks are cached as geometry first: each render pass
permanently stamps only the 32-world-pixel map tiles that current authoritative fog marks visible,
using a hard canvas clip so the reveal ends exactly at tile boundaries. A chunk can therefore be
present in client memory before all of its pixels are eligible to appear. The exact set of
client-stamped tiles is presentation state and is not separately checkpointed by the server.
Pending historical geometry is reconsidered only when fog visibility changes or a new chunk
arrives, and each stamped tile bucket is discarded immediately instead of being rescanned for the
rest of the match.
Pixels persist in lazily allocated 512-world-pixel tiles (256×256 texels); only touched tiles
upload, and all tile canvases/textures/sprites are destroyed with the ground-decal layer. Preview
contact poses are accumulated between bounded 10 Hz uploads; the swept-contact raster fills the
complete intervening motion. Tread pigment is deliberately faint, and every live or later-discovered
trail excludes road-tile pixels so paved surfaces never retain tank tracks. Historical road-only
tile buckets are discarded before rasterization; live cross-boundary stamps clear their road area.
The opt-in Lab profile grass-survey-12 prototypes grass pressure in
renderer/grass_matting.js. It sweeps visible ground-unit motion into a bounded RGBA mask;
foot-unit traffic accumulates into soft gray-brown soil patches, reaching clear wear around
20 passages over the same ground. Vehicles do not contribute; tank dirt tracks keep their existing
renderer. The shader thins worn grass and reduces sway. Normal matches still use
profile 9 and allocate no pressure mask. This experiment has no replay/seek/reconnect persistence
or perspective cache and must not be enabled in normal matches until authoritative history and
fog-safe replacement are implemented. See grass matting investigation.
renderer/trenches.js
export function normalizedTrenches(trenches, tileSize?)
export function _drawTrenches(state)
_drawTrenches renders the latest authoritative state.trenches into one persistent Pixi
Graphics object on the trenches world layer. It clears and redraws that object each frame,
skips malformed records, and draws deterministic connectors between nearby trench footprints so
clustered neutral trenches read as continuous ground without allocating per-trench display objects.
Renderer.destroy() removes and destroys the trench graphics object during rematch teardown.
branch_staging.js
export class BranchStaging {
constructor(rootEl, net)
show()
hide()
destroy()
render(msg) // branchStaging payload
}
observer_analysis_overlay.js
export const OBSERVER_ANALYSIS_TABS
shouldMountObserverAnalysisOverlay({ capabilities })
createObserverAnalysisOverlayPreferences(storage?)
export class ObserverAnalysisOverlay {
constructor({ root, preferences, getEntities, getCameraBounds, getPlayers, stats })
applyObserverAnalysis(payload) // renders server-backed production, research, unit, and losses tabs
update(frameViews?) // refreshes viewport army value from camera/snapshot state
destroy()
}
App owns one observer analysis preference object and passes it through replay and live spectator
Match lifetimes so selected tab, visible state, and collapsed state survive in-place replay seeks
and spectator rematches. Preferences are stored under
rts.observerAnalysisOverlay; clients still read the old rts.replayAnalysisOverlay key for
compatibility. Its titlebar is draggable, keyboard-nudgeable, viewport-clamped, and retains its
desktop placement through replay seeks and spectator rematches; Home restores the default
placement. Coarse-pointer layouts also support viewport-clamped titlebar dragging without writing
their temporary placement over the saved desktop position. Analysis buttons activate directly on
touch release and suppress the synthesized compatibility click. The overlay owns its generated DOM
and is read-only. The Army Value tab is client-side and viewport-specific, excludes economy workers
(Engineer and Golem), and counts only combat units. Production, Research, Units, Resources, Alive
Resources, Losses, and Resources Lost render the latest server-authored observerAnalysis
payload. For two to four players, Resources also samples each player’s server-authored lifetime
mined totals once per second and derives trailing 5-second collection totals, displayed divided by five as a per-second average with /s in each chart heading. Three- and four-player matches render one color-coded line per player with a name legend and a shared numeric Y scale for each resource, including negative alive values. Exactly two players retain the advantage view, which renders
divergent steel and oil area charts. The first player leads above the
center line and the second leads below it. Each resource uses a symmetric minimum Y extent equal
to one fully extracting base per second (18 Steel/s or 4.5 Oil/s). Backward replay seeks
truncate future samples before rebuilding the timeline. Alive Resources subtracts destroyed-unit and destroyed-building steel/oil value from
lifetime mined resources; because starting resources are not lifetime mined income, the derived
value can be negative. For 1v1s it also renders steel and oil advantage charts using that
lifetime-minus-loss difference, with a symmetric Y extent fitted to the history. Resources Lost uses the cumulative destroyed-value difference, and Units uses the summed steel/oil
value of current units (including economy units, excluding buildings). These four tabs share one
metric-configured chart renderer and sample history. Positive destroyed value means more losses,
not a better position. All four tabs use
reliable server-authored one-second replay samples, replaced on join and seek; live spectators
accumulate samples from observer analysis. History arrival invalidates each tab independently
of the latest analysis payload.
Research groups
completed permanent upgrades by player, retaining an explicit empty row when a player has
completed none. The Losses tab lists destroyed units and buildings by kind, including zero-cost
Steel Mines and Pump Jacks. Resources Lost uses the same panel width and chart dimensions as Resources and Alive Resources, with its definition in a tooltip instead of a heading and paragraph. Resources Lost is the spent steel/oil value of units and buildings that
died, excluding stockpile changes, harvesting, refunds, and cancelled queues.
match_observer_diagnostics.js owns the ordinary observer analysis overlay for Match,
forwards resource and replay-history updates, and centralizes teardown. AI decisions are announced
through ordinary all-chat; there is no dedicated AI diagnostics panel or AI map-analysis overlay.
frame_entity_views.js
buildFrameEntityViews(state, { alpha }) // frozen SharedFrameContextV1 outer record with frame-local entity arrays
state.entityVariants(alpha) // render/current/authoritative arrays in one source traversal
frame_recovery.js builds this object once per requestAnimationFrame after prediction display has
advanced and before fog, renderer, HUD, minimap, and observer analysis run. The object is not
authoritative state and must not be retained after the frame; it exists only to share common
entity variants and selectedEntities() results across frame consumers. Production GameState
builds the render-alpha predicted view, alpha-1 predicted view, and alpha-1 authoritative view in
one _cur.entities traversal; GameState-compatible test doubles retain the truthful
entitiesInterpolated() fallback.
interpolatedEntities uses the render alpha and prediction display for the Pixi renderer,
currentEntities uses the latest predicted display positions for minimap blips and HUD tech
checks, authoritativeEntities uses latest no-prediction positions for local fog-source filtering
and observer Army Value rows, and fogSourceEntities removes shot-reveal/vision-only entries plus
non-vision neutral resources.
presentation/entity_snapshot.js prepares an aligned, frame-local entry for each interpolated
entity. Each entry contains the complete detached/frozen selection interaction and a narrower
admitted presentation sidecar certified against the renderer schema during the same graph walk.
Presentation and selection consume entries by array position, never by id, so duplicate order is
preserved. The sidecar and source reference die with the frame; only the interaction may outlive
it through the last successfully published selection scene. Standalone callers and remembered
buildings keep their legacy detachment fallback.
presentation/layers.js, presentation/grid_snapshot.js, and presentation/frame.js
PRESENTATION_LAYER_DESCRIPTORS // exact frozen back-to-front semantic descriptors
createGridSnapshot(input) // source-detached cloneable revisioned Uint8Array record
new PresentationFrameAssembler({map, generation?, entityStats?})
assembler.staticMap // StaticMapPresentationV2, rebuilt only on map revision/reset
assembler.assemble(inputs) // one structured-cloneable frozen PresentationFrameV2
assembler.reset({map, generation?}) // replay/Lab/rematch generation reset seam
frame_recovery.js updates authoritative fog before it assembles this sidecar. It samples one
projection, one visual time, one renderer feedback view, and one observer/screen-overlay model for
the frame; the same projection drives SelectionSceneV1. Match then makes exactly one
renderer.render(presentationFrame) call. PixiWorkerPresentationAdapter copies and transfers the
revisioned map/grid/durable lifetimes and keeps one in-flight plus one latest pending frame. The
worker-owned PixiPresentationAdapter reconstructs only its ratcheted frame-local compatibility
facade, updates Pixi-owned staging, and times that work separately from exactly one actual
app.render(). The outer main-thread match.renderer phase covers submission only; worker update
and present timings are returned in the acknowledgment and exposed in worker diagnostics. The
Match-owned network reporter samples those lifecycle diagnostics, uploads new terminal failures
immediately, and includes in-flight age plus bounded WebGL/Pixi/error context in periodic reports
so deployed black-screen incidents are recoverable from server logs. The Match-owned
PresentationCoordinator keeps pending selection/decal metadata keyed by generation and frame id.
The worker reports durable decal retention independently, and only an asynchronous matching
presented outcome advances the displayed counter or publishes selection; failed/superseded frames
preserve the prior scene. The Pixi worker does not own an animation loop.
The sidecar contains no mutable state/intent,
selection proxy, mutable typed array, Pixi object, or transport record. Static terrain/resource
locations are separately revisioned; visible/explored grids reuse opaque snapshots by revision.
settings_container.js
export class SettingsContainer {
constructor({ button, menu, title?, onOpenChange? })
setContext({ kind, spectator, replay, actions, tabs }) // mounts context-specific tabs/actions
setTabs(tabs) // [{id,label,visible,render(panel, context)}]
open({ focus }), close({ restoreFocus }), toggle()
isOpen()
activateTab(id)
destroy()
}
settings_panels.js
buildSettingsTabs({ audio, hotkeyProfiles, game, debug })
buildGiveUpAction({ visible, onOpen })
buildPauseAction({ visible, disabled, label, title, onPause })
match_cursor_capture.js owns the focused policy that pauses aggressive desktop cursor capture
while Settings or the hold-Tab menu is interactive and schedules recapture after the last menu
closes. Match remains the lifecycle owner and thin delegator.
live_pause_overlay.js
export class LivePauseOverlay {
constructor({ root, settingsRoot?, onUnpause, onOpenSettings?, playerNameForId? })
applyLivePauseState(state)
destroy()
}
replay_controls.js
export class RoomTimeControls {
constructor({ net, state, replayViewer?, capabilities, label? })
applyRoomTimeState(state)
noteSnapshotTick(tick)
stopSeekingAndPause()
destroy()
}
export class ReplayControls extends RoomTimeControls
RoomTimeControls renders pause/resume, speed, step, relative seek, absolute timeline seek, tick
status, and keyframe marks only from capabilities.roomTime. The AI-only live route advertises the
speed-only room-time profile, so the same component renders no seek, step, or timeline affordance
for those rooms. Paused replay viewers can advance exactly one simulation tick with the shared step
control. Replay viewers also get a local Hide end time checkbox that removes the total
tick count and absolute timeline for spoiler-free commentary while retaining the current tick and
playback speed. Replay fog-perspective controls and the replay-branch button remain gated by
replay-specific visibility/action capabilities, not by lab or URL identity.
The app shell listens for reliable roomTimeSeekStarted broadcasts throughout replay playback,
clears replay timeline-derived state in place without reconstructing Match or its renderer, and
shows every viewer a Seeking forward/backward X seconds… notice. Authoritative
roomTimeState.seek metadata owns the continuing progress lifecycle. During that lifecycle, a
dismissible center-screen Seeking notice in the title typeface distinguishes reconstruction from
ordinary fast playback; each new seek shows it again. Its Stop seeking action cancels
reconstruction at the latest authoritative tick and pauses replay playback. Sampled snapshots
advance the existing timeline and growing keyframe marks until a state omits seek.
Async Match.create startup uses semantic latest-only inbox slots for snapshots, room-time state,
live-pause state, and observer analysis, plus a bounded ordered command-receipt queue. High-rate
snapshot or observer-analysis traffic therefore cannot evict one-shot control authority while the
renderer initializes. Room-time pending/awaiting state disables only clock actions; replay vision
selection remains independent and usable.
The shared control surface is the dom.roomTimeControls root (#room-time-controls). Static
pause/step controls use .room-time-pause-btn and .room-time-step-btn; generated room-time status
and timeline markup use .room-time-tick-status and .room-time-timeline* selectors. The exported
ReplayControls alias remains only for existing replay imports while composition should construct
RoomTimeControls for any room that advertises room-time capabilities.
room_capabilities.js
createRoomCapabilities({ startPayload })
Match and app-shell controls consume this parsed startPayload.capabilities and
startPayload.diagnostics record for room-time controls, diagnostic settings, observer analysis,
vision-selection controls, live pause controls, replay branch actions, and read-only/gameplay command
affordances. Product shells may still use product metadata for launch/routing and owned controls
such as lab setup tools, but shared affordances must not be inferred from replay/dev/lab
identity.
lab_client.js
export class LabClient {
constructor(net, options?)
setInitialState(state)
subscribeState(handler) // returns unsubscribe
subscribeResult(handler) // returns unsubscribe
setVision(vision) // sends {op:"setVision", vision} for this operator only
setPlayerGodMode(playerId, enabled) // sends {op:"setPlayerGodMode", playerId, enabled}
exportMap() // authoritative map-only editor transition payload
exportScenario(name?) // compatibility wire name for checkpoint setup export
importScenario(scenario) // compatibility wire name for checkpoint/legacy setup import
validateScenario(metadata) // sends {op:"validateScenario", metadata}
resetScenario() // seeks lab room time to the current setup baseline
request(op, options?) // allocates requestId, resolves with labResult/timeout
destroy()
}
export function labVisionLabel(vision)
export const labVision // all(), team(teamId)
lab_catalog.js
export function normalizeLabScenarioEntry(entry)
export class LabCatalogScreen {
constructor({ root, fetchImpl?, initialRoom?, onStart })
mount() // fetches GET /api/lab-scenarios and renders choices
setConnected(connected)
setStatus(status, options?)
}
LabCatalogScreen is app-owned and used only for the bare /lab route. It renders a blank lab row
plus bundled checkpoint setup metadata from GET /api/lab-scenarios; clicking a row builds the existing
hidden __lab__:<room>:map=<map>:scenario=<id> join room, replaces the catalog URL with the
corresponding direct scenario URL, and lets App start the normal lab flow. Keeping the scenario in
the visible URL makes catalog-launched blank and bundled Labs reloadable with Lab-scoped options such
as visualProfile.
Direct /lab?scenario=lategame, /lab?scenario=blank, map, and seed URLs still bypass the selector
and auto-join for compatibility.
interact_bridge.js
export const INTERACT_BRIDGE_KEY = "__rtsInteract"
export class InteractBridge {
status() // readiness or launch error; no internal references
call(method, input) // status/catalog/spawn/update/remove/order/time/inspect/select/camera/reset/presentation/captureReadiness
destroy()
}
export function interactLaunchEnabled(locationLike?)
App composes this bridge only when the /lab URL includes interact=lab. Its global surface is a
frozen {version, status, call} object; it never returns App, Match, Net, Renderer, or
GameState. Before readiness, server launch errors are projected as bounded status text so the
local driver fails immediately instead of waiting for its startup deadline. Calls delegate through
existing LabClient, normal issueCommandAs, room-time,
semantic camera, and GameState projection seams. Catalog includes the mirrored command and ability ids;
inspection can restrict results to the current camera viewport, while camera focus accepts bounded
padding, defaults to a close 32-world-pixel frame for readable single-unit captures (and retains
48 world pixels for multi-subject and non-unit framing), and returns CameraSnapshotV1 plus
semantic CSS viewport and ground bounds. Camera set accepts only CameraSnapshotV1; status,
readiness, screenshot manifest v2, recording manifest v2, and fixed-capture manifest v2 carry the
same versioned shape. The Lab bridge surface version is 6. select resolves up to 400 visible
entities into browser-local GameState selection, accepts an empty list to clear it, and waits for
two render frames without sending a gameplay or Lab mutation. Setup mutations
wait for the server’s immediate authoritative snapshot without advancing paused simulation. Order
calls also wait for a new snapshot and request one bounded tick when paused so the queued command is
consumed before success.
presentation calls the app-owned CleanPresentation helper, which hides only DOM chrome and never
hides Pixi world layers; it is removed on capture completion, rematch, and app teardown. captureReadiness
reports bounded live PNG/frame-strip/profile/decal asset status, font status, render frames, frame-loop
errors, renderer errors, and subject missing-texture fallbacks without exposing renderer references.
The local scripts/interact/driver.ts owns the selected-worktree server, headless browser, logs,
clean viewport clipping, readiness wait, PNG/JSON artifacts, and profile cleanup. The bounded command
service owns aliases and exact input contracts. Its per-worktree daemon preserves that state across
machine-readable CLI calls, expires after 30 idle minutes, and returns screenshot paths and metadata
without embedding image content. Portable setup export/import uses the bridge’s narrow
exportSetup/importSetup methods and keeps checkpoint bytes out of CLI results. Replay bytes bypass
the browser and normal WebSocket result through the capability-gated private-server handoff; the
daemon writes only bounded artifacts and alias sidecars under target/interact/lab/.
Media commands retain the session’s CSS viewport dimensions but temporarily raise the default
capture density: DPR 4 for PNG screenshots and DPR 2 for real-time recordings, fixed-step videos,
and sampled time lapses. An explicit media viewport DPR overrides that default, and every capture
restores the prior session viewport when it settles.
Visual delivery is deliberately not owned by that per-worktree lifecycle. Before returning a
Tailnet URL, the daemon validates the artifact and copies it into the machine-level
tailnet-preview service on stable port 8091. The service binds to the machine’s private Tailscale
IPv4 address but publishes the fully qualified Self.DNSName MagicDNS hostname reported by
tailscale status --json; it falls back to the IPv4 address only when that name is unavailable.
The preview server has no idle timeout, and each
copied artifact has at least 24 hours of retention, so Lab close/shutdown, idle expiry, and worktree
removal do not invalidate issued links. A later publisher can restart the service and continue
serving unexpired copies from its OS-temporary root.
Operational aliases, inspection, selection, camera focus, screenshot subjects, and corresponding bridge
entity-id inputs accept at most 400 references. Screenshot readiness validates the complete
requested subject set, but returned and persisted subject detail is capped at 24 rows with total and
truncated metadata; recording and fixed-capture alias detail is similarly capped at 40 rows.
Successful bulk spawn and artifact-import responses default to counts, a truncated flag, and at
most 12 ordered detail rows. Callers may explicitly request details: true when they need every
spawned entity/raw outcome or every restored and stale alias row; rejection details remain complete
and actionable regardless of that success-response option.
The daemon publishes its startup checkout commit as optional IPC v1 state/probe metadata. The CLI
refreshes a mismatched daemon only through an atomic idle-only shutdown request; active scenes are
preserved behind daemonCheckoutMismatch, while status and shutdown remain usable.
Real-time recording uses raw Chrome DevTools screencast events as its composition cadence and takes
non-overlapping physical-resolution PNG source frames from the persistent page. It assigns the
newest source to cumulative 30 FPS monotonic-wall-clock slots before streaming H.264. Its manifest
records raw event/timestamp gaps and exact source-frame reuse; it warns below 80% source-slot
coverage. record-start can also resume authoritative time atomically after the initial physical
frame through its bounded resumeSpeed.
Fixed capture likewise streams up to 1,800 rendered PNG buffers into H.264, retains at most six
representative PNGs, and keeps per-frame ticks/hashes in the manifest instead of the CLI response.
interact_game_bridge.js
export class InteractGameBridge {
status() // isolated-match readiness and bounded semantic UI state
call(method, input) // status/inspect/select/move/giveUp/tabMenu/time/camera/presentation/captureReadiness
destroy()
}
export function interactGameLaunchEnabled(locationLike?)
App composes this bridge only for a root rtsLaunch=match URL whose room begins
interact-game-, role is player or spectator, and interact=game. The CLI creates either one
local human plus one AI or exactly two AI seats through ordinary lobby automation. The
bridge observes only the recipient’s normal fog-filtered GameState, projects a fixed semantic UI
schema (HUD resources, timer, selection, command-card labels, give-up dialog, and score screen),
and never returns internal object references. Its only gameplay command is move, which validates
1–100 unique visible locally owned unit ids plus an in-map destination and delegates to the normal
Match.commandIssuer. giveUp delegates to Match.requestGiveUp and waits for the ordinary score
screen. It exposes no arbitrary protocol command, DOM selector, browser evaluation, attack,
production, economy, or ability surface. Player sessions may hold/release and exercise the
authoritative Auto-Build tab menu for deterministic UI inspection; pause and resource-floor changes
use the normal gameplay command path and synchronize from acknowledged snapshots. Spectators cannot
call move, give-up, or tab-menu controls; only AI-only room
speed control is exposed for sampled time-lapse capture. Camera overview disables the automatic
spectator director and fits authoritative map bounds. Game screenshots and recordings default to
normal presentation and accept full-viewport, live-minimap, or bounded custom regions; clean
presentation is an explicit opt-in.
The bridge surface version is 4. Its shared game/dev-scenario select method replaces browser-local
selection with up to 400 entities from the recipient’s normal fog-filtered snapshot and waits for
two render frames. It is available to players, AI-vs-AI spectators, and dev-scenario observers,
including an empty selection for clearing, and never changes authoritative simulation state.
lab_scenario_authoring.js
export const LAB_SCENARIO_AUTHORING_LIMITS
export function createLabScenarioAuthoringState(options?)
export function slugifyLabScenario(value)
export function validateLabScenarioAuthoringState(state)
export function labScenarioPreviewLabel(preview)
lab_scenario_authoring.js is a pure UI helper for the app-owned lab panel. It owns checkpoint
setup authoring field defaults, slug generation, client-side metadata limits that mirror the server
catalog limits, comma-separated tag parsing, and local blocking errors before the panel sends a
server dry-run validation request.
lab_scenario_authoring_flow.js
export function updateLabScenarioTitle(panel, value)
export function captureLabScenarioAuthoringFields(panel)
export function renderLabScenarioOptions(panel)
export function validateLabScenario(panel)
lab_scenario_authoring_flow.js is the LabPanel-owned UI helper for checkpoint setup dry-run
validation, JSON preview rendering, and local setup import/export controls.
lab_panel.js
export function labSpawnFactionOptions()
export function labSpawnUnitKindsForFaction(factionId)
export function labBuildingSpawnFactionOptions()
export function labSpawnBuildingKindsForFaction(factionId)
export class LabPanel {
constructor({ root, labClient, launch, startPayload, match?, onEditMap? })
applyLabToolChange(change) // syncs active/cancelled tool status from Match callbacks
armSpawnPaletteTool(kind?) // arms a Match-owned completed spawnEntity world-click tool
armBuildingSpawnPaletteTool(kind?) // arms a Match-owned completed building spawnEntity tool
cancelActiveTool()
validateScenario(), exportScenario(), importScenario()
saveLabReplay(), openLabReplay() // distinct replay affordances; not legacy scenario ops
destroy()
}
map_editor_session.js
export const MAP_EDITOR_HISTORY_LIMIT // 25
export class MapEditorSession {
initializeBlank(options?)
initializeFromScenario(scenario, options?)
loadAuthoredMap(source, options?)
mutate(label, mutation), undo(), redo()
beginTerrainStroke(label?), paintTerrainTiles(tiles, terrain), commitTerrainStroke()
beginOverlayStroke(label?), paintOverlayTiles(tiles, edit), commitOverlayStroke()
materialized(), exportMap()
mapOverlay()
}
map_authoring/ is the single implementation of authoring geometry, symmetry, advisory symmetry
checking, authored-map limits, layer vocabulary/classification, and recipe materialization. Browser pointer
gestures and CLI recipes are separate adapters over its pure ESM operations; the package
does not access the DOM, Pixi, Node filesystem APIs, or simulation state. UI-only input/history and
CLI-only file/argument handling stay outside it.
LabPanel renders separate floating, collapsible Options and Tools windows. Options owns room
status, lab vision, command-limit policy, setup authoring metadata, validation,
setup import/export/reset, and result status; Tools owns target player, player state, spawn palettes,
active tool status, and the remove setup tool. Vision presents one Full button plus one button per
team; Full requests the authoritative union of every current team’s fog, and Lab exposes no
omniscient/no-fog control.
The supported author workflow starts at /lab: choose a bundled catalog setup or start a new Lab
on any bundled map, edit authoritative state with lab tools, fill in setup name/title/slug/description, run
validation, and export the setup JSON locally. Bundled setups remain build-time assets; the browser
has no server-persistent setup or map write API. The lab replay controls are visually separate from
setup checkpoint JSON controls; replay
save/open uses the bounded lab replay artifact path instead of the legacy exportScenario and
importScenario lab operations. Lab now exposes one Edit map action. It requests the current
authoritative map-only payload, creates a server-validated editor handoff, and navigates away; no Lab
entity, resource, order, timeline, or replay state crosses that boundary.
MapEditorApp owns the dedicated editor. Its persistent document bar owns map identity, undo/redo,
the Map settings and Layers toggles, camera framing/zoom, local authored-map JSON import/export,
authoritative check, preview, and Lab handoff. The document bar reserves the top strip: movable
editor panels are constrained below it when dragged, restored, resized, or viewport-clamped. Map settings is an independently movable,
collapsible, and resizable sheet for map source, details, resizing, and the advanced route report;
opening it temporarily replaces the editing palette and operation rail. Layers remains a separate
visibility-only floating panel. The palette is independently movable, collapsible, and resizable,
with pinned Terrain, Objects, Zones, and Locations tabs above the sole scrolling content region and
pinned current-tool/symmetry context below it. A separate operation rail exposes Brush, Box, Path,
Place, Spray, Erase, Add, Move, and Remove; operations that cannot apply to the selected content
remain visible but disabled with explanatory titles. The percentage in the document bar stays
synchronized with wheel zoom. Map settings loads bundled JSON from /maps/catalog and
/maps/<file>, creates configurable 16–256-tile-per-axis blank maps with a 126 × 126 default and
separate width/height fields that follow the active draft, edits name/description plus flat start and
base locations, and provides centered resize; the document bar owns undo/redo and local map JSON
import/export. The editor
accepts authored-map JSON up to 8 MiB and only materialized authored maps containing terrain;
agent-authored recipes remain a
scripts/map-author.mjs build CLI input and are not a Map Editor document type. Import normalization
preserves authored elevation and sun conditions. Every map has live Direction, Height, and
Color temperature controls in Map settings. Flat maps use those conditions for atmosphere and
directional unit shadows; varied elevation additionally lights and shadows the terrain. Dragging
the controls rebuilds the editor’s worker-owned terrain
preview with candidate sun conditions without adding intermediate undo entries. While Direction is
dragged, a temporary map-centred arrow points toward the sun source and labels the compass azimuth;
0° is north and 90° is east. A daylight-only time-of-day slider models 23 August 1942 at 48.7°N,
44.3°E on the steppe west of Stalingrad. It uses local solar time and NOAA/Meeus solar-position
equations to author direction, height, and a presentation warmth derived from solar elevation in one
undoable change; dragging it previews the same sun-source guide. Releasing a control removes the
guide and commits one authored-map change. Texture painting and Elevation are separate palette categories. Elevation uses synchronized
slider and numeric level controls from 0–9 with Brush, Box, Erase, and the active symmetry. New and imported maps without sun conditions use the shared 14:00
Stalingrad summer default. Sunlight cannot be removed; authored direction, height, and warmth remain
editable. Import normalization preserves authored terrain
verbatim, including impassable terrain in a protected base footprint, so
the advisory and authoritative checks can report the author’s actual input. Interactive rock/water
painting is still rejected in protected footprints, and moving or adding a location makes its
footprint passable. Resize
preserves the existing tile cells without scaling them, fills newly exposed edges with grass, and
shifts start/base locations with the centered source map. Authored v8 maps and materialized Lab
handoffs carry explicit width and height; older authored schemas are rejected. Start locations set map player
capacity; every base location is permanent and its authored resource counts spawn even when no
player starts there. The selected starting or neutral base exposes integer Steel (0–36) and Oil
(0–9) patch controls; new and migrated bases default to 12 Steel and 3 Oil.
Editor drafts may temporarily contain zero start locations so authors can clear and rebuild the player
layout. Editor-directed handoffs preserve that in-progress zero-start state without trying to create
a simulation; Lab-directed handoffs still require a playable start/base layout. Adding symmetric starts
reuses any base sites already present at the target locations. There is no
active layout, player slot, or per-player natural assignment. The viewport draws blue start
markers and neutral base markers over the shared Pixi terrain and owns editor-only pan/zoom/paint/site input. The editor draft splits terrain into
cosmetic ground rows and semantic features rows. Ground accepts Grass, Gravel, Dirt, Mud, and
Frosted Ground; features accept Stone, Water, and the five Road variants, with . meaning no
feature. Import splits the legacy authored terrain rows, and export, Lab handoff, symmetry checks,
and rendering recompose them with features above ground. Existing authored maps and the
authoritative flat terrain contract therefore remain byte-for-byte compatible while cosmetic paint
can no longer hide a meaningful feature. Terrain content supports brush
and inclusive drag-box fills. Symmetry uses one custom visual picker that preserves the established
flat vocabulary: none, horizontal, vertical, half-turn, approximate three-way rotation, four-way
radial, four-way quadrant mirror, and either single diagonal. Every choice shows an asymmetric
directional preview in both the closed picker and its expanded, independently scrollable top-layer
option list. Each diagonal also has an explicit two-copy flipped copy choice: it retains the
selected diagonal as the authoring boundary but reverses the mirrored partner, so the source and
partner occupy opposing triangular regions with opposite orientation. Ground Erase applies grass; Feature Erase removes the feature and reveals open
ground underneath. Until a layered authored-map schema exists, painting a feature canonicalizes
its hidden ground to Grass and ground painting skips feature tiles, avoiding state that legacy
export cannot preserve. Rectangular maps retain axis reflection and
half-turn and quadrant-mirror symmetry, while three-way, quarter-turn, and diagonal transforms are
disabled because they would rotate or transpose the map into a different shape. Symmetry expands every terrain tile before it is
painted, moves existing matching start or base locations together, and adds all symmetric locations.
The editor viewport also draws non-authoritative Steel and Oil stand-ins for every base using the
same count, centre-facing field geometry, tile snapping, passability search, and Oil spacing rules
as match setup and the production resource-node drawing primitives; editing either patch count
updates those stand-ins immediately. The selected neutral base has a pale map ring. The viewport draws the selected
centre axis, a centre marker for half-turn symmetry, a cross for radial or quadrant-mirror symmetry,
the selected diagonal for either ordinary or flipped-copy diagonal symmetry.
Texture Brush operations use a configurable 1–31-tile brush-width number control; Box fills remain independent of brush width.
Feature Erase is selected as palette content and stays armed while the author switches its Apply shape between Brush and Box.
The palette presents separate Cosmetic and Features groups. Cosmetic ground is
mechanically open and may cross protected start/base areas. Roads are passable semantic features;
stone and water remain rejected in protected footprints. Authored map rows
encode bare, horizontal-marked, vertical-marked, NW-SE diagonal-marked, and NE-SW diagonal-marked
roads with =, -, |, \, and /, respectively. The ten visual Open-terrain variants use
0 through 9 in protocol-code order: Gravel A/B/C, Dirt A/B/C, Mud A/B/C, then Frosted Ground.
The dedicated road tool drags a configurable-width road snapped to the eight cardinal/diagonal
directions, paints bare-road shoulders, and chooses the yellow centre-mark orientation automatically.
Every road paint also adds the independent No entrenchment overlay to the affected tiles; erasing
or replacing the road feature removes that automatic overlay. Cosmetic ground edits underneath a
road leave both the road and its overlay intact.
The same five road tile variants remain in the ordinary terrain palette for brush and box detail work.
The selected symmetry runs the shared advisory checker against the current draft and renders any
terrain, start/base, overlay, resource, or doodad mismatch directly below the selector. Three-way
checks compare complete generated square-grid orbits, including rounded copies clipped by an edge;
marked-road checks still require the transformed orientation.
Editor status uses a separate bottom dock outside the scrolling palette; failures use a
high-contrast alert treatment.
A terrain pointer stroke clones once for undo,
mutates rows in place, records dirty tiles, and commits once. The renderer patches those tiles plus their
edge-sharing neighbours into the existing canvas texture and calls
texture.source.update(); it does not recreate the canvas, fingerprint/serialize the map, or replace a Pixi
texture per tile.
The Terrain palette exposes Forest as compound content with a configurable 1–31-tile brush; the
separate operation rail applies it with Brush or removes it with Erase.
Forest painting is the single source for its tree scatter and its four composite gameplay effects. The draft
stores the exact tile area as compact inclusive [y, xStart, xEnd] row spans; generated trees use
reserved deterministic ids, while ordinary doodads remain independently authored. Symmetry expands
the forest stroke before the span mask is updated. Erasing removes both the semantic area and only
the forest-owned trees. Authored schemas before v9 are rejected rather than migrated.
Generated-tree placement uses the visible foliage bounds shared with the doodad renderer, including the renderer’s deterministic size variation. Interior canopies must remain substantially within the painted mask. Perimeter trees are placed first so their foliage joins along exposed sides; bottom-edge tree roots sit in the immediately adjacent tile below the forest while their foliage terminates on the semantic boundary. The grounded root location is therefore not itself evidence that a tile is a forest tile.
The Gameplay overlays palette can select any combination of Concealment, No vehicles, No buildings, No entrenchment, Damage reduction, and Slowed movement, then paint or erase the selected layers in one brush or box stroke. Forest is a separate composite authoring tile: materialization unions its spans into four runtime layers, while all six effect tiles remain independently paintable. No entrenchment prevents eligible infantry from digging or occupying trenches on the tile and is automatically authored beneath roads. The viewport uses distinct colors and icons, including a closed eye, no-entry sign, crossed building, half shield, and mired boot on affected tiles. A single effect uses the full tile; overlapping effects subdivide into stable 2x2 or 3x2 icon cells so all effects remain legible without hiding one another. Damage reduction and slowed movement each reduce their affected value by 25%; overlay strokes use the same brush/box, symmetry, undo/redo, resize, local JSON import/export, and Lab handoff paths as terrain. Sparse coordinate pairs remain authoritative.
The editor’s compact floating Layers panel independently toggles ten presentation-only authoring
layers in a two-column grid: Ground, features & bases, Forest, Concealment, No vehicles, No buildings, Damage reduction, Slowed
movement, Trees, Gameplay doodads, and Decorative doodads. Full labels and descriptions remain available through accessible checkbox names
and hover tooltips when narrow panel geometry truncates visible text. Tank Traps are gameplay
doodads; wildflowers are decorative doodads. Visibility never mutates the draft, export, undo
history, or handoff. The shared pure map_authoring/layers.js vocabulary also drives
map-author.mjs preview --layers <csv>, whose SVG preview shows every layer by default and can
isolate any comma-separated subset.
The doodad palette exposes wildflowers and Tank Traps. Place adds one selected doodad; spray continuously adds chosen-tint wildflowers at 1–256 density. Repeating a spray adds more in-bounds doodads until the authored-map cap of 4,096 is reached. Erase continuously removes doodads in its brush, including trees already present in imported maps. Trees cannot be placed as independent doodads in the editor; the Forest brush is their only placement surface so newly authored trees always carry the compound forest gameplay effects. Tank Traps snap to tile centres and materialize at match setup as completed owner-0 Tank Trap entities, so they use the live rendering, fog, combat, deconstruction, and vehicle-pathing behavior. Authored doodads cannot be picked up or moved; the erase brush removes them continuously. Symmetry applies when placing and erasing doodads, while undo/redo apply to all authored doodads. Forest-owned trees receive their shared effects from the compact forest span mask. Trees do not change line of sight, cover, or combat damage, and wildflowers remain mechanically inert.
Open in Lab posts the authored map plus its flat materialized locations to /api/map-handoffs.
The bounded server record expires after two minutes and is consumed once. Lab consumption creates a
private Lab whose first start payload already contains the edited map at tick zero; returning through
Edit map transfers only an authoritative exported map. The handoff itself carries the current map
in either direction; the editor does not maintain a separate browser-storage workspace.
/map-preview is a launch-gated consumer of the same one-use, two-minute Lab handoff used by
Open in Lab. It accepts no map data through query parameters or browser-evaluation calls. The
server validates the authored and materialized maps, creates a private Lab, and sends an ordinary
authoritative start payload and snapshot. The route then runs the normal App/Match and live
Minimap, including server-materialized starting resource depots, neutral bases, resources, and
doodads. Its visible page presents that captured production minimap; the world viewport is not a
preview surface.
Its versioned bridge exposes only bounded square 64–4096-pixel minimap PNG captures, with at most
16,777,216 output pixels. It enables reveal-all vision and suppresses app chrome. Captures call
Minimap.capturePng, which temporarily resizes the production minimap and omits only transient
camera, ping, and artillery markers; terrain, resources, and authoritative entities remain.
scripts/map-preview.mjs is the local Node/Chrome
adapter: it validates and materializes an authored map with MapEditorSession, creates a bounded Lab
handoff on a loopback RTS server, calls the narrow bridge under a browser-side deadline, validates
the returned PNG dimensions, and writes the requested artifact. Its output extension may be PNG or
JPEG; JPEG output is transcoded in the already-running preview browser after validating the
authoritative PNG, with bounded --jpeg-quality. A 512×512 minimap export displayed at 256 CSS
pixels is the lobby’s 2×/high-DPR preview convention. The Map Editor’s Preview action uses the
same handoff and route in an app-owned hidden frame: hover presents the captured minimap beside the
document-bar control, while click copies a 2048×2048 PNG to the system clipboard without navigating
away from the editor. The standalone route’s visible controls call the same bridge. The page owns no
authoring operations or recipe semantics. Fixed-pixel minimap marks scale from the live minimap’s
base presentation size during larger captures so resources, trees, units, and buildings retain their
relative proportions.
The editor’s Authoritative check and Route report actions post the current exported map to
/api/map-authoring/check and /api/map-authoring/report. The panel summarizes validity and base
counts or route/unreachable counts, while one collapsed <details> element exposes the complete
JSON response as a single text node. scripts/map-author.mjs check|report <map.json> is the matching
thin Node adapter over the authored-map Rust binary; neither adapter reimplements materialization
or pathing. Each browser request is bound to the exact exported-map fingerprint, has a total
20-second deadline, and is aborted and cleared when the draft changes or the panel is destroyed;
late responses cannot replace the result for a newer draft.
lab_panel_window.js owns local drag, resize, collapse/expand, reset, keyboard nudge,
viewport-clamping, and localStorage geometry hints for those app-owned lab windows. It has no
transport or match authority.
lab_control_policy.js
export function createLabControlPolicy({ labClient, metadata })
export function createDefaultControlPolicy()
App owns LabCatalogScreen before joining a lab and owns LabClient, LabPanel, and lab control
policy lifetimes when a start payload carries lab metadata. Match receives labMetadata,
labClient, and labControlPolicy through constructor options only; renderer, HUD, input, and
minimap do not import lab modules. The shipped MVP exposes catalog/blank lab selection,
per-operator lab vision, per-player asset god mode, setup mutations, issue-as commands, and
setup checkpoint import/export through those collaborators while keeping the normal match screen authentic.
Lab operator starts are still spectator-shaped for projection and prediction, and
LabClient treats start.lab.vision plus labState.vision as the recipient’s server-authoritative
choice; start.lab.godModePlayers plus labState.godModePlayers mirror room-scoped player god
mode. Match wraps the injected policy in one frozen read-only projection used by selection,
control groups, command budget, HUD/cards, Input, Minimap, renderer feedback/entities, combat audio,
LabPanel research display, room-time controls, and shell visibility. GameState neither publishes
nor discovers the policy. App separately injects LabPanel’s narrow mutable command-limit settings
collaborator (ignoreCommandLimitsEnabled()/setIgnoreCommandLimits(enabled)), so mutable operator
settings never enter the read-only projection. The projection exposes
canUseCommandSurface(state) so Match and HUD can
keep selection plus the real command card available for operators while read-only lab viewers,
replay viewers, and normal spectators remain passive. Lab selection itself is not toggled by this
control. Operator gameplay commands still flow through the shared CommandInteraction; its
underlying command issuer delegates to LabControlPolicy, which wraps them as lab issueCommandAs
requests for the single controllable selected
owner and includes whether that command should bypass the normal command-supply limit.
Mixed-owner lab selections remain command-blocked, but renderer inspection treats every selected
operator-controllable owner as a feedback owner so all-team Lab overlays such as rally/order
markers and selected support-weapon field-of-fire wedges can be compared across players.
Every client surface that needs ownership semantics must read through the injected read-only policy
projection: command-card resources/faction/upgrades,
right-click enemy classification, control groups, renderer feedback ownership, rally/order overlays,
range/setup previews, minimap commands, and combat audio categories. Raw state.playerId remains
the local viewer id and is not the lab command owner.
Lab setup tools use ClientIntent.activeLabTool for browser-local armed tool state. LabPanel
may ask Match.armLabTool(tool, { onWorldClick, onBoxSelection }) to arm a tool, and normal
Input consumes a completed left world click before selection, command targeting, or placement.
Tools that opt into paintOnDrag sample and interpolate each crossed map tile, delivering repeated
world-click callbacks without disarming the tool or falling through to selection; unit spawning,
building spawning, and draft terrain painting use that path. Other left drags normally promote to box
selection and cancel the active lab tool, while tools that opt into consumeBoxSelection receive the
selectable ids intersecting the real screen drag box instead. Box callbacks also receive the screen
rectangle and, for diagnostics only, any available ground polygon plus conservative bounds.
World-click callbacks receive the active tool payload, an exact nullable-ground world position (or
the selected proxy anchor for an entity-only hit), and any selectable hit entity id. ClientIntent.labToolPreview tracks the armed
tool at the world cursor for the renderer: unit and building spawn ghosts, the chosen terrain tile,
and a large removal X make the pending action visible before a click.
Match.cancelLabTool(reason) clears the tool and preview for Esc, right-click, teardown, ordinary
box selection, or panel-driven cancellation. Window blur releases camera/input transient state but
does not cancel the active lab tool. Input routes those cancellations through the injected lab tool
controller so Match can publish an active/cancelled change back to the app-owned LabPanel,
keeping the panel status and cancel affordance synchronized with keyboard, pointer, world-click,
box-selection, and teardown paths. Starting ordinary placement, command targeting, or command-card
build menus cancels the active lab tool so setup tools do not share state with gameplay command
modes. Unit and building spawning are lab panel palettes backed by the client faction catalog mirror
and playable faction labels; the unit palette excludes ability-created units such as the Command
Car’s Scout Plane. Each palette arms a persistent completed spawnEntity lab tool and
clicking or dragging sends the chosen world positions through LabClient until cancelled. Changing
the target player while a spawn tool is armed immediately retargets that tool, including its cursor
preview and subsequent placements, without requiring the operator to select the unit or building again.
Target-player changes re-render the complete Tools surface from that player’s authoritative resources,
god mode, and completed research instead of incrementally patching only the player colors. The lab does
not expose a secondary advanced spawn fallback; the panel spawn affordance is limited to playable
faction unit and building palettes. The visible map-editing surface is limited to the remove tool:
it arms a persistent removeSelectableUnits setup tool; clicking deletes the selectable unit or
building under the cursor, and dragging deletes selectable units and buildings in the box without
changing the current selection.
hotkey_profiles.js
export class HotkeyProfileService {
constructor({storage?, catalog?, profilesKey?, activeKey?})
allProfiles()
getActiveProfile()
hasProfile(id)
profileById(id)
setActiveProfile(id)
createCustomFromPreset(presetId, metadata?)
saveCustomProfile(profile)
validateDraftProfile(profile)
runtimeDiagnostics(profile?)
importProfile(payload, {targetId?, activate?}?)
exportProfile(id?)
exportProfileJson(id?)
parseImportText(text, options?)
resolveCard(card, profile?)
resolveSlot(slot, profile?)
hotkeyForCommand(commandId, profile?)
hotkeyCodeForCommand(commandId, profile?)
storedProfilePayload(profile)
}
buildHotkeyCommandCatalog(cards)
normalizeHotkeyCode(value)
hotkeyLabelForCode(value)
profileBindingForCommand(profile, commandId)
setProfileBindingForCommand(profile, commandId, code)
hotkey_editor.js
export function renderHotkeyEditor(root, hotkeyProfiles, context?)
export class HotkeyEditor {
constructor(root, hotkeyProfiles, context?)
render()
destroy()
}
The command card and hotkey editor preview render four columns by three rows (QWER / ASDF / ZXCV).
Existing logical slots 0–8 retain their positions and bindings; reserved slots 9–11 form the
empty right column (R/F/V). COMMAND_CARD_SLOT_ORDER maps logical slots to display order.
The separate global Auto-Build grid retains QWE / ASD / ZXC.
Hotkey profile schema v2 is physical-only: every binding value is a DOM KeyboardEvent.code such
as KeyQ, never a layout-translated character from KeyboardEvent.key. Runtime activation,
rebinding capture, held-target release, repeat handling, and conflict detection all use the physical
code. Resolved command descriptors keep identity and presentation separate as hotkeyCode and the
canonical QWERTY-position hotkey label; command buttons mirror those as data-hotkey-code and
data-hotkey. Text entry remains layout-aware and never routes through gameplay bindings. The
Map Editor’s WASD camera controls likewise use physical KeyW/KeyA/KeyS/KeyD positions.
Schema-v1 custom profiles and active-profile selections are intentionally reset rather than
migrated: v2 uses new rts.hotkeyProfiles.v2 and rts.activeHotkeyProfile.v2 local-storage keys,
and v1 imports are rejected. Exported hotkey JSON is intentionally client-local: schemaVersion,
profileId, mode, name,
description, createdWithBuild, basePreset, bindings, and factionBindings. Direct-mode
bindings hold global commands such as unit.move, unit.attack, unit.holdPosition,
unit.stop, worker.buildMenu, worker.return, support-weapon setup, and production cancel. Grid
profiles compute command-card bindings from slots but store standalone HUD actions such as
hud.selectIdleWorkers in bindings. Faction catalog
actions are stored under factionBindings[factionId] with namespaced command ids shaped as
kriegsia.build.<kind>, kriegsia.train.<kind>, kriegsia.research.<upgrade>, and
kriegsia.ability.<ability>. Ekat uses the same ekat.* namespace for its exposed ability
commands, currently ekat.ability.ekatTeleport, ekat.ability.ekatLineShot, and
ekat.ability.ekatMagicAnchor. The always-active hud.selectIdleWorkers action appears in the HUD
Shortcuts editor context and participates in conflict checks against every command-card context.
Grid binds it to T; Classic RTS binds it to I because T is already assigned to training-centre,
tank, and tank-research actions. Imports migrate old flat Kriegsia ids like build.resource_depot
into the Kriegsia binding set, preserve structurally valid unavailable faction commands with
warnings, ignore unknown non-faction commands with warnings, reject invalid keys and same-context
duplicates, and store accepted payloads as custom profiles. Untargeted imports rewrite ids/names to
avoid local collisions; targeted imports replace the whole target profile payload instead of
merging individual bindings. When the Classic preset’s mnemonic key collides within a rendered
context, conflict resolution prefers that command’s grid key before falling back alphabetically.
The long-lived SettingsContainer is constructed by App with #settings-button and the
#settings-menu mount point. App mounts the lobby context; Match/ReplayViewer remount live,
spectator, and replay contexts through dependency-injected collaborators. The stable rendered ids
inside the settings mount point are #pointer-lock-toggle, #projected-unit-shadows-toggle,
#unit-range-toggle, #always-show-health-bars-toggle, #debug-path-toggle, and #give-up-open plus live-match action
#live-pause-open; they may not exist until their owning
tab/action is visible. Live controllable matches mount a separate #tab-menu-button hamburger and
#tab-menu Auto-Build panel under #game-screen; the hamburger never replaces, moves, or aliases
the Settings gear. The compact panel opens immediately to the hamburger’s right, supports both a
click/tap toggle and the existing hold-Tab interaction, and reserves Space for its global pause
toggle. Below the resource floors it renders the local faction’s production-building trainables on
one QWE / ASD / ZXC grid (Barracks, Gunworks, then Vehicle Works for Kriegsia). An unmodified tile click or hotkey adds one standing
repeat allocation across every owned compatible producer; Shift-click or Shift+hotkey removes one.
Each tile uses the normal authoritative active/compatible producer count and Auto-Build swirl.
Classic bindings are used only when all combined-grid unit bindings are present and distinct;
otherwise the whole panel falls back to the deterministic grid. Match owns LivePauseOverlay
under #game-screen for reliable
livePauseState messages; the overlay resolves pausedBy through the match roster, exposes direct
Game-settings and Hotkeys-tab actions, and raises only #game-menu above its screen blocker while
paused. Resume remains visible only when the server grants canUnpause, and the overlay is
destroyed with the match. Once resume is accepted, a ten-second pulsing center prompt counts down
“Set up your hotkey groups 10” through “Set up your hotkey groups 1”. The overlay passes pointer
input through for selection and local control-group assignment; Match.commandIssuer blocks gameplay
commands while live-paused, including rally changes. After setup, the prompt gives way to the same large,
spoken Drei! Zwei! Eins! presentation used before match start. The client begins at the
server-reported remaining phase for a mid-countdown attach, while authoritative simulation stays
paused until the server’s final unpaused state.
When Windows exclusive fullscreen has enabled native cursor capture, the injected
onOpenChange callback lets Match release capture while Settings is open and resume it after
close. The hold-Tab menu uses the same match-owned policy so every interactive menu remains
clickable while fullscreen is active.
state.js
export class GameState {
playerId
startInfo // §2.3 payload
map // {width,height,tileSize,terrain}
players // [{id,teamId,name,color,startTileX,startTileY}]
playerById(id)
teamIdForPlayer(id)
isOwnOwner(owner)
isAllyOwner(owner)
isEnemyOwner(owner)
isNeutralOwner(owner)
// snapshot buffering for interpolation:
applySnapshot(msg) // pushes msg, keeps prev+current, stamps recvTime
entitiesInterpolated(alpha) // -> entities with lerped x,y,facing,weaponFacing
get tick() // latest authoritative simulation tick; 0 before snapshots
get prevRecvTime() / get currRecvTime()// recv timestamps of the two buffered snapshots
// (null until two exist); main.js derives interp alpha
resources // {steel,oil,supplyUsed,supplyCap} (latest)
events // latest snapshot's events
// selection (client-only):
selection // Set<entityId>; playable own selections are admitted by command supply
selectionBudgetOverflow // null | {used, cap, seq}; short-lived HUD feedback after ignored overflow
setSelection(ids), addToSelection(ids), clearSelection()
selectedEntities() // resolved entity objects from current snapshot
entityById(id)
setProgressPredictionPaused(paused) // exposes frozen/resumed WASM progress state to diagnostics
// control groups (client-only):
controlGroups // ten budget-admitted Array<entityId> slots; slot 9 maps to key 0
setControlGroup(slot, ids), addToControlGroup(slot, ids)
selectControlGroup(slot), controlGroupEntities(slot)
setOptimisticCommandState(state) // production/rally optimism display overlay
setPredictionFrame(frame, diagnostics, options), clearPredictionFrame(), clearPredictionPose()
}
client_intent.js
export class ClientIntent {
placement // null | { building, valid, tileX, tileY, lineSites? }
commandCardMode // null | "workerBuild"
openWorkerBuildMenu(), closeCommandCardMenu()
beginPlacement(buildingKind), updatePlacement(tileX,tileY,valid,options?), endPlacement()
commandTarget // null | "move" | "attack" | "setupAntiTankGuns" | ability target object
beginCommandTarget(kind, options), issueCommandTarget(ev), endCommandTarget()
holdCommandTarget(kind, key, shiftKey, options?), releaseCommandTargetKey(key, shiftKey)
releaseCommandTargetShift()
commandFeedback, addCommandFeedback(kind, x, y, append?, radiusTiles?, now?), liveCommandFeedback(now)
resourceMiningPreview, updateResourceMiningPreview(preview)
shopDeliveryPreview, updateShopDeliveryPreview(preview)
antiTankGunSetupPreview, updateAntiTankGunSetupPreview(preview)
abilityTargetPreview, updateAbilityTargetPreview(preview)
recordPlannedCommand(command, selectedEntities, result?)
plannedOrderPlanForEntity(entity), entityWithPlannedOrder(entity)
reconcilePlannedOrders(entities, options?), clearPlannedOrdersForUnits(ids), clearPlannedOrders()
activeLabTool, labToolPreview, labRuler
beginLabTool(tool), updateLabToolPreview(preview), cancelLabTool(reason?)
updateLabRulerCursor(point), placeLabRulerPoint(point), clearLabRuler()
}
Client Boundary Migration Target
Match remains the app-shell composer and owner of cross-area dependency injection. It constructs
GameState for authoritative snapshot display data and constructs ClientIntent for browser-local
cursor/command intent, then injects the intent facade into HUD, input, minimap, and renderer
feedback. Map-editor symmetry repair rolls back partial site relocation when no complete spawn slot
can be preserved and tries alternate split slots before rejecting symmetry selection. The app shell owns DOM-presentation resize handling. Renderer teardown destroys renderer-owned
adjusted canvas textures and clears its texture maps without destroying raw Pixi asset-cache
textures; raster loads completing after teardown are not cached or displayed. Artillery landing audio is scheduled from the authoritative impact delay,
and match teardown cancels pending landing timers. Mobile camera pan and pinch gestures track only touch identifiers whose touches begin on
the viewport; HUD and off-viewport touches do not join those gestures. Minimap gestures use native
Pointer Events with capture; touch and pen activate targets only on clean taps so inspection does
not issue accidental commands, while desktop right-click and queued-order behavior is preserved.
Camera instances own a
per-session maximum zoom with fallback handling for invalid options. Lab live and replay sessions
use an 8x maximum zoom, while non-Lab sessions retain the 2x cap; Lab initial-camera views are
restored under that limit during normal match initialization. The Game settings default zoom slider
stores a starting scale within the regular 0.4x–2x range; new matches and Labs begin at that scale
unless an explicit initial-camera scale overrides it. Lab’s 8x range remains available after launch.
Room-time controls de-duplicate matching touch and pen activation while preserving unrelated click
sources, retain server-confirmed state while requests are pending, and confirm time movement against
the authoritative baseline and controller identity. Blocked, failed, or unconfirmed sends are
exposed instead of applying optimistic selection. Read-only Lab viewers keep these
controls inactive with an authorization-specific status. Coarse-pointer layouts arrange existing
mobile debug chrome around safe areas, keep low-priority detail scrollable, and keep controls
reachable. Floating room-time, spectator, and observer-analysis titlebars support bounded touch
dragging there, while their mobile positions remain session-local so saved desktop placement is not
overwritten. Desktop layout is unchanged, and no touch world-command behavior is added. Runtime
modules should not gain direct imports across the model, input, UI, minimap,
renderer, and prediction areas except for pinned mirrors such as protocol.js and config.js, or
for explicitly documented architecture-check exceptions.
GameState is the authoritative browser view of server snapshots, interpolation, selected ids,
control groups, relationship helpers, fog-facing visibility data, and display overlays derived from
authoritative snapshots. ClientIntent owns placement intent, command-card submenu state,
command-target arming, hover previews, command feedback, ability previews, and the short-lived local
planned-order stages used only for previews while the server echo is pending. Smoke Plus world and
minimap targeting feedback uses the mirrored cloud radius and duration effect fields. An unqueued local order
replaces the stale authoritative plan when composing subsequent queued previews, and asynchronous
Lab command results are not recorded as durable local plans. Contextual oil
right-clicks compose a Pump Jack build intent on the clicked oil patch rather than a gather
command. Engineers open the basic build submenu with Z and Advanced Build with X.
The basic menu keeps Resource Depot (Q), Pump Jack (W), Barracks (E), Training Centre (A),
and Tank Trap (X) in their existing slots. Advanced Build contains Engineering Complex (Q),
Gun Works (W), and Vehicle Works (E). Both menus return to worker commands with C or Escape
and use the same placement, affordability, and prerequisite checks. The advanced menu is exposed
only for factions that can build one of its structures. Manual construction costs 150 Steel and takes 10 seconds. Contextual Pump Jack placement
snaps to the closest live oil patch within one map tile of the cursor before applying the normal
footprint validation. Pump Jack construction remains legal outside the completed
friendly Resource Depot/Zamok mining radius, while the normal resource-mining preview warns that the
distant extractor will be inactive. Completed owned or allied Pump Jacks with inactive extraction show a red prohibited-sign
badge above the building until a completed friendly mining anchor comes into range. Right-clicking the oil patch also works when an owned or allied unit overlaps it. Advisory building placement ignores unit types whose client configuration marks them as
non-ground placement blockers. The Scout Plane stays out of the shared ground vehicle-body
classifier, so its body does not block build previews. Normal gameplay selection and control-group
commands exclude it, while Lab and spectator inspection paths allow selecting and grouping it. Its generated Fw 189-style top-down PNG frame-strip rig is scaled to the mirrored aircraft body so
the art, hit testing, and selection ring remain aligned. It uses the existing team-light tint
pipeline with a darker, desaturated color target and has a render-preview visual profile for lab
comparison. Normal contextual right-click hover
refreshes ClientIntent.attackTargetPreview from the same rules used to compose orders. Visible
Scout Planes are not classified as attackable client targets, so contextual right-click and explicit
attack targeting route through valid move or attack-move commands instead of target attacks. Scout
Plane command cards expose only retarget and dismiss, including the hidden dismiss ability; mixed
selections keep land-unit commands scoped to land units. Renderer feedback draws a red ring around an enemy when the
selected units would attack it; gather, build, deconstruct, and targeted-command modes suppress the
preview. GameState must not grow compatibility accessors for those intent fields; HUD, input,
minimap, and renderer feedback use the injected facade or a narrow read model. Lab Unit Spawn and
Building Spawn panels expose the target player’s color through DOM data/style hooks before map
placement. In Lab, visual and audio
feedback for controlled-side selections and commands is issued as the selected controlled player
instead of the raw local player id. Lab command-card and targeted-command policy resolves resources,
faction catalogs, per-owner upgrades when present, prerequisites, production helpers, self-ability
hover origins, and hostility from the selected issue-as owner rather than the spectator/viewer id.
Lab Options, Lab Spawn, Lab Tools, and floating room-time panel headers preserve drag, collapse, and keyboard
geometry handling without visible reset actions.
The Lab Spawn panel owns entity setup, removal, target-player, and player-state controls. The
separate Lab Tools panel owns the browser-local Ruler. While armed, its hover point displays tile
coordinates and its first click starts a live Euclidean tile-distance segment; the second click
fixes that segment, and the next click replaces it. Fixed ruler geometry remains in
ClientIntent.labRuler when another Lab tool is armed and is removed only by a new ruler start,
the Tools-panel Clear action, or match teardown.
Frame-local entity views belong to the app-shell frame loop, not to GameState. Rendering, local
fog fallback, minimap blips, HUD selection/tech checks, renderer feedback, and observer Army Value
should accept the injected frame view when called from the RAF path and fall back to GameState
queries only for direct module tests or event handlers outside the frame. Static resource nodes with
no remaining resources are omitted from frame-local entity views and minimap blips. Minimap
artillery firing indicators render as 30x24 PNG-backed icon markup without an extra surrounding ring.
Selected worker units do not draw weapon range indicators, even when their frame-local view exposes
weapon range metadata. Entrenched units render as smaller, trench-tinted rig instances without a
separate occupied-infantry trench ring in the selection layer. Trench ground decals render at half
the authoritative trench radius; snapshot data and the gameplay radius remain unchanged. Frame-local entity views may carry
bounded render diagnostics for local profiling consumers without changing the authoritative snapshot model. Server-authored, fog-discovered death and impact marks are
normalized by GameState into deduped pending stamps and rendered below resources and fog as
visual-only decals. Death decals use the generated PNG atlas only after readiness; unretained durable
batches are retried rather than stamped before readiness. Decals do not affect simulation or
balance.
Renderer feedback should consume a narrow read model containing placement, command feedback,
support-weapon setup previews, ability targeting previews, ability objects, and selected entities,
rather than relying on the full mutable GameState. Queued support-weapon setup previews use
accepted move or attack-move order-plan endpoints as their field-of-fire origin, plus local pending
move/setup stages when the command has been sent but no owner-only orderPlan echo has arrived;
unqueued setup previews use the current support-weapon position. Minimap hover and click targeting
feed support-weapon setup previews and commands from minimap world coordinates for Anti-Tank Guns
and Artillery. Anti-Tank Gun group setup interprets cursor distance from the selected
guns’ centroid as a formation-facing control: clicks through 14 tiles converge on the literal
point; from 14 to 20 tiles a smoothstep interpolation straightens the guns until their facings are
parallel; from 20 to 25 tiles a second smoothstep opens a lateral-rank fan that reaches 90 degrees
total (leftmost −45 degrees, median straight ahead, rightmost +45 degrees). The client submits the
whole selection and literal click as one budgeted setup command; the authoritative simulation
resolves individualized Anti-Tank Gun facing rays, while Artillery in a mixed selection retains the
literal clicked setup point. Viewport and minimap previews mirror those same
curves. The input router owns the
active preview surface: while the minimap is hovered it
suppresses viewport-derived attack, resource, ability, placement, and Lab-tool previews without
hiding minimap-authored setup cones or issued-command feedback. HUD command-target arming preserves
Shift, and the frame refresh reads live keyboard state so stationary minimap previews switch between
current and queued origins as Shift changes. Armed Artillery Fire previews compute advisory
per-artillery firing positions from the current gun origin or authoritative/local pending planned
origin and the 10-to-35 tile range band. Out-of-range previews retain the literal center, draw the
projected movement leg and future setup cone, and command feedback marks the clicked point while the
server authoritatively validates and executes the movement/setup plan. Local planned setup/fire stages are reconciled on snapshots using
the owner-only orderPlan and command acknowledgement metadata, and are cleared on deselection,
Stop/Hold, replacement commands, rejected command receipts, and match teardown. If Tank Traps are
re-enabled, their placement previews keep normal terrain, resource, building, and map-bounds checks,
allow infantry overlap, and reject vehicle-body units. Their line dragging treats terrain, building,
and map-bounds blockers as skipped sites,
omits illegal build commands for those sites, and resumes on the far side; vehicle-body unit blockers
still break the line. HUD and input should exchange command intent through descriptor/facade
methods, while gameplay command emission continues to flow through
commandIssuer.issueCommand. HUD selected-unit strip cells support direct selection refinement:
left-click selects only that unit, Shift-click removes it from the selection, and Ctrl/Meta-click
or control context-click filters the current selection to that unit kind. Base Novices and each
evolved Dao (War, Magic, Wind) have distinct authoritative unit kinds for this filtering and world
Ctrl/Meta-click or double-click selection; a base Novice’s chosen future Dao does not split its
type until evolution. This keeps base Novice Dao choices accessible without evolved abilities
occupying their command-card slots. Unit command-card
descriptors include Stop on S and Hold Position on W; Command Car selections also expose
Breakthrough on E. In lab rooms, injected lab control policy owns selection, inspection, and
single-owner issue-as routing without changing the client player id. PredictionController owns
client sequence allocation and optimistic bookkeeping; GameState applies named display overlays
but does not own prediction policy.
camera.js
export class Camera {
// Semantic renderer-neutral API; all screen values are viewport-local CSS px.
project(point) -> {x,y,depth,clip,visible}
groundAtScreen(screen) -> {x,y}|null
projectedExtent(point, worldW, worldH) -> {width,height,scaleX,scaleY,visible}
viewportGroundPolygon() -> [{x,y}, ...]
viewportGroundBounds() -> {minX,minY,maxX,maxY}|null
containsProjected(point, marginCssPx?) -> boolean
focusAt(point), framingForWorldPoints(points, options?), fitWorldPoints(points, options?)
panByScreenDelta(delta), dollyBy(factor, anchorScreen?)
resize(viewW, viewH), setMapBounds(worldW, worldH)
snapshot(), restore(snapshotOrLegacy), projectionSnapshot()
audioListener(), subscribe(listener) -> unsubscribe
// Private orthographic compatibility used only by Camera and named Pixi adapters.
x, y, zoom // world coords of viewport top-left, framing scale
update(dt, input) // apply pan (keys/edge/virtual pointer-lock cursor) & clamp
worldToScreen(wx, wy) -> {x,y}
screenToWorld(sx, sy) -> {x,y}
centerOn(wx, wy)
setZoom(zoom, anchorSx?, anchorSy?), setBounds(worldW, worldH, viewW, viewH), setView(view)
}
auto_spectator.js
export class AutoSpectatorDirector {
constructor({camera, state, enabled?})
setEnabled(enabled)
observeSnapshot(snapshot) // ingest combat activity; routine decisions at most once per three simulated seconds
update(dt) // advance the active smooth camera transition
diagnostics(), destroy()
}
Replay viewers and ordinary live spectators receive a floating, draggable Spectator Controls
panel with a default-off Follow active fights switch. Every spectator or replay session starts
with the switch off; enabling it lasts only for the current session. The control is deliberately
kept out of the gear-menu settings. Lab sessions do not mount the director. While enabled, the
director retains three simulated seconds of attack, death, and positioned-impact activity, groups
samples within ten tiles, and frames the highest-weight group; deaths count as four attacks,
occupied impacts as two, and the current fight receives a small stickiness bonus. Empty artillery
impacts are ignored. When combat activity expires, the director prefers a likely contact between opposing-team
units: units already within 28 tiles qualify, as do movement tracks whose inferred closest approach
comes within eight tiles over the next six simulated seconds. Nearby members of both formations are
included in the shot, same-team pairs and scout planes are ignored, and worker-only contacts receive
a ranking penalty. Combat and likely-contact shots show 50% more world span than their fitted
framing. If no contact is plausible, quiet mode favors clusters of units and buildings whose
authoritative order plan, rally, or production intent just changed. Runtime state transitions and
moving attack-marker coordinates are ignored. These activity reframes
preserve the current zoom and update at most once per simulated second. With no recent command
activity, the camera preserves its focus and widens by 6%
per second, finishing each small widening before beginning another. The local overview never
widens past 70% of either map dimension, so a large display cannot turn it into a whole-map shot.
Combat and contact decisions occur no more than once every 90 simulation ticks, while persistent
quiet mode may reconsider command activity every 30 ticks. Any combat activity interrupts quiet
mode immediately, and a newly dominant fight beyond the current viewport also bypasses the routine
interval. Nearby reframes pan and zoom with a one-second smooth transition. Backward replay seeks
clear future combat, command activity, and motion tracking before the rebuilt timeline is evaluated.
Local replay review can opt into the AI diagnostics panel with rtsAiDiagnostics=1 and
replayArtifact. Match owns mount/update/destroy; the panel reads controller-authored sidecar
states at the authoritative replay tick and never infers rules from chat or controls gameplay.
AI-player tabs show each profile’s own sections or No diagnostics. Dragging, keyboard nudges,
Home reset and collapse use the shared floating-panel/touch helpers, with separate persisted
preferences. Demo fixtures require rtsAiDiagnosticsPreview=1 and stay labeled Sample data.
See the replay diagnostics contract.
renderer/index.js (worker-owned; importing it from a main-thread production area is forbidden)
export class Renderer {
static create(canvasParent, options) // worker creates one WebGL PIXI.Application
resize(w,h,dpr)
buildStaticMap(map) // draw terrain once into a cached layer
render(stateFacade, cameraFacade, fogFacade, alpha, options?) // Pixi-private engine seam
present(nowMs = visualNow()) // update water clock; one synchronous app.render(); increments on success
captureReadiness({subjectIds?, subjectKinds?}) // bounded visual asset/error state for Interact capture
app // the PIXI.Application (for ticker/stage if needed)
// Pixi implementation used by PixiPresentationAdapter's screenOverlay reconciliation:
drawSelectionBox(rectOrNull)
}
renderer/pixi_compatibility_adapter.js
export const PIXI_LEGACY_READ_ALLOWLIST // frozen ids plus concrete review triggers
export class PixiPresentationAdapter {
constructor(canvasParent, sources, {renderer}) // worker injects its Renderer
render(presentationFrame) -> PresentationSubmissionV1
resize(w,h), enterFixedCapture(clock), exitFixedCapture(clock)
captureReadiness(query), destroy()
}
PresentationSubmissionV1 carries the submitted generation/frame id, an asynchronous nullable
retained outcome for the exact ground-decal revision, and an asynchronous terminal outcome from
presented | superseded | failed | destroyed. Fixed capture awaits presented for its requested id
and returns that public acknowledged id; it never reads a renderer-private counter.
Normal Match rendering uses this adapter. The direct Renderer surface remains Pixi-private and
is reachable only from pixi_render_worker.js; MapEditorPixiPresentationAdapter is a narrow
main-thread wrapper around the same worker host and submits detached editor records. Pixi uses
autoStart:false. Fixed capture drives the ordinary host once per requested capture frame, awaits
that exact presented id and same-task RGBA readback, and resumes one Match RAF; it never stops or
restarts a ticker. Map Editor owns its separate RAF and submits one editor record exactly once after
each editor scene/camera update. Both owners cancel their RAFs during teardown, and worker/renderer
destruction is idempotent. No main-thread Pixi runtime, feature flag, synchronous renderer, hidden
canvas, WebGPU path, or fallback exists.
fog.js
export class Fog {
constructor(mapWidth, mapHeight, terrain?)
update(ownEntities, tileSize, serverVisibleTiles?, serverExploredTiles?)
isVisible(tileX,tileY), isExplored(tileX,tileY)
setRevealAll(enabled)
// renderer reads the grids to draw the black/dim overlay; minimap caches against revision
visibleGrid, exploredGrid // Uint8Array length w*h
revision, visibleRevision, exploredRevision
}
match.js must exclude legacy/special visionOnly and shot-reveal entities from ownEntities
before calling fog.update; those views are rendered as intel, not as local fog sources. Normal
match snapshots provide visibleTiles and exploredTiles, so the overlay replaces both grids from
the current authoritative perspective, including smoke blockers, five-second lingering death
sight, and replayed exploration history. Local stamping and cumulative exploration remain a
fallback for older/dev object snapshots. That fallback still rebuilds the complete visibility union on every
rendered frame. It may reuse one entity’s previously computed tile stamp only while identity, kind,
exact world position, tile size, sight, footprint, and terrain are unchanged; any changed input
invalidates the stamp and performs the ordinary line-of-sight rays in the same frame. This is exact
memoization, not a lower fog cadence or stale-state allowance.
The checked-in Hellhole client-performance stream follows the normal path: it is active Player 1’s
fog-filtered projection from the canonical 1+3 versus 2+4 scenario and carries the full
server-authored visibility grid. It must not be converted to a full-world spectator projection,
which would benchmark local fallback ray casting instead of ordinary player presentation.
The opt-in uncapped harness temporarily replaces only the rAF scheduler with a bounded,
completion-paced driver of the same live frame function. Snapshot delivery, state timing, fog,
presentation assembly, worker rendering, HUD, and minimap remain live; fixed-capture shortcuts and
unbounded worker flooding are not benchmark paths.
Playable own selections and human multi-unit commands use the mirrored command-supply budget from
command_budget.js: 25 base command supply. Command Cars have zero command weight and add no
capacity (COMMAND_CAR_SUPPLY_CAP_BONUS = 0); other units use mirrored supply as weight with a
fallback weight of 1. Drag selection, shift-add, double-click same-kind selection, and control-group
save/add/recall preserve their normal candidate ordering. Overflow candidates are ignored
client-side and surface selectionBudgetOverflow for the HUD; outgoing commands that still exceed
the budget are blocked before Net.command.
input/index.js
export class Input {
constructor(domElement, camera, state, commandIssuer, drawMarquee, fog, audio?, inputRouter?, hotkeyProfiles?, clientIntent?, labToolController?, desktopCursor?)
// installs listeners; translates gestures into selection + protocol commands.
// number keys recall control groups; double-tap jumps the camera to the largest
// local cluster. Alt/Ctrl/Cmd+number replaces a group, Shift+number adds to it.
// On Windows, browser saves use Alt+number, including browser fullscreen;
// installed-app/standalone saves accept Alt/Ctrl/Cmd+number.
// optional pointer-lock mode traps the browser cursor and drives a visible
// virtual cursor for edge pan on multi-monitor setups. In the macOS Tauri
// spike, the optional desktopCursor bridge replaces browser Pointer Lock
// while keeping the same selection, command, HUD, minimap, wheel, and Escape
// routing contracts. Match auto-requests that native bridge for Tauri matches
// and retries on focus/visibility return. Native desktop cursor visuals are
// painted directly from the native event handler and diagnostics expose backend,
// native/JS event counts, dropped events, and delivery latency.
update(dt) // continuous handling (edge scroll handled by camera)
publishSelectionScene(scene) // after a successful presented frame only
// emits nothing to return; mutates state.selection / clientIntent and calls commandIssuer.issueCommand
}
input/camera_navigation.js
export class CameraNavigationInput {
constructor(domElement, camera, options?)
// shared command-free camera gesture state for live input and replay/observer wrappers:
// viewport mouse tracking, mouse-wheel cursor-anchored zoom, configured pan keys,
// middle-mouse drag panning, optional Space+left-drag panning, touch drag/pinch
// pan/zoom for mobile viewing, blur release, and teardown.
// exposes keys + mouse for Camera.update(dt, input)
static replayPanKeyCodes()
install()
destroy()
}
Live Input composes CameraNavigationInput for camera gestures, then layers pointer lock,
selection, placement, command-card targeting, command hotkeys, minimap routing, and gameplay command
issuance on top. Replay viewers use the same helper through ReplayCameraInput, with replay WASD
pan-key aliases and a composed browser-local observer selection surface, but no gameplay command
issuer API. Replay spectators can click or box-select visible entities for selection rings and the
read-only unit detail panel. Replay middle-drag and Space+left-drag pan
through semantic Camera.panByScreenDelta({x,y}); touch drag/pinch pan and dolly without emitting
gameplay commands. Wheel/pinch anchors and every drag delta are viewport-local CSS pixels, including
under non-1 DPR. Mouse-wheel dolly, keyboard pan state, edge scroll state, and blur release are shared
observer navigation behavior. The minimap draws Camera.viewportGroundPolygon() and recenters with
Camera.focusAt(), so perspective ground footprints may be partial or empty without invented bounds.
Live spectators still use the live Input path so read-only selection inspection remains available
while command emission stays gated by local-owner checks.
Shift-right-click appends queued orders only for selected units: move, attack-move, attack,
gather, build/resume, Tank Trap deconstruct, and placement build commands set queued: true and
rely on the server snapshot’s owner-only orderPlan for accepted markers. Shift-clicking or
Shift-hotkeying Hold Position appends its terminal hold stance instead of replacing those queued
orders. Production-building-only right-clicks set
or append building rally stages and rely on owner-only rallyPlan for accepted markers. Resource
patches suppress rally command emission. The minimap applies the same resource-target
classification against known live map resources. Attack
targeting with only production buildings selected creates attackMove rally stages.
Right-dragging only selected producers draws a line rally using the same three-tile threshold.
The stroke supports 128 sampled points (also the unit formation limit). Each selected producer
receives the same bounded line; Shift queues a stage. Selected buildings show the full polyline
and their regular rally connector/flag at its arc-length midpoint, including optimistic feedback.
Queued connectors start at the preceding displayed marker; repeated vertices and uneven sampling
do not shift the midpoint. This is presentation-only; spawn sampling keeps the original polyline.
Right-dragging selected units promotes to a freehand formation move after three tiles. While attack
targeting is armed, the same three-tile gesture is available on left-drag: its polyline and
body-aware provisional slots render red, and release issues one atomic formationMove command with
attack-move semantics so the server assigns and admits the full group together. Shorter gestures retain the existing contextual right-click or targeted
left-click behavior, including command-composer Shift/held-key lifetime.
The minimap supports the same freehand line orders with mouse right-drag and attack-targeted
left-drag, including the locked cursor. Match injects the shared formation gesture factory;
minimap points are converted to world coordinates before sampling and the same three-tile
threshold applies. The minimap shows the stroke and provisional slots while dragging.
Mouse point orders wait until release; Shift queues either form. Pointer cancellation, blur,
Escape, and lost command eligibility discard the gesture. Touch/pen retain clean-tap targeting
and inspection panning.
Selection, hover, and entity targeting use the last successfully presented detached
SelectionSceneV1; move/ground abilities/placement use its nullable ground query. Screen clicks and
marquees project plain mirrored proxies rather than reading current state or renderer geometry.
Point clicks and hover apply the authored per-unit tolerances in input/click_geometry.js;
direct hits win before expanded near-miss areas, while reduced circles replace the old click
area. Marquee and viewport queries keep the original body footprints. The exact per-unit
policy and proxy fields are documented in client-rendering.md.
Selection and targeting still use GameState relationship helpers where the distinction is own/ally/enemy:
single-click may select an allied entity for read-only inspection, box selection and same-kind
selection stay own-only, and right-clicking own or allied entities with own units selected falls
through to ordinary move-to-point behavior instead of attack. Command emission, prediction,
optimistic production/rally, control groups, build/gather/train/research/cancel, and ability
execution remain strict local-owner checks.
Shift-confirmed build placement keeps placement mode armed while Shift is physically held, allowing
multiple queued building placements; releasing Shift or losing window focus clears placement mode.
Tank Trap placement uses the same local placement intent, with optional lineSites
preview data: the first valid sites dispatch as one immediate single-worker build per selected
worker, and any remaining valid sites dispatch as queued standard build commands against the
selected worker set. Line placement only offers vehicle-closing Tank Trap steps: exact diagonal adjacency (1,1) or
one-tile orthogonal gaps (2,0) / (0,2). Invalid intermediate sites break the line instead of
letting dispatch skip ahead across a larger gap. Normal graphics draws Tank Traps larger than their 1x1 build footprint. Experimental graphics
uses a full-tile visible sprite span with stable per-id views; the placement and collision rules are unchanged.
command_composer.js owns command-target arming lifetime for command-card targets. HUD, input, and
minimap receive ClientIntent from Match; input and minimap clicks call
ClientIntent.issueCommandTarget, so held keys, Shift preservation, and repeated queued target
clicks use one composer path instead of command-specific sticky flags. A plain
targeted-order command-card hotkey tap arms the target after keyup; pressing the same resolved
hotkey again inside the quick-cast window issues it at the current cursor world point. Shift does
the same with queued: true and keeps the target armed until Shift is released. World-point
ability hotkeys follow the same tap contract: tapping and releasing the key keeps targeting armed
until the first unqueued world click, while physically holding the key only extends targeting for
repeated clicks. After an unqueued quick-cast consumes the armed target, the next near, still
viewport left-click is ignored as an accidental confirmation click; moving far enough to become a
drag restores normal selection.
input/router.js
export class MatchInputRouter {
constructor(viewportEl)
registerZone(zone) // zone: {priority?, previewSurface?, contains(ev), pointerDown?, pointerMove?, pointerUp?}
// returns unregister()
activePreviewSurface() -> string|null // hovered/captured surface currently covering the viewport
pointerDown(ev) -> boolean // routes to highest-priority matching zone
pointerMove(ev) -> boolean // captured zone receives moves until release
pointerUp(ev) -> boolean // releases capture after the originating source handles up
wheel(ev) -> boolean // routes locked/native wheel events to DOM surfaces before camera zoom
}
Router events carry viewportX/viewportY plus clientX/clientY; pointer-lock input and DOM
input use the same zone contract so DOM overlays can work while the browser routes mouse events
to the locked viewport. Match registers one game-screen DOM zone that ignores the viewport
subtree; explicit zones such as the minimap keep higher priority, and any future interactive panel
above the battlefield receives pointer/mouse/click/wheel events without being separately listed.
audio.js
export class Audio {
preload(manifest): Promise<void> // decode sounds once the AudioContext is unlocked
unlockFromGesture(ev?) -> Promise<boolean>
// create/resume AudioContext from a user gesture
isUnlocked() -> boolean // true when the AudioContext is running
onUnlockChange(fn) -> unsubscribe // notify settings UI after first successful unlock
play(id, {x?, y?, directionalOnly?, priority?, category?, pitchVariance?, gain?, duck?, key?, loop?, fadeInMs?})
// x/y spatialize; directionalOnly omits distance gain
playUI(id, opts) // non-spatial ui category convenience
stopByKey(key, {fadeOutMs?}?) -> number // stop or fade tagged sustained/abortable voices
setVoicePosition(key, x, y) -> number // repan active keyed spatial voices without restart
setListener({x,y,referenceDistancePx}) // consumes semantic AudioListenerV1
pickVariant(ids) -> id|null // seeded RNG variant choice
setMasterVolume(v), getMasterVolume()
setCategoryVolume(cat, v), getCategoryVolume(cat)
destroy()
}
export const SOUND_MANIFEST
export function noticeSoundId(msg)
Disciple attack events use dedicated cues in match_combat_audio.js: Dao of Magic’s
disciple_orb weapon plays the orb launch, and Dao of Wind’s spear plays the spear thrust.
Base and Dao of War sword attacks use the soft stab against infantry; tanks, scout/command cars,
scout planes, mortar teams, anti-tank guns, artillery, and rocket trucks use the metallic strike.
This is presentation material selection, independent of the balance armored flag. A missing
target uses the soft stab without looking up hidden information. Explicit orb/sword weapon hints
take precedence over the attacker’s Magic evolution state; events without a weapon hint use its
current Dao. The normal spatial combat buses, deduplication, pitch variation, and voice cap apply.
Asset provenance, audition selections, and decoded levels are in docs/sound/DISCIPLE_ATTACKS.json.
Throw Sword uses the selected heavy-boomerang whirl, normalized with peak headroom and stretched
without pitch shift to the nominal 54-tick / 1.8-second full-range round trip. MatchCombatAudio
tracks only fog-filtered Throw Sword line-projectile objects, spatially follows each sword, and
loops the cue if the caster moves far enough to prolong its return. Object removal stops the cue
immediately, including short casts and loss of visibility. Pause, replay seek, match end, and
teardown clear these voices. No random pitch variation changes the cue’s duration. Processing and
provenance are recorded in docs/sound/THROW_SWORD.json.
Dao ability audio uses the selected Silk Gust dash, Resonant Shell shield placement, and magical
portal candidate 1 for Anchor. MatchCombatAudio owns MatchAbilityAudio, which receives only
recipient-filtered snapshot entities and ability objects. Dash plays on an observed decrease in
windDash.remainingUses; it does not guess from input or position changes. Because charges are
owner-only affordances, enemy dashes without that metadata remain silent. A newly visible Shield
object plays one cast cue; the sound is not repeated on damage or subsequent snapshots. Each visible
Anchor owns a spatial, pitch-stable loop. It stops immediately when the object disappears (including
expiry, replacement, or lost visibility), and can resume after voice eviction. Pausing stops Anchor
voices while retaining cast baselines; paused snapshots advance those baselines silently. Match end,
replay seek, and teardown clear voices and baselines. The selected 8-second portal is circularly
crossfaded into a 7.2-second sustain asset. Normalization preserves transient peaks; Anchor targets
4 LUFS below cast mastering and its loudest 50 ms is at least 3 dB below both cast cues. All three
share a 0.7 runtime gain and the ordinary spatial combat buses. Exact prompts, source hashes,
generation settings, and measured production levels are in docs/sound/DAO_ABILITIES.json;
scripts/prepare-dao-ability-audio.py reproduces the processing from retained raw inputs.
Vector Field uses the selected Silk Current wind, assembled from irregularly offset overlapping
sections into a complete 10-second cue. It follows the same visible-object spatial sustain lifecycle
as Anchor (including pause, expiry, lost visibility, eviction, replay seek, and teardown), with its
own asset and voice keys. The full take covers a normal field lifetime; looping is only a fallback
when a visible object outlives the recording, such as slowed playback. It has no random pitch shift.
Production is mono, with a −20 LUFS mastering target constrained by a −2 dBTP peak ceiling and a
loudest 50 ms at least 3 dB below both cast cues, before the shared 0.7 runtime gain. Selection,
original generation, overlap processing, and measured levels are retained in
docs/sound/VECTOR_FIELD.json; scripts/prepare-vector-field-audio.py reproduces normalization.
match_notice_presenter.js
export class MatchNoticePresenter {
constructor({toast, minimap, audio, isReplay, isSpectator, pointInViewport, now?})
present(event) -> boolean // fan out one existing server Notice when admitted
}
Match owns one presenter per match and injects the toast, minimap, persistent audio engine, and
dynamic viewer/viewport predicates. The presenter owns only existing server Notice events; it
does not create advisory or economy notices. Under-attack incidents use 960 px map buckets and a
10-second match-scoped cooldown, with one admission decision gating toast, minimap, and voice
together. An admitted in-viewport incident still toasts and pings but stays silent and consumes the
same cooldown; a distinct bucket remains immediately eligible. Replay viewers and live spectators
still receive admitted toast/minimap presentation but never player notice audio.
Every existing notice voice selected by the presenter passes duck: true, including informational
voices that retain the ui category and informational visual severity. The audio engine also keeps
alert as a backward-compatible default ducking category. Duck depth is counted per active ducking
voice; ambient drops by 12 dB and combat drops by 10 dB over 0.08 seconds, then both restore over
2.0 seconds only after the last ducking voice ends. Presenter-admitted under-attack voices bypass
the generic spoken cooldown because the presenter is the sole owner of their incident admission.
Spatial voices in combat_self and combat_other share a combat-only radial profile. Its acoustic
reference distance a is the renderer-neutral listener reference distance capped at 1280 world
pixels, so zooming farther out changes visual framing without expanding the foreground combat mix.
Gain stays at 1.0 through 0.4a; beyond that, effective distance grows four times as fast, yielding
0.5 gain at 0.5a and about 0.143 at 1.0a. Low-pass interpolation and a 0-to-30 voice-priority
penalty both advance from 0.4a to the 1.2a hard-drop boundary. Active voices retain their
category so camera updates recompute the same profile with the existing 30 ms ramps. Non-combat
spatial voices retain the original renderer-relative envelope.
The authoritative snapshot’s 32-tile-quantized worldCombatPosition gates one fixed
combat_distant_bed_01 loop on the combat_other bus. Its direction-only spatial profile pans
toward that coarse world point while holding distance gain at 1.0, so camera zoom and map distance
never change its 0.035 voice gain. It has no pitch variation, fades in over 750 ms, and fades out
over 2500 ms. One stable key prevents voice-pool multiplication and allows 30 ms repanning without
restarting; pause, ended-room-time, teardown, and match replacement stop it. The fixed loop reveals
broad battle direction but not exact position, weapon mix, cadence, ownership, or number of fights.
The current derived asset is a first-pass listening placeholder.
hud.js
export class HUD {
constructor(rootEl, state, commandIssuer, audio?, hotkeyProfiles?, clientIntent?, controlPolicy?, camera?)
update(frameViews?) // refresh resources/supply, minimap status, selection, commands
// command card buttons call commandIssuer.issueCommand(...) or ClientIntent facade methods
}
The minimap status row shares its width between the game timer and an idle-worker status capped at
half the minimap width. The status counts live local Workers whose authoritative activity is idle,
shows the active profile’s selection hotkey in parentheses, and remains pointer-disabled. Pressing
the configured hotkey selects the current idle set through normal command-supply admission when the
command surface is writable.
Ability command buttons show whole seconds remaining beside their cooldown clock. The countdown uses the earliest strictly positive authoritative cooldown or charge-recharge timer among selected owned ability carriers, rounded up; it never uses averaged clock arms or normalized progress. It remains visible when other carriers are already ready and disappears when no displayed timer is running. The existing ready/charge count and command availability remain separate. HUD refreshes the countdown on retained buttons without rebuilding the card each second. Compact touch cards show the number alone below the ability label to keep it clear of the hotkey and count badges.
Match passes replay-only showEntityIds selection options through HUD to HudSelectionPanel.
Replay single-selection details show the authoritative entity ID beside the unit kill count
(or on its own stat row for entities without a kill count) for precise bug reports.
The single-selection detail shows last-known remaining resources for Steel and Oil patches and for
the Steel Mine or Pump Jack occupying that patch. Raw patches omit the synthetic 1 / 1 HP display;
extractor buildings retain their ordinary HP bar and numeric HP alongside the resource amount.
The train command card is driven by the first selected production building type, but train clicks
are issued to the selected completed compatible production buildings in round-robin order so a
multi-building selection spreads queued units across its producers. Train and production-cancel
hotkeys honor native keyboard repeat: after the OS repeat delay, repeated keydown events activate
only those repeatable command-card buttons. Legal manual build, train, and research buttons remain
actionable while their red cost is unaffordable: build enters placement and relies on the worker’s
authoritative wait at the site, while train/research append an unpaid queue entry. Selected producers
render prodWaiting as a striped zero-progress bar labeled waiting for resources / supply, and
progress extrapolation stays disabled until the server reports the item paid. Alt-clicking a train button or pressing Alt or Ctrl with its
resolved hotkey adds that unit to one selected compatible producer’s ordered standing repeat list;
pressing Shift with the resolved hotkey removes it from one producer. The server applies each signed
adjustment atomically so rapid inputs allocate distinct producers from current authoritative state.
Each train button shows the authoritative active/compatible producer count (for example 2/3) and
renders one gold rotating autocast swirl per active producer, evenly phase-offset around the ring.
The server spreads additions toward the least-loaded producer and removes from the most-loaded one,
which balances mixed unit ratios while preserving another automatic order when possible. When more
than one unit is active on a building, it cycles through that list after each successful automatic
enqueue. A repeated unit already inserted in the FIFO stays ahead of later manual clicks, and any
Cancel clears the affected producer’s repeat state. Standing repeat controls never create unpaid
queue entries; their swirl remains a policy indicator until a fully funded item is admitted.
Research buttons that unlock production appear directly
below the production button they unlock and disappear once complete. The retired AT Guns research
leaves the Engineering Complex Q slot empty, while Artillery retains its stable W slot. A dependent button unlocks for queueing when
its prerequisite is complete or already present earlier in the selected building’s authoritative
prodUpgradeQueue. Cancel walks selected producing
buildings in reverse round-robin order for the displayed producer type. Selecting an owned building
under construction shows a dedicated construction card with Cancel in the bottom-right C slot.
An unfinished production building also shows its production buttons with primary training disabled,
while Alt/Ctrl/Shift production hotkeys can assign standing repeat production for after completion;
an unfinished Training Centre or Engineering Complex shows its research buttons and accepts research
into its bounded FIFO, which remains unpaid and inert until construction completes;
click selection prefers the scaffold over an overlapping builder, and cancellation returns the full
construction cost. The Scout Plane affordance is a Resource Depot and Command Car world-point
ability on the C grid slot (beside Breakthrough on the Command Car). It unlocks after the Scout
Plane Engineering Complex research completes, costs 38 steel / 56 oil from a Resource Depot or 63
steel / 94 oil from a Command Car, disables while that carrier has an active Scout Plane cooldown,
and issues immediately rather than entering a building production queue. Scout Planes are
hit-testable for hover/readout purposes but normal
selection, box selection, control groups, right-click commands, and command-card descriptors filter
them out, so they are unselectable and uncontrollable in live play. While the Scout Plane ability is
armed, the ground overlay draws an advisory line from the launching carrier to the cursor and a
dotted ring around the carrier for the plane’s maximum 30-second travel distance; targets outside that
ring remain valid and produce sorties that expire before arrival.
Unit abilities remain on their declared grid slots in mixed selections rather than spilling into an
unrelated empty hotkey. When abilities collide, Artillery Fire has the lowest command-card
priority: Mortar Fire replaces it on X.
The support-weapon Set Up command has a fixed Z slot when selected Anti-Tank Guns or Artillery
are present and that slot is available. Mortar Teams never expose setup controls or setup targeting.
A Mortar Team uses its packed pose while moving and deployed pose while stationary as presentation
only, without an authoritative setup transition. A selected Mortar Team draws its 5-to-17-tile
full-circle range band. Artillery-only selections expose Fire and Set Up together.
Command identities are stable and split by scope: global tactical/navigation/production-control
buttons remain un-namespaced, while build, train, research, and ability buttons emitted for a
faction catalog use the local player’s faction id as the command-id prefix.
config.js exposes the client-side faction catalog mirror used by command-card descriptors:
workerBuildablesForFaction, trainableUnitsForFaction, researchableUpgradesForFaction, and
commandCardAbilitiesForFaction. scripts/check-faction-catalog-parity.mjs compares those
descriptors with the Rust catalog dump for every client-exposed faction. Unknown valid faction ids
fail closed in command-card data, so future factions do not inherit Kriegsia build, train, research,
or ability buttons before their catalog is intentionally exposed. The client mirror is a checked
projection, not lifecycle admission: normal lobbies on every deployment expose a faction selector for
human seats with Kriegsia and Cultivators options; Ekat is omitted. Cultivators uses the shared
Resource Depot and Worker rules with the faction-specific Nexus and Serf labels in
selection, build, and production UI. Its Nexus uses dedicated white-lotus sect architecture with
team-tinted roofs; the Serf retains shared Worker art. Other factions retain Resource Depot art.
Its Portal reuses the retired Proving Grounds stone-and-timber gate atlas. The Jade Silk Gate
fills its opening with an opaque, slanted aperture behind the frame and three counter-rotating
additive sprites sharing a single 256×256 raster texture (256 KiB RGBA). A static polygon mask
keeps the effect underneath the lintel, pillars and platform, with no grass gaps. The texture is
generated once per renderer; animation updates only sprite transforms and opacity. Pooled roots
follow normal visibility/sweep handling, and renderer teardown releases the shared texture.
The effect remains dormant on construction scaffolds. Proving Grounds is absent from the playable
Cultivator build menu and server construction catalog. Replay lobbies hide the selector, fixture-only ids remain test harness
data, public AI controls do not expose a faction selector, and local prediction remains disabled
for unsupported local faction ids such as the current Ekat slice.
Generation is not required as long as the parity check remains a required gate comparing every
client-exposed descriptor against the Rust dump.
Internally, config.js is a facade over config/timing.js, config/presentation.js,
config/rules_mirror.js, and config/factions.js. Runtime modules should keep importing
config.js; internal config modules are in the pinned rules-mirror area and may import only
protocol.js or same-area config modules.
minimap.js
export class Minimap {
constructor(canvasEl, state, camera, fog, commandIssuer, inputRouter?, {clientIntent?, commandsEnabled?})
render(frameViews?) // draw terrain + fog + entity blips + viewport rect
markArtilleryFiring(event) // transient global artillery icon from artilleryFiring events
inputZone() // router zone for locked/unlocked minimap interaction
updateCommandTargetPreview(shiftKey?) // stationary setup refresh using live modifier state
// click/drag -> camera.centerOn or issue move command (right-click)
}
commandsEnabled may be a boolean or a zero-argument predicate. When state.controlPolicy is the
lab policy, the minimap uses that policy so lab operators can issue minimap commands even though
their start payload remains spectator-shaped.
Snapshot-backed aboveFogReveal units draw again above the minimap fog with their ordinary unit
icons, so a firing-revealed Rocket Truck remains visible there for its authoritative reveal window.
lobby.js
export class Lobby {
constructor(rootEl, net, audio?, { ensureConnected?, disconnectWhenIdle?, autoRefreshLobbies? }?)
show(), hide()
// owns lobby state, manual pre-join browser refresh, latest-row join preflight,
// ready/start/spectator role, and delegates browser DOM to lobby_browser_view.js and
// joined-roster DOM to lobby_view.js.
// The joined desktop lobby uses three columns: a narrower vertically stacked roster, match setup,
// and docked ephemeral room chat. Team cards use compact one-line seats and team-scoped AI add
// buttons; faction controls and redundant roster/summary counts are omitted.
// The selected map's checked-in 512px production-minimap JPEG and creator credit remain visible
// above the custom selector. Hosts can select; guests can open the same catalog and preview every
// option, but each row is marked unavailable and cannot change the authoritative map.
// Name-field edits are debounced, persisted locally, and sent through Net.setName while joined.
// Replay lobbies are keyed by explicit `kind: "replay"` metadata: the joined view hides
// Ready, team, faction, AI, map-selection, and active-seat controls, then shows the selected map,
// its preview, only spectator occupants, and the host start control while the server reports
// canStart.
// Teams are layout groups only; player colors come from each player record.
refreshLobbyBrowser() // one GET /api/lobbies request; never starts a timer
joinReplayLobby(room) // lazily connect, then join a persisted replay lobby
onGameStart(cb) // main.js subscribes to transition to game screen
}
lobby_browser_view.js
export function sortLobbySummaries(rows)
export function formatLobbyAge(createdAtUnixMs, nowMs?)
export function lobbyStatusLabel(joinState)
export function lobbyActionLabel(joinState)
export function lobbyJoinIntent(row)
export function validateLobbyName(rawName)
export function suggestLobbyName(playerName, existingRooms?)
export class LobbyBrowserView {
constructor(rootEl)
render({ rows?, loading?, loaded?, error?, nowMs?, actionsDisabled?, onCreateLobby?, onJoinLobby? })
destroy()
}
export class LobbyCreateModal {
constructor(hostEl, { onSubmit? })
open(trigger?, { initialValue? }?)
close({ restoreFocus? }?)
setError(message)
setPending(pending)
destroy()
}
The hidden-tab title changes to Lobby ready to start only for a joined host whose room can
start and contains another ready human player. AI seats and spectators do not trigger this alert;
the original title returns when those conditions stop holding or the tab becomes visible.
The ordinary pre-join lobby browser loads once when shown. It then refreshes at most every five seconds only while the document is visible and the player has generated pointer, keyboard, touch, or scroll activity within the last 30 seconds. Hidden or inactive tabs stop the timer and abort an in-flight list request; visibility or new activity resumes with a fresh request. The manual Refresh button and join-action freshness preflight each remain available. Explicit launch URLs skip this lobby-list loop. The app also leaves the WebSocket closed on an ordinary lobby page until Create, Join, Watch, Replay, or an explicit launch URL requires it. An open, unjoined connection is closed when the page becomes hidden so its heartbeat cannot extend the Fly Machine idle tail. If an established ordinary-lobby socket closes, the app silently resets the joined room UI to the main lobby browser; dedicated launch URLs and active matches retain their existing disconnect handling. An unexpected disconnect in a dedicated launch or active match raises a small, draggable, non-blocking connection-loss notice instead of relying on the transient toast. The notice can be dismissed and disappears automatically when a socket reconnects; intentional idle lobby disconnects do not show it. A fresh socket does not resume an existing match seat. The create modal derives its default from the player name and the latest browser rows, adding the first free numeric suffix when that suggestion is already listed. The create endpoint repeats that selection atomically and returns the authoritative room name, covering stale lists and concurrent creates before the client joins the reserved room. While connected, pointer, keyboard, wheel, and foregrounding input emits a transport-only activity notice at most once every 30 seconds so local-only camera interaction also prevents a false AFK disconnect.
The browser keeps in-progress rows labeled In match and exposes a spectator
action for joinState: "inGame"; clicks still preflight against GET /api/lobbies before sending
join with spectator: true. Replay rows are detected from explicit kind: "replay" metadata,
labelled Replay, and joined as spectators. Replay staging rows join without replayOk; active
replay rows use their explicit Join replay action as confirmation and send replayOk: true, so
the viewer enters the room’s current shared playback without a second prompt. This applies both to
persisted replay rooms and automatic post-match replay playback. Countdown, stale, and unknown rows
remain disabled.
match_history.js performs one initial Recent Matches fetch and exposes a manual Refresh
button; it never polls. It renders the API-provided Replay # for each visible row. The
server calculates that one-based sequence across the full filtered history, oldest first, while
the table remains newest first; therefore the latest visible replay has the highest number. Saved
debug or solo replays do not consume a number. It launches persisted match replays by POSTing
/api/matches/{id}/replay, then hands the returned
__match_replay__:* room to App/Lobby.joinReplayLobby instead of redirecting the page into
replay playback. App replaces the address with /replay/{id} and retains that dedicated-launch
state through playback, so the address is a durable, copyable match link rather than a transient
room link. Opening or reloading the route resolves the stored match through the same POST: the
server returns its existing active replay room or creates a fresh room after disposal/restart.
Direct replayArtifact URLs still auto-join the saved artifact playback path; legacy replayRoom
URLs represent transient replay staging lobbies.
The replay lobby UI is group-watch only: future playable resume work needs separate seat-claim
controls and must not infer playable seats from replay lobby occupants or hidden active rows.
main.js starts App; app.js owns the on-demand Net and persistent Audio, derives the ws url
from window.location, and shows Lobby; after the server confirms entry into a live or replay
lobby it prepares the compatible renderer behind the still-visible lobby. During a normal
multiplayer matchCountdown it sends matchLoadReady only
after renderer initialization and required assets complete. One exclusive renderer-preparation
slot owns that pre-match resource. Every start settles the slot before creating another renderer:
a compatible live or replay match atomically adopts it, while Lab, failed, or superseded paths
destroy it and await teardown. Ownership then transfers to Match, which remains responsible
for renderer teardown. This preserves the invariant that #viewport never retains an abandoned
preparation alongside the active renderer. Warmup failures are logged to the browser console. On
start App creates Match or ReplayViewer. A bounded
?snapshotStream=<id> developer launch injects SnapshotStreamNet instead: it fetches a same-origin
.rtsstream artifact, emits its static start payload, and clocks the contained exact MessagePack
snapshot frames through Net._onMessage without constructing a WebSocket. This local benchmark lane
therefore keeps the normal decode, GameState, Match, Pixi, HUD, minimap, audio, and rAF paths while
explicitly excluding live server simulation and delivery. Its header is a local artifact contract,
not an extension of the server wire protocol.
/stress-test is the shareable automatic wrapper around the canonical Hellhole snapshot stream.
It warms and resets the existing frame profiler, measures one bounded window, saves environment and
phase diagnostics, and uses Chromium’s JS Self-Profiling API for a sampled trace plus SVG flame
graph when available. Hidden or unfocused attempts are discarded and restart after the tab returns;
other browsers save the phase-timing fallback. The complete cross-file route,
artifact, privacy, API, persistence, and input-limit contract lives in
client-stress-tests.md.
match.js builds
GameState, ClientIntent, Camera, Renderer, Fog, HUD, MatchInputRouter, Minimap,
MatchNoticePresenter, Input, starts the rAF loop
(compute alpha from snapshot timing, camera.update,
audio.setListener, input.update, buildFrameEntityViews, fog.update, renderer.render,
hud.update, minimap.render); on each snapshot it applies state and triggers transient event
audio exactly once; on gameOver show the victory/defeat overlay with the frozen score table. Replay
spectators instead see a winner headline built from the winning score rows (for example,
Alex has won), while an actual replay draw remains Draw. When the authoritative result carries
a decisive conclusion, a smaller line below the headline names who gave up, was eliminated, lost
all their buildings, or lost their primary base. The score table
includes a Team column, highlights every row matching winnerTeamId, and falls back to winnerId
for singleton FFA compatibility.
For spectator starts without command-surface permission, match.js keeps the selected-unit panel
visible with a read-only command card while hiding the give-up action. Click selects a
unit or building, drag selects multiple units, and Shift adds to or removes from the selection.
Single-entity details include units killed and current production or research progress. Read-only
Lab viewers share this inspection panel. Passive cards use the first selected real owner’s faction,
resources, and completed upgrades from the projected playerResources row; mixed-owner selections
only contribute that owner’s entities to the card. Ability cooldowns and autocast indicators and
production auto-build indicators remain visible. Completed research stays on building cards with
a check mark and appears as player research in single-entity details. Passive cards expose no
command intents, secondary actions, hotkeys, or targeting previews; HUD dispatch also rejects
commands without command-surface permission. Live spectators and replay viewers use the same path. The client computes local fog from the server-filtered
union snapshot and keeps the ordinary renderer/minimap/HUD pointed at snapshots with
playerResources. Lab operators also retain a real command card through
LabControlPolicy.canUseCommandSurface(state) while prediction stays disabled and issue-as
remains the command authority. Spectators still receive admitted notice toasts and minimap alert
pings, but the match-owned notice presenter suppresses notice audio so observers do not hear player
callouts. Repeated under-attack events in one match-scoped incident are admitted once across toast,
minimap, and audio together.
artilleryFiring events are forwarded directly to Minimap.markArtilleryFiring; the minimap draws
the artillery rig icon above fog for every recipient without using it as entity visibility.
Match composes a render-only clock and injects it into Renderer. Fixed-realtime play advances
it at 1×. Authoritative room-time state changes its continuous rate so paused or ended rooms freeze
battlefield animation time and positive playback speeds scale it without a visual-time jump.
Interact fixed capture may explicitly suspend
the ordinary rAF loop, replace only that render clock with a monotonically advanced capture clock,
render with interpolation disabled, and then restore the normal clock and rAF ownership. Renderer
rig sampling, deployed-weapon transitions, frame strips, recoil, command feedback, smoke,
projectiles, impacts, muzzle flashes, and miss toasts use this clock. Snapshot receipt stamps,
network latency, frame health/profiling, input deadlines, audio, daemon idle, and browser/server
timeouts deliberately remain on real monotonic time; fixed capture never patches
performance.now() globally.
The initial fixed-capture inventory intentionally excludes minimap pings/artillery markers, pointer/selection debounce feedback, HUD wall-clock labels, and audio. Those surfaces continue to use real time and are hidden or out of scope for the clean Pixi viewport artifact. Any future fixed capture of them must extend the injected seam explicitly rather than changing their clocks as a side effect.
Contextual Pump Jack hover.
With an Engineer selected, the ordinary right-click action resolver also supplies a
ClientIntent.contextualBuildPreview when the click would issue Pump Jack construction.
The feedback view projects it through the existing one-tile placement drawing without arming
placement mode. Moving off the oil hit area, changing selection, dragging, targeting another
command, or hovering UI clears or suppresses the hint. The hint identifies the command; the
server still validates construction when the order arrives.
Tank selections expose Point in the bottom-middle command slot (Grid X, Classic RTS O).
Existing mortar/artillery commands retain priority in mixed selections that share X.
Point is available without research and uses the normal targeted-command click/cancel flow on
both battlefield and minimap. Only selected controllable tanks are sent in pointTanks.
The cursor selects one shared heading from the tanks’ center, keeping their hulls parallel.
Point immediately stops previous movement and holds that heading; Shift appends it to the order
queue on both battlefield and minimap. Following queued orders wait until the hull finishes turning.
While Point is armed, a live ground arrow runs from the arithmetic mean of selected, living,
controllable tank positions to the cursor. A center dot remains for a zero-length direction.
The preview follows current camera projection and minimap targeting, and clears on cancellation
or command completion.
4.1a Targeted ability mode (Smoke, Mortar Fire, Artillery Fire, Scout Plane)
input/commands.js exposes _onAbilityTarget and _refreshAbilityTargetPreview for world-point
abilities. When the HUD command card calls ClientIntent.beginCommandTarget({ kind: "ability", ability }),
the input module enters targeted cursor mode:
- Pointer moves call
_refreshAbilityTargetPreview: compute which selected units are eligible carriers (ABILITIES[ability].carriers), test whether any carrier is within range of the cursor, and for Artillery project the firing position it will path to from the authoritative origin or the origin projected from queued movement stages; updateClientIntent.abilityTargetPreviewfor renderer feedback. The Smoke preview radius uses the active command owner’s completed upgrades, including during Lab control, so Smoke Plus previews the server-created 4-tile cloud. - Left-click normally builds a
useAbilitycommand with the ability name, filtered carrier ids, world coords, and thequeuedflag (from Shift). Artillery Fire accepts either click-click or press-drag-release: the initial press/click fixes the raw center, pointer distance selects a radius from 6 to 15 tiles (3 to 15 after Artillery Fire Control), and the second click or drag release sendsartilleryFire. The battlefield and minimap use the same gesture semantics. The server owns movement/setup execution and radius clamping. The local feedback marker stays on the clicked center, while out-of-range previews show the projected movement leg and future setup cone. Clear cursor mode unless the resolved command-card hotkey is still held for repeated world-point targeting. - Tapping and releasing the resolved world-point ability hotkey before clicking keeps targeting armed until the first unqueued world click. That click issues the ability and clears targeting unless Shift is still preserving queued targeting.
- If the selected unit’s owner-only ability affordance includes an active return object, the command
card sends
recastAbility(ability, readyIds, targetObjectId, queued)directly instead of arming a world-point cursor. The server remains authoritative for the availability tick and destination validity. - While the resolved hotkey remains held, repeated left-clicks keep the current selection intact and keep targeted mode armed so multi-selected Mortar Teams and Scout Cars can distribute repeated point commands without the next click falling back to normal selection.
- Right-click / Escape: cancel cursor mode through
ClientIntent.endCommandTarget(), including while cursor lock is active. - Minimap right-click or targeted left-click also fires the same ability command if in targeted mode, including Shift queueing and the artillery raw-click/locked-feedback split. Minimap hover is allowed to omit full per-gun artillery cone or blanket previews rather than drawing simplified feedback that could disagree with world targeting. Selected owned Mortar Teams also draw dotted firing-range circles even when the Fire command is not armed. The Mortar Team Fire command has no context action or autocast state; every shell is issued manually through the normal target click.
client_intent.js holds commandTarget (null or { kind, ability }), ability previews, and a
small local planned-stage map keyed by unit id. The local map stores only pending move, attack-move,
setup, and Artillery Fire stages needed for queued preview origins; it is not serialized
and never replaces server orderPlan. abilityTargetPreview is null or { ability, mouseX, mouseY, carriers, rangeOrigins, pathOrigins, returnMarkers, hoverInRange, artilleryLocks? }.
artilleryLocks is advisory client data for selected Artillery only: per-gun current/projected
origin, clicked center, projected firing position, future/redeploy facing, whether movement is
needed, and whether the center is inside the deployed current cone. commandTarget is a transient UI state;
abilityTargetPreview is rebuilt every mouse move from the cursor world position and the current
selection. Server-projected complex
ability world objects are stored separately as state.abilityObjects from
Snapshot.abilityObjects. They are authoritative, fog-filtered data for return-marker, Magic
Anchor, and line-projectile rendering, so the client must not infer gameplay authority from local
preview state.
Range preview rendering (renderer/feedback.js, _drawAbilityTargetPreview):
- While in targeted ability mode, draws a dotted range ring (normally
rangeTiles × tileSize) around each eligible carrier. Scout Plane instead derives its advisory ring from plane speed multiplied by its total lifetime; the ring does not clamp or reject farther targets. rangeOriginskeeps normal range rings tied to carrier units, whilepathOriginsadds the carrier-to-cursor Scout Plane route and can add server-projected origins such as Magic Anchors for multi-origin line-shot previews.returnMarkerscan draw owner-visible dash-return markers while the dash ability is armed.- Artillery Fire draws the current artillery cone when the clicked center is in range and inside a deployed gun’s cone. Otherwise it draws the future setup/redeploy cone toward the center, plus a dashed movement leg when the gun must enter range. After the first click it draws a flat translucent light-blue target area, a dashed boundary, and a center-to-pointer guide. The circle begins at six tiles, or three after Artillery Fire Control, and grows only when the pointer moves farther than that minimum from the center, up to 15 tiles.
- At the cursor position, draws the ability-specific target feedback: smoke uses a 2-tile cloud radius, Magic Anchor uses the configured anchor radius, and Ekat Line Shot draws projected path segments from every current origin. Feedback is colored green when in range of at least one carrier, grey when out of range.
Ability object rendering (renderer/feedback.js, _drawAbilityObjects; drawn on the same ground
overlay container as smoke clouds, below selection rings and HP bars):
- Each frame, iterates
state.abilityObjects(the latest snapshot’s fog-filtered object list). - Return markers draw as small blue ground marks; Magic Anchors draw as persistent diamond-shaped ground objects with the full configured radius, circles, and particles for every viewer who can see the anchor, including enemies without owner-only state; line-projectile/debug objects draw as small red circles when projected.
- Ability objects are never routed through entity selection, minimap blips, HUD command-card state, or local prediction. They disappear when absent from the next authoritative snapshot.
Ground decal rendering (state_ground_decals.js, renderer/decals.js; durable layer decals
between terrain and trenches, transient corpse layer corpses immediately above trenches):
- Decals are checkpointed server state. Snapshots expose a fog-safe, perspective-scoped revision plus a bounded repeated tail for immediate ordinary discovery. Reliable range requests repair late joins, reconnects, replay seeks, perspective changes, missed revisions, and cache recovery without replaying transient events.
- Infantry deaths stamp translucent player-tinted SVG paint masks. Vehicle and support-weapon
deaths stamp neutral charcoal hull-shaped scorch masks with smaller, subdued player-colored paint
fragments. Destroyed buildings stamp neutral charcoal rectangles exactly matching their rendered
footW×footHfootprint at the map’s tile size, with a charcoal core eroded by deterministic soot, edge bites, and ash breakup rather than straight fade bands, but no player-color fragments. - Mortar impacts stamp a compact, air-burst-style starburst with a small dark center; artillery impacts stamp a larger starburst scaled to their authoritative impact radius. Both are neutral earth/charcoal marks, with no source owner or hidden-source recovery.
- Moving or pivoting tanks leave paired tread marks. Every currently visible tank paints precise client-local marks from ordinary fog-filtered entity poses, while the server retains a coarsely quantized and hard-capped historical approximation for refreshes and later discovery. Historical chunks are discovered through physical fog like other durable ground marks, so a player later visiting unseen ground learns the tracks without learning them through fog. The contact model advances independent belt phases, stamps the full long contact patch, and paints additional shear during pivots. Marks use a faint translucent earth tint and exclude road tiles for both live and later-discovered history; known road-only history is skipped before rasterization. Separate 512-world-pixel tread tiles avoid repeatedly uploading the whole-map death/impact canvas during continuous movement.
GameStateretains normalized records keyed by stable server id and queues only newly learned records. Match stages the pending batch before presentation assembly and releases it only after a successful backend presentation; Pixi stamps detached frame records and never consumes the shared queue. Repeated snapshot tails and stable ids make skipped presentation frames harmless; a skipped network range beyond the bounded tail leaves a revision mismatch that the reliable repair path resolves. The client never infers hidden deaths or impacts.- The renderer stamps each new-decal batch into one downsampled texture, updates that texture once per stamped batch, and draws the accumulated marks as one sprite. Old decals are not iterated or redrawn during normal frames.
Renderer.groundDecalDiagnostics()exposes the permanent layer’s stamped count, pending count, texture update count, texture dimensions/downsample, layer child count, asset-load status, and tread tile/segment/upload counts for contract tests and local profiling.Renderer.destroy()clears the decal and tread-tile textures/canvases and cancels late atlas loads so rematches start with a fresh blank decal layer.
Trench terrain rendering (renderer/trenches.js; layer trenches between ground decals and
resources):
- The latest authoritative
state.trenchessnapshot is rendered into one downsampled canvas texture and mounted as one sprite, following the permanent ground-decal path used for blood and scorch marks. Reconnects, replay seeks, and fog-memory updates therefore restore trench ground from snapshots instead of relying on client-only historical effects. - The trench texture is redrawn only when the normalized trench snapshot changes. Normal frames do not iterate or redraw old trench pixels, so hundreds of accumulated foxholes stay one display object and one cached texture.
- Trenches draw as separate neutral brown circular foxhole decals: opaque low-poly dirt footprints with interior dark facets for depth and subdued dirt highlights. They do not draw yellow rim strokes, exterior drop shadows, oval footprints, or deterministic connection strokes between nearby foxholes.
- The renderer skips invalid records and does not create per-trench display objects.
- Occupied eligible infantry also draw a small brown rim marker around the unit using the existing selection-ring pool. This marker is a provisional readability pass and does not replace selection color, HP, ownership, or fog rules.
Smoke rendering (renderer/feedback.js, _drawSmokes; layer smokes between unit bodies and
selection rings):
- Each frame, iterates
state.smokes(the latest snapshot’s fog-filtered cloud list). - Each cloud is rendered as layered translucent grey/white circles (overlapping offset blobs) with a dark semi-transparent core so the cloud reads as a LOS blocker without obscuring own unit selection rings or HP bars above the fog overlay.
- Transient
smokeLaunchevents add a local fast black canister arc from the scout car’s launch position to the target point. The canister lifetime uses the server-provideddelayTicks; the actual smoke still appears only when the authoritative cloud arrives in a later snapshot. - Non-finite coordinates are skipped.
- The render layer is cleared each frame so expired clouds vanish automatically when they drop from the next snapshot.
4.2 Rendering & look (PixiJS rigs — neutral PS1 field-command style)
Experimental Rifleman graphics. Game settings includes Use experimental graphics, a
localStorage-backed switch that defaults on in the lobby, live matches, Lab, spectators, and
replays after the one-time rollout below. It switches world Rifleman rendering and sets camera elevation to 55 degrees above
the ground (35 degrees of battlefield tilt from vertical) during a match. Disabling restores top-down projection. It does not alter simulation, HUD portraits,
or minimap icons. The experimental Rifleman stays upright with perspective-scaled body click bounds, muzzle
origins and health-bar anchors. Other world artwork shares the tilted ground plane. The render-worker presentation preference
experimentalGraphicsEnabled is a boolean and remains independent of detailed-shadow settings.
The default-on rollout stores rts.experimentalGraphics.v2 on first normal startup,
intentionally enabling graphics once for both new browsers and browsers with older v1 choices.
Later settings choices persist explicitly as 1 or 0; choosing off is never reset on later
startups. Storage-unavailable sessions default on. The rtsExperimentalGraphics=0|1 preview
URL override does not migrate or overwrite the saved preference.
Assets load when experimental graphics are enabled; the normal Rifleman remains visible until that load completes.
Disabling restores normal routing immediately, including when an earlier load finishes later.
rifleman_sixteen_metadata.js selects the user-approved sixteen-heading cartoon set under the
experimental flag: S, SSW, SW, WSW, W, WNW, NW, NNW, N, NNE, NE, ENE, E, ESE, SE, SSE,
clockwise from screen south, in 22.5-degree steps. Its 320 cells contain four idle, eight running
and eight firing poses per heading.
rifleman_eight_animation.js uses snapshot-aware movement, body bearing while running and
weapon bearing while stationary. The existing 350ms presentation-only first-shot windup and
native muzzle effects remain; server damage, audio and attack timing are unchanged. Targeted
units retain an aimed hold between shots. Trench occupants retain the existing lowered-body
mask, scale and aimed hold. Unloaded Panzerfaust soldiers share this rifle presentation;
loaded launcher handling and other infantry retain their own strips.
Each frame retains its authored ground origin and muzzle point. HP bars clear the transformed
visible frame bounds. Upright static Lab frame strips with authored poseGeometry.frameBounds
also publish their visible top and use the upright HP anchor, rather than the legacy unit radius.
The mortar-directional-prototype Lab profile retains one historical, static NE view for material,
scale and ground-origin review; it does not select art for ordinary matches or claim directional
or animation completeness. Its provenance is in mortar-directional-candidate-v1.
Experimental mortar graphics now selects all sixteen user-approved directions
in mortar-approved-sixteen-v1, with the same model-carriage registration and the
requested 15% increase (8.05 world pixels/metre). N/NE/E/S/W retain their previously
merged textures exactly; the other eleven fill the remaining 22.5-degree bearings.
Every gameplay state holds the static assembled art;
no setup, movement, recoil or loading animation is implied. The existing default
graphics and server-owned gameplay/effect timing remain unchanged. The family
uses per-heading texture versions, model-derived snapped shadows and wheel
contact footprints. mortar-approved-sixteen exposes the same family in the Lab;
mortar-approved-five retains the prior partial family for comparison.
Thirteen animated, model-derived boxes cast the Rifleman’s matching pose’s detailed
shadow; the foot oval is disabled. Selection stays at the authoritative ground position.
Fixed and magenta paint layers are separated before premultiplied area filtering, preserving dark
uniform coverage and natural equipment. Runtime assets, raw sheets, exact prompts, guide model,
selected NE/SE registration references and user approval evidence are preserved under
client/assets/rigs/rifleman-c-eight-cartoon-v1/ and rifleman-c-intermediate-cartoon-v1/.
The user approved the complete sixteen-direction playable Lab on 2026-11-29.
node scripts/art/combine-rifleman-sixteen.mjs combines those approved sources without changing
covered pixels, physical scale, muzzle points or shadow boxes. It trims only transparent cell padding
and translates cell origins/bounds equally, keeping world registration identical while fitting
320 cells into 2040×1984 textures (102×124 cells, 20 columns). The two source packs retain their
raw sheets, prompts, exact guide inputs and rebuild scripts. Older prototype sets remain
authoring/test references.
See unit-sprite-generation.md for generation and matte checks.
This section owns the current Pixi look and module behavior. Renderer-neutral camera, presentation, ownership, capture, backend, parity-gate, and benchmark contracts live in client-rendering.md and its active rendering parity ledger.
-
Game settings persist a minimap-only size slider in
rts.minimap.size. The default retains the responsive canvas size; maximum fits within both 50vw and 50vh, retaining its square aspect ratio. CSS recalculates on resize and orientation changes; on tiny viewports the half-screen cap takes precedence over the default minimum. The live backing canvas follows the displayed size at a minimum 2× resolution (or the device pixel ratio when higher), with smooth CSS scaling. Explicit PNG captures keep their requested resolution; teardown restores the original dimensions for rematches. Pointer coordinates still map through the backing size. -
Minimap roads reuse the world’s deterministic dark-charcoal surface variants so revealed terrain stays visually coherent. Authored marked-road tiles draw small yellow centerline dots above fog, keeping the route network legible in unexplored territory; the dotted overlay is a cached static layer, while bare road tiles widen the charcoal surface without adding markings.
-
Authored tree doodads draw compact, dark cartographic pine symbols centered on their foliage bounds rather than their grounded trunk anchors. The cached forest layer renders beneath minimap fog, so trees are clear in current vision, dim when explored without vision, and nearly hidden when unexplored; roads, resources, and foreground player markers remain above it for tactical readability.
-
Minimap units use the renderer-authored team-colored HUD portraits as their only marker path. Production atlas parts follow independent body/weapon aim and recoil; frame-strip units use the production facing convention for their current animation frame. At a 480px backing size, riflemen are roughly 18px and tanks 53px, with a 1px white silhouette outline; dimensions scale with backing resolution.
Matchinjects the image loader,MinimapUnitIconscaches loaded assets and outlined portraits, and each frame draws the current position/facing without throttling. Pending images never fall back to dots. Portrait loads run one per host task: parts the current frame draws go ahead of primed animation frames, so first sight of an army cannot freeze presentation while SVG portraits and their embedded sheets decode. The loader hands each self-contained SVG to its image as a Blob URL (byte-identical to the former data URL, without percent-encoding embedded sheets). Failed/pending loads participate in Interact readiness; teardown aborts loads and releases canvases.Matchinjects a renderer-ownedcreateMinimapAnimation()collaborator: it samples production rig transforms and frame strips usingGameState’s visual clock and shot recoil envelopes, including weapon-specific rifle fire and machine-gunner setup/teardown frames. The world renderer and minimap sharesupportWeaponSetupVisualtransition timing. Atlas sprites and strip frames are cached per kind/color, with continuous pose transforms applied at draw time. Minimap pose compilation and image preparation omit atlas cells explicitly declared blank: the tank’s two transparent track overlays do no work, while hull, turret and independent barrel recoil remain visible. This does not alter world track marks. Repeated drawing passes reuse one sampled pose per entity per frame. Teardown clears pose, setup, and raster caches. The offline minimap exporter uses this same drawing path with a native image loader. Buildings use their owner’s assigned player color, retaining cost-scaled boxes and the merged white outline mask; resources retain their previous markers. Foreground owned entities draw above resources; legacy vision-only intel remains below authoritative fog. Under-attack notices retain their red ring/white rim and flash the affected unit’s silhouette white (or the building box) on the existing timed phases. -
Layers (back→front): terrain → ground decals → trench terrain → transient infantry corpses → local visual samples → resource nodes → building shadows → buildings → building overlays → unit shadows → occupied-trench shadows → occupied-trench lips → units → smoke/ability ground effects → selection rings → health bars → fog overlay → local visual-sample labels → shot-revealed units → damaged actionable-reveal health bars → command/hover feedback and miss toasts → placement ghost and Lab ruler → selection drag-box → (HUD is DOM, not Pixi). Occupied-trench shadows and lips render only when the snapshot’s
occupiedTrenchIdmatches authoritative trench terrain; orphaned ids do not synthesize client-only trench geometry. The below-unit occupied-trench berm cue renders at 115% of the authoritative trench radius as a dark irregular basin beneath concentric 360-degree outer-rim, dirt, and inner-shadow bands. The outer band has a black keyline and twelve lightly irregular radial dirt facets wrap the full circumference. Miss toasts use reduced text and stroke sizing, a smaller horizontal offset, and less upward drift so they remain closer to the receiving unit. Selected unit range rings, minimum-range rings, and support-weapon field-of-fire overlays use higher-opacity rendering for readability. -
Spatial combat audio caps its acoustic reference distance at 1280 world pixels so extreme zoom-out cannot expand the foreground mix. It stays full volume through 0.4 acoustic reference distances, attenuates and muffles toward a hard drop at 1.2 distances, and receives a monotonic distance-priority penalty outside the near region. A separate global, 32-tile-quantized combat point gates and pans one quiet generic combat-bed loop at constant gain, so distant activity remains perceptible and broadly directional without preserving exact event location or composition. Non-combat spatial behavior and the global 48-voice pool remain unchanged. Panzerfaust launch and impact events use dedicated low-gain spatial cues with coarse cooldown buckets; generic Panzerfaust loaded-shot attack events and projectile travel stay silent so the weapon does not reuse Tank/Rifleman/artillery sounds or spam clustered fights. Existing spoken server notices explicitly duck ambient and combat buses while they play; nested notice voices hold the duck until the final voice ends, then release over two seconds. Tank coax
weaponKindfeedback uses machine-gun burst audio instead of Tank cannon audio, and it does not register as a sustained Machine Gunner loop. Tank coax tracers use a bright machine-gun line with a hot core, smaller muzzle flash, and tail styling. The coax barrel is a short separated stub. ArtilleryweaponKindfeedback uses the artillery firing sound instead of the generic rifle fallback, and the optional weapon hint is forwarded to recoil timing. Authored main-cannon and coax muzzle anchors use sampled rig-part transforms so feedback origins follow the visible barrel tip during recoil scale and kick. -
Kriegsia Resource Depot, Barracks, Training Centre, Engineering Complex, Steelworks, Vehicle Works, Steel Mine, and Pump Jack use footprint-scaled raster atlases. The one-tile extractors use modular fixed-color components: the Steel Mine swings a pickaxe once per 40-tick harvest period, while the front-facing Pump Jack rocks its separate beam once per three harvest periods and both rest while inactive. Other building atlases compose a fixed full-color base with a grayscale mask extracted from authored white paint and tinted to the owning player at runtime; brick, doors, windows, machinery, outlines, and material shading stay fixed. Selected perspective buildings supply blurred, offset silhouette shadows instead of rectangular footprint shadows. Supply Depots, Zamok, and asset load failures retain their non-raster paths. Tank Traps retain their procedural path with normal graphics; experimental graphics selects the approved four-view neutral steel atlas once its texture is ready. Production progress bars and queue labels remain imperative overlays, while construction and deconstruction status uses the shared HP bar layer. Building art carries identity without a separate abbreviation stencil.
-
Units: SVG-authored rigs remain authoritative for Worker, Golem, and Ekat. Production PNG strips or atlases are authoritative for Rifleman, loaded Panzerfaust, Machine Gunner, Anti-Tank Gun, Mortar Team, Artillery, Scout Car, Scout Plane, Command Car, and Tank. Command Car uses a team-tinted outer body over a fixed gold radio deck and rank-star layer while retaining its native SVG shadow and Breakthrough aura. Rifleman and Machine Gunner PNG movement frames advance only when a fresh authoritative movement sample arrives or their rendered position changes. Observed movement remains latched for 100 ms so 60 FPS rendering does not alternate movement and idle art between 30 Hz snapshots; paused, blocked, or otherwise stationary units then return to idle art while firing recoil frames remain active. The Anti-Tank Gun uses a composed white-base PNG atlas for its carriage, barrel assembly, and deployed trail legs, with raster-native metadata supplying its animation and anchors. Artillery likewise uses a modular A-19 PNG atlas for two independent trails, its frame/wheels, and its visibly elevated bulky barrel/recoil assembly; the current pass-03 review pitches the complete weapon assembly toward the elevated camera so its muzzle face and recoil depth remain legible from the above-view camera. It temporarily colors the left trail purple and frames both full trail crops in black for pivot/origin inspection. It uses raster-native setup/facing/recoil metadata and a native Pixi muzzle-flash overlay. The Anti-Tank Gun uses the shared 90% brightness/saturation team tint target, with most firing recoil on the barrel assembly and only subtle kick on the frame and legs. Adjusted frame-strip color texture loading falls back to the raw Pixi asset path when image, canvas, pixel-read, or texture creation fails. When browser image dimensions are unavailable, full strip dimensions come from frame metadata. Deployed Machine Gunners use
firingFramesduring active recoil, with the visual-effect buffer’s linear recoil phase advancing the clip through rest, recoil, and reset frames. Setup and deployed frame-strip poses take priority over movement frames while support weapons are deployed or tearing down. When a setup/deployed Machine Gunner snapshot lacksweaponFacing, the frame-strip setup forward-angle offset is applied to the unit body facing. Native Pixi shadows, status cues, and weapon effects may occupy routes that an atlas intentionally does not cover. If visual override registry or selector resolution throws, the renderer records diagnostics, publishes local visual-profile errors, and renders the normal unit art for that frame. Stale routed instances are removed when an entity id no longer needs them. The SVG and PNG runtimes share one sampled render context per entity draw so renderer-local motion state advances once. Units use low-detail hard-edged silhouettes tinted by player color, a dark drop shadow, dark outline, HP bar above when damaged/selected, and glowing selection ring when selected. The Game settings toggle can instead keep every visible unit and building HP bar on, including at full health; raw steel and oil patches never show HP bars, while Steel Mine and Pump Jack extractor buildings do. Damaged-only remains the default. Normal HP fills use the owning player’s color, and black internal dividers split the span intoround(maxHp / 15)whole cells (at least one). Any remainder is distributed across those cells rather than drawing a fractional final cell, so each cell represents approximately 15 HP. Those cell dividers use 0.75-world-pixel marks so they remain visible across camera scales and display resolutions; every seventh existing divider uses a heavier 1.5-world-pixel mark to identify approximately 105 HP without adding another mark. Construction and deconstruction keep their existing status colors on the shared bar layer. Detailed Unit Shadows are a default-enabled Game setting with a persistent opt-out. The v2 preference key resets legacy opt-outs once so existing players also receive the enabled default; subsequent opt-outs persist. Matches without an explicit preference also default on. When disabled, the render worker skips every per-unit model projection and units retain their lightweight native rig shadows. When enabled on any map, simple presentation-only box models for supported units rotate with each unit and project along the authored sun vector into one GPU coverage layer. Their cuboid faces are a retained instanced mesh: each frame streams one compact transform record per model box instead of rebuilding Pixi Graphics polygons. The R8 coverage target is limited to the current camera window at half-world-pixel resolution, snapped outward with a two-texel linear-filter gutter; it does not scale with total map area. The terrain shader remaps world receivers into that window and composites the mask with its separate static-height ray march. Flat maps also project detailed unit shadows using their authored sun or the shared default. Entrenched units retain their player-color tint while scaling down. Occupied trenches add shadow and lip overlays around live units; empty trenches retain only the base decal. Pixi places tree canopies and unit bodies in one sortable world-Y layer: smaller/northern Y values draw first, so a southern tree or unit naturally covers a northern one. When any received ordinary unit occupies an authored concealment tile, or its readability footprint intersects a foreground concealment tile, the renderer redraws that unit’s current production rig/frame into an alpha-only filter that emits a white outer edge and an 85%-opacity flat owner/team-color silhouette above the canopy. Friendly, allied, and visible enemy units use their respective owner colors. Decorative tree PNG overlap alone does not trigger the outline, so the cue remains synchronized with the map’s authoritative concealment mask. AuthoritativevisionOnlyconcealment reveals omit their rig from the normal full-color layer and route the same current rig/frame through a dedicated white-edge-only filtered outline layer above fog and canopies; damaged reveal HP stays above fog as well. These readability passes use only already-admitted entities and do not reveal hidden enemies. When the in-match Game settings tab enables unit ranges, selected ordinary units draw dotted firing-range circles, selected artillery always draw one dotted maximum-range circle regardless of setup state, and deployed Anti-Tank Guns draw field-of-fire wedges while packed Anti-Tank Guns do not. An enemy deployed Anti-Tank Gun observed through ordinary vision or an above-fog firing reveal draws its field-of-fire wedge as sparse amber-orange diagonal hatching with a contrasting keyline and no blanket fill. Friendly selected field-of-fire wedges retain their unhatched blue treatment. Losing vision freezes the last enemy position and facing as thinner, lower-contrast very-pale-pink stale-intel hatching, so live/stale state does not depend on red-green hue perception alone. Server-authoritative per-player memory clears when that player’s team observes the remembered position empty or observes the same gun moved, packed, or destroyed. Live spectator, Lab, and replay observer switches select the requested player’s independent memory store, including through checkpoint-backed time travel; the browser does not accumulate or invalidate this intel. Threat relationships come from the authoritative snapshot’s singleplayerResourcesowner, so a rapid view switch keeps the old fog, entities, memory, and threat relationships together until the new projection arrives. All-player, multi-player, and omniscient views show no player-relative enemy cones. A Command Car’s faint speed-boost aura ring is visible only while that Command Car is selected; active Breakthrough always shows the bright ring. In Lab scenario authoring, deployed Anti-Tank Gun field-of-fire wedges remain visible for the currently selected owner even when the broad unit range overlay is off. Distinct silhouette per kind (engineer: compact block; rifleman: enabled no-backpack PNG frame strip with frame 0 idle, frames 1-3 moving, and frame 4 firing; machine gunner: enabled PNG frame-strip experiment with carried movement frames and setup/deployed frames; Panzerfaust: an eight-frame loaded strip with the matching five Rifleman poses plus three wind-up poses until launch, then the normal no-backpack Rifleman strip; Anti-Tank Gun: wheeled gun; mortar team: crewless M1938-inspired small wheeled mortar that travels low and deploys upright; scout car: boxy WW2-style truck silhouette with enclosed wheels and a rear-top machine gun; tank: chunky flat-shaded armor with movement-facing tracks, hull, nose, and shadow plus weapon-facing turret, main barrel, coax barrel, recoil, and nose tick; artillery: modular A-19 PNG components animated from raster-native support-weapon metadata). Riflemen normally carry a rifle; Panzerfausts withpanzerfaustLoaded: truecarry a tube launcher with a team-colored band and switch immediately to normal rifle art after launch. WhilepanzerfaustWindupProgressis present, the loaded strip selects its three authored back-to-shoulder wind-up frames in thirds; the rifle is absent, the final aim faces the target, and the server’s normalized progress naturally plays the sequence over 15 ticks normally or 12 ticks with Methamphetamines. The wind-up soldier was uniformly scaled to 60 percent linear size so its neutral-white pixel area matches the walking soldier before the shared team tint. Both white-base Rifleman strips use the shared 90% brightness/saturation target before team tinting so production unit paint has a consistent tonal weight. Their torso-centered sprite origin sits 10 world pixels ahead of the raw frame center. Frame 4 is shown only for the opening 20% of the recoil envelope (about 84 ms for a rifle shot) and shifts the whole sprite four world pixels backward before returning to the standing or movement pose. Anti-Tank Guns field a wheeled anti-tank gun with a long recoiling barrel, carriage, two wheels, and permanently attached rear trails. Packed trails stay folded behind the carriage; setup swings them outward, pauses, then snaps the final 10° into place. World sprites and minimap layers share the same opaque assembly, hinge transforms, and setup/teardown clock (120/40 ticks at 30 Hz), mirrored from the rules constants. Machine gunners carry an MG42-style long machine gun across the body while packed that extends forward with bracing during setup/deployment. Units that fire from outside presentation vision remain actionable server-side but their reveal-only tile stays absent fromvisibleTiles.GameStaterecognizes the projected enemy on that presentation-dark tile and marks itaboveFogReveal, preserving normal interaction while showing it above the unchanged fog at full opacity, using its normal art path, rig-authored recoil where available, and a yellow tracer to the hit point. Only the final 20% of event-backed fallback reveals fades out; snapshot-backed actionable reveals remain fully opaque until the server removes them. PNG frame-strip units use a shared load-time color profile target inrenderer/rigs/frame_strip_color_profile.js; each strip records any brightness/saturation already baked into its checked-in runtime PNG, and raw strips receive the missing delta once when the texture loads. Production white-source units converge on the Command Car’s 90% brightness and saturation target; baked source adjustments are compensated at runtime so they reach that same rendered target without regenerating otherwise accepted art. PNG atlas rigs can also declare a worker-saferuntimeColorAdjustment. Scout Car uses one complete white-painted body frame with dark rubber, cabin, outlines, and mechanical detail left in the same generated image; the ordinaryteam-lightmultiply tint recolors the white material while naturally leaving those dark pixels dark. Its separately animated rear machine gun remains fixed neutral metal, and its 90% brightness/saturation target is applied at runtime rather than baked into owner-specific palette frames. AttackweaponKindselects feedback scale and rig muzzle origin; TankCoax uses a small machine-gun flash/tracer/tail from the authored coax muzzle anchor and the Scout Car’s 160 ms gun recoil along commander facing. Its independent recoil channel preserves overlapping cannon recoil without kicking the hull or cannon on machine-gun shots, while TankCannon or default Tank attacks use a direct tracer from the main muzzle anchor plus the tank rig’s half-scale artillery-style muzzle flare. Direct-shotmissevents draw a tinyMiss!Pixi text toast above and to the right of the receiving unit on the feedback layer. The client anchors it only to the current projected entity, so hidden or no-longer-visible targets do not gain inferred positions. Mortar launch events draw launch dust/recoil for recipients that can see the mortar, a black shell arcing from the mortar to the impact point, and a darker red dotted line/crosshair warning that lasts until the reported shell delay elapses or the impact event arrives. The shell compresses near launch and impact and stretches near mid-flight so it reads as an overhead round rather than a flat tracer. Mortar impacts draw a larger, denser, longer-lived dust cloud with an orange-yellow blast core that fades before the dust so battlefield state remains readable. Mortar Team art uses the enabled PNG wheeled-mortar atlas with a team-tinted carriage/frame and tube/barrel assembly, fixed-color tire overlays, and separate carriage/tube recoil bindings. Mortar impact events that include a shooter reveal show the mortar briefly above fog for players whose units or buildings were hit by indirect fire. Unit entities markedvisionOnlyby the server omit full-color unit art and draw only the white alpha edge of their current production rig/frame above fog, with damaged HP above it. They remain excluded from local fog-source computation and selection/command hit-testing. Current death-vision entities are normal visible entities and do not use this flag. -
Buildings: selected structures render from footprint-scaled PNG atlases with fixed-color art, broad white-painted team-tint surfaces, and silhouette-derived shadows. They do not overlay abbreviation stencils; their art and silhouette carry the gameplay identity. Normal Tank Traps remain procedural neutral steel hedgehogs; experimental Tank Traps use the approved grounded four-view sprites, model-projected shadows and translucent ground/contact marks, with no team tint. Under construction → translucent with a single HP-layer status bar whose fill reflects authoritative
buildProgress(including Resource Depot-linked extractor progress) rather than the scaffold’s independently damageable current HP; production → small top-edge progress bar. Completed Tournament Grounds waiting for entrants show four admission slots immediately below the health-bar position, filling one per disciple; the slots are replaced by the ordinary production bar when the tournament starts. Entrant slots render only when the recipient’s snapshot includestournamentEntrants. Tank Trap deconstruction uses that same HP-layer status bar and drains from full to empty viadeconstructProgress. Tank Traps render as neutral steel I-beam hedgehogs with deterministic per-id rotation. Owned scaffolds may locally extrapolatebuildProgressonly while the latest authoritative snapshot marks thembuildActive; the display clamps below completion and never unlocks supply, tech, production, pathing, or command behavior before the server snapshot. Live pause state freezes both construction and production progress extrapolation for every recipient, and the active display clock resumes from the first authoritative post-unpause snapshot without counting paused wall time. Completed damaged/selected buildings use the same HP-layer bar for normal health. -
Resource nodes: steel = tan supply crates; oil = olive fuel drums; show last-known remaining from
resourceDeltasvia size/opacity. When a worker is selected and the cursor hovers a resource, draw a blue circle on the resource when the nearest completed own Resource Depot is inside mining range; draw a red/dashed line to the Resource Depot when too far. -
Tanks: render the hull from mirrored client
TANK_BODYconstants (50.4pxlength,28.8pxwidth,1.5pxclearance) so the visible body, selection ring, click target, and advisory build preview match the server’s oriented vehicle body. Track tread offsets advance from actual interpolated movement and hull turn deltas: both tracks forward/backward for drive/reverse and opposite track motion for pivot turns. Vehicles have no movement-fuel cue or lifetime oil-spend row because movement does not consume oil. -
Scout cars render from mirrored client
SCOUT_CAR_BODYconstants (40.8pxlength,21.6pxwidth,1pxclearance), matching the authoritative oriented vehicle body used for collision and click targeting. -
Terrain: muted grass/field, three gravel surfaces, three dirt surfaces, three mud surfaces, frosted ground, rock, water, and deep charcoal-brown road tiles use deterministic coarse detail so movement is readable and the map has a PlayStation 1-era low-resolution texture feel. Gravel uses chips, dirt uses flecks, mud uses broken churn/pool marks, and frost uses sparse cold wisps; all ten keep edge-free interiors. Distinct passable surfaces share deterministic low-resolution transition bands: the higher-ranked material creeps into the lower-ranked material, with the normal production style using five-band stochastic opaque-pixel dither. The stable visual order is road, grass, gravel, dirt, mud, then frost; road marking variants are one surface and never seam against each other. A checked-in Lab showcase profile suppresses fog presentation over a dedicated authoritative terrain matrix for side-by-side material review without changing authoritative terrain or recipient state. Rock and water never blend; they retain dark navigation outlines, including one single-width separator where rock meets water. Road uses one bare tile plus horizontal, vertical, NW-SE diagonal, and NE-SW diagonal tiles with a simple yellow center-line segment. Authors intersperse marked tiles among bare centerline tiles to form dashed markings while bare road tiles fill the surrounding surface.
-
Pond water (
renderer/water.js) ports Jess Hammer’s MIT-licensed generated shader and painted textures fromclient/assets/water/pixel-water/; that directory records provenance, binding changes, palette adaptation, and noise regeneration. Its water-only mesh remains beneath world objects and fog and receives the world sunlight warmth tint. The submitted visual clock drives animation in matches and the Map Editor, and asset readiness includes the shader and textures. Shore distance supplies stepped visual depth without changing authoritative terrain. -
Grass (
renderer/grass.js,grass_baked_carpet.js) defaults to selected material 9: an eight-pose baked grass atlas with anchored roots, smoothly blended bending poses and a wind lookup. Cloud shade and curved, irregular traveling light fronts use the original world-space procedural formulas shared with the other procedural grass styles ingrass_lighting.js. Three material texture reads replace per-fragment neighboring clump/blade reconstruction. The 256×2048 RGBA8 atlas and 128×128 wind texture occupy about 2.06 MiB and are created once per layer; the current presentation clock drives blending every frame. The softer blades, repeating blade artwork, and simpler clump shadows are an accepted visual tradeoff documented in the rendering ledger. All ordinary matches, replays/spectators and Map Editor previews construct this grass-only mesh at map load, beneath decals/units/fog, and advance it with the same presentation clock as water. Editing terrain rebuilds grass geometry when grass membership changes; map replacement and renderer destruction free its mesh, shader and owned atlas/wind/lighting textures. No simulation or fog rules change. Flat maps retain the selected preview’s appearance. Elevated maps cache RGB lighting ratios from the existing terrain relief/optional baked-shadow pass and apply them to the animated grass; supported unified terrain/unit shadows still composite on the decal layer above it. No lighting texture is allocated for flat maps. The ratio field approximates the prior terrain’s additive altitude tint on the new grass palette and is rebuilt when editor terrain or sun changes. -
Animated distance-field swash (
renderer/shoreline.js,shoreline_swash.js) is the shared match/replay/spectator/Map Editor shoreline default: textured sand, a damp bank, and broken shore-following wavelets. An early signed-distance rejection skips procedural noise outside a conservative -40px/+32px band; uniform land/water maps allocate no field or GPU resources. The original full-map geometry, field resolution, and animation cadence remain unchanged; preserving geometry avoids interpolation rounding changes at fractional zooms. The overlay stays above grass/water and below world objects/fog, including after async water loading. Map edits/replacement and teardown invalidate/free its mesh, shader, and distance texture.shoreline-study-1throughshoreline-study-3remain Lab alternatives via the boundedshorelineTechniquevisual profile field. This never changes terrain codes, pathing, or fog. -
Lab-only
grass-survey-1throughgrass-survey-11profiles can override this renderer default through the boundedgrassTechniqueselector. Profiles 6–8 remain dense-carpet alternatives; 9 selects the default animated atlas; 10–11 retain profile 5 blade/gust/shade parameters over static brushed or earthy ground. The default does not resolve a Lab profile or enable its terrain-preview fog reveal. -
Local lab visual profiles may pass renderer-only static samples to
Renderer.render. Static trench samples draw on the local visual-samples layer, labels draw as world-anchored Pixi text above the fog overlay, and neither path writes toGameState, snapshots, fog-source entity lists, selection, command targeting, minimap blips, or scenario authoring data. -
Local lab visual profiles may also pass per-instance real-unit visual overrides to
Renderer.render. The generic override compiler remains available for SVG-authored units, but the checked-in candidate registry is empty and PNG-backed units do not carry duplicate vector candidates. Overrides replace only the candidate rig definition used by real unit drawing, keep runtime inputs such as movement, facing, weapon facing, recoil, setup state, occupied-trench tint, selection, HP bars, fog, and shot reveals on the real entity, and are resolved from checked-in profile/candidate registries rather than URL-provided assets. -
Local lab visual profiles may pass checked-in frame-strip overrides by unit kind or by the live rig key derived from authoritative entity state. Rig-key overrides apply only while that route is active—for example, a loaded Panzerfaust override stops matching as soon as
panzerfaustLoadedflips false at launch—then normal live frame-strip routing resumes for the same entity id. These swaps remain local to that lab session; server state, selection, fog, HP bars, and the native shadow route remain unchanged. -
A checked-in Lab visual profile may set
mapTiltDegreesto hold its review camera independently of the Experimental Graphics preference.Matchapplies it at initialization and retains it when that preference changes; profiles without a camera override preserve the usual camera behavior. The anti-tank candidate and exact-model comparison profiles use 35 degrees from vertical (55 above ground). Their directional support strips keep generated carriage/leg pixels fixed during recoil, translate the separate upper assembly in the packer, and add a small renderer-owned whole-unit kick. The body, contact/model shadows, muzzle and HP clearance share that presentation offset; authoritative entity positions do not move. -
Shadow-only Lab comparisons may supply
groundContactPointsByFramealongsideshadowVolumesByFrame. The frame-strip instance redraws these retained contact shapes only when the selected pose changes and applies its existing snapped facing and recoil offset. Anti-tank grounding profiles compare lower/flattened casters, model-derived sloped trails, and source-art-registered contact pads; none changes the sprite pixels, camera, registration, orders or normal routing. -
Explicit unit-kind frame-strip overrides precede live rig-key overrides, so reviewed Panzerfaust presentation survives authoritative ammunition consumption. Bounded checked-in
directionalStripspages share snapshot-aware facing and animation clocks; body, fog outline, muzzle effects and HP placement use the same rendered page. Page changes within apanzerfaustFamilyIdpreserve rifle target/raise state. Experimental graphics selects the user-approved combined cardinal/diagonal Panzerfaust family; the matching cumulative Lab profile remains available alongside the prior-family comparison. All eight authored headings have loaded/spent running, rifle fire and launcher handling; the diagonal page additionally alternates two approved idle breathing frames on the render clock. Spent idle reuses rifle low-ready. The eight intermediate bearings still snap to their nearest authored heading. Simulation and fog authority are unchanged. -
Fog: unexplored = 80% dark overlay so terrain remains faintly readable; explored-but-not-visible = 48% dark overlay; visible = clear. Use a single overlay sprite/graphics updated from
foggrids; soften edges if cheap. -
Selection: green for own, red tint for enemy, yellow for neutral. Drag-box translucent green. While Attack targeting is armed over a visible or remembered completed neutral Tank Trap, known traps inside the four-tile clear-area preview receive red attack-target rings and a dashed red boundary shows the radius before the click. Clicking emits the contextual
clearObstacleAreacommand; it has no separate hotkey and ordinary terrain A-clicks remainattackMove. Remembered building proxies are kept outside the ordinary selection scene and are eligible only for this attack-target lookup, so stale silhouettes do not become selectable live entities. The preview is advisory: the server resolves the objective from authoritative current/remembered intel and dynamically prioritizes only traps that become currently actionable. -
Renderer failures must fail soft: one broken entity or feedback effect should log a throttled
[RTS_RENDER]error, skip that visual path, and let the rest of the frame continue. Broken entity art draws a magenta/black checkerboard fallback instead of stopping the match loop; the frame loop also reschedules after unexpected client errors and logs[RTS_FRAME]. -
Keep a cohesive muted palette; define colors in
config.js. -
Art must stay faction-agnostic: no Soviet, German, Nazi, imperial, national, or unit-branch iconography. Avoid flags, stars, crosses, eagles, skulls, sickles, hammers, and historically specific insignia.
4.3 Client architecture workflow
Client modules are organized by area and checked by node scripts/check-client-architecture.mjs.
The checker classifies every client/src/**/*.js file, reports the largest files and fan-in/out
baseline, rejects unclassified files, and rejects cross-area imports that are not allowed by rule or
by an explicit allowlist reason in the script. It also rejects production reads or writes through
removed GameState intent shims such as state.commandTarget, state.placement, and preview
update methods; use injected ClientIntent or a renderer read model instead.
Current areas:
app-shell:main.js,app.js,match.js,match_startup_inbox.js,prediction_runtime_startup.js,match_combat_audio.js,match_ability_audio.js,match_notice_presenter.js,match_room_time.js,match_net_reporter.js,match_observer_diagnostics.js,match_settings_context.js,match_settings_toggles.js,match_auto_spectator.js,auto_spectator.js,client_perf_report.js,match_health.js,frame_profiler.js,frame_recovery.js,frame_entity_views.js,live_pause_overlay.js,observer_analysis_overlay.js,observer_analysis_preferences.js,observer_analysis_research.js,observer_analysis_rows.js,observer_analysis_signatures.js,floating_panel_positioner.js,replay_controls.js,replay_seek_notice.js,room_time_panel.js,replay_viewer.js,lab_control_policy.js,room_capabilities.js,visual_profiles.js. App’s browser leave confirmation is scoped to active running live-player matches; spectator, Lab, replay, and resolved/stopped sessions leave without the prompt.model:state.js,state_runtime_reset.js,state_queries.js,state_visual_effects.js,client_intent.js,command_budget.js,command_composer.js,prediction_controller.js,prediction_compatibility.js,prediction_frame.js,sim_wasm_adapter.js.transport:net.js,protocol.js,lab_client.js.rules-mirror:config.jsplusconfig/timing.js,config/presentation.js,config/rules_mirror.js, andconfig/factions.js.ui: HUD, command card descriptors/selection panels, hotkey profiles/editor, lobby controller/browser/roster views, match history, minimap, resource icons, scoreboard, status badge, branch staging, lab panel, lab setup authoring helpers, settings. Command-card tooltips render optional unit descriptions when descriptor metadata provides them. Command discovery includes the Engineering Complex research-chain context so direct-hotkey and settings catalogs keep Artillery in its permanent W slot. Wait-until-ready ability descriptors remain available for queue-admissible carriers, including Mortar Fire while it is cooling down. Lab research controls render direct per-upgrade toggle buttons for the selected Lab target player; completed upgrades render as pressed buttons with a check-mark background. The Lab panel window toggle button shows Collapse when expanded and Expand when collapsed. Lab and room-time panel collapse controls activate immediately on touch release, suppress the follow-up synthesized click, cancel pending activation when the pointer leaves or cancels, and reset activation state on teardown or re-render. On narrow viewports, the default Lab Options and Tools headers sit below the expanded room-time controls, and their collapse buttons remain touch-friendly. Mobile restore ignores saved desktop coordinates for both Lab windows and room-time controls while preserving saved collapsed state. The settings panel uses the in-match header action slot for Give Up in live matches and Back to Lobby in Lab/replay sessions. After a finished match, App resets the Lobby controller to the root browser before showing the lobby screen again. Lobby AI creation is exposed from the roster’s team context, not as a duplicate global sidebar action. The in-match debug status badge displays live and rolling one-minute FPS metrics fromMatchHealth.input:input/plusreplay_camera_input.js;input/camera_navigation.jsis the shared command-free camera gesture helper for live input and replay/observer wrappers. Locked native-cursor routing sends clicks through both settings chrome and the game screen, and preserves pressed-button state across macOS drag events for routed pointer moves and gameplay selection drags.renderer:renderer/.platform: bootstrap, including/labcatalog route detection, direct launch URL parsing for scenario/map/seed and sanitized lab visual profile ids, audio, combat audio, alerts, fog, camera, prediction settings, unit range settings,report_window_aggregate.js.
Import rules:
protocol.jsand theconfig.jsfacade are shared mirrors and may be imported where needed.- Internal
config/modules are for the facade and same-area config imports; runtime modules should not bypassconfig.js. - Files in the same area may import each other.
app-shellfiles may compose other areas; prefer adding new cross-area wiring inmatch.jsorapp.jsinstead of importing collaborators from feature modules.- Lab UI and transport lifetimes stay in
App:match.jsmay receive lab metadata/control policy, but must not importlab_client.jsorlab_panel.js. Lab setup tools may include inspection units and completed-research toggles; normal faction catalog membership and production/research command-card exposure are still owned by the Rust rules catalog and client rules mirror. - Non-shell cross-area imports should normally become dependency injection through
Match,App, or a facade. If one is intentional, updateALLOWED_CROSS_AREA_IMPORTSinscripts/check-client-architecture.mjswith a reason.
Future client changes should use this checklist:
- Did this add a DOM/window listener, timer, WebSocket handler, Pixi object, texture, or other GPU
resource? Add or update
destroy(), and make sureMatch.destroy()or the owning shell calls it. - Did this add a non-shell cross-area import? Prefer dependency injection through
Match/App; if an import is still the right tradeoff, add a checker allowlist reason. - Did this change command-card behavior? Add descriptor coverage or DOM contract coverage for the visible command-card contract.
- Did this change rendering? Run the client smoke suite and add a targeted check where practical.
- Did this touch
protocol.jsor Rust-owned values behind theconfig.jsfacade? Update the mirrored server file and the relevant design/context docs in the same change.
Large-file handling is ratcheted, not churn-driven. Do not split a large file only to reduce byte count. When adding behavior to an already large file, first look for a focused collaborator, descriptor, or area-local helper that reduces coupling. Update checker baselines or allowlists only with a written reason in the script and the change handoff.
Client-related suite selection lives in tests/select-suites.mjs. For client/src/ changes it
selects client-architecture, js-protocol-contracts, node-minimap-input-contracts, and
client-smoke; client transport/protocol changes also select node-server-integration.
Architecture-policy files such as scripts/check-client-architecture.mjs,
tests/select-suites.mjs, and plans/archive/client-arch/* select client-architecture.
Docs-only changes select docs-only unless another rule applies.
4.4 Launch URL conventions
App-owned launch URLs use the rtsLaunch query parameter as the mode switch. rtsLaunch=match
drives a normal live lobby through existing lobby messages rather than introducing a debug protocol:
the browser joins the requested room, applies safe setup options, and starts only after ordinary
server lobby.canStart is true. The convention is intentionally namespaced so future launch modes
can coexist with replay, lab, and dev-scenario URLs.
Supported match-launch parameters:
rtsRoom=<room>optional public room name. If omitted, the client generates a safe AI self-play room name. Reserved internal room prefixes are rejected.rtsRole=spectator|playerdefaults tospectator.rtsName=<display name>defaults toSpectatororCommanderfrom the selected role.rtsMap=<map display name>optionally selects a server-advertised lobby map before seating AIs.- Repeated
rtsAi=<team>:<profile>entries seat AI opponents in order, for examplertsAi=1:ai_2_1&rtsAi=2:ai_turtle. The default player-facing profile isjeffs_ai_v1_1;ai_2_1is internal-only.ai_turtleis accepted only for internal observer launches; player-role launches normalize it tojeffs_ai_v1_1. A profile-only observer entry such asrtsAi=ai_turtleuses the next team slot. Unsupported values normalize to Jeff’s AI; if omitted, the launch defaults to two Jeff’s AI seats on teams 1 and 2. rtsStart=1|0defaults to1.0prepares the lobby without pressing Start.
Example spectator self-play URL:
/?rtsLaunch=match&rtsRoom=agent-ai-selfplay&rtsRole=spectator&rtsAi=1:ai_2_1&rtsAi=2:ai_turtle&rtsStart=1
When that launch produces an all-AI live match, the score screen retains the live matchRunId
through automatic post-match replay playback and renders it as an Observation ID. The id is the
handoff key for replay recovery and server lag-log inspection; it is not a player identity or a
new gameplay control.
Disciple insight presentation
Disciple insight and Dao fields pass through the detached presentation entity snapshot to the Pixi worker. A blue-on-red insight bar appears below HP; evolved paths use the candidate B thin-katana strip for melee Wind, and the Dao-specific Magic C hooded spellcaster strip. Original Wind A archer assets remain preserved for reuse. Magic runs with arms swept back and its mantle trailing; their old chevrons/pentagram are removed. War uses the larger armored candidate B Yari strip (idle, two walking poses, four thrust poses); its legacy red sword glyph is removed. The selected unit shows exact insight and Dao, with a cap of 60 before evolution and 200 afterward. Evolution resets insight to zero; reaching the evolved cap has no effect. Evolution choices occupy grid Z/X/C; classic L/W/C. Buttons remain actionable before research or insight, assign all selected unevolved Disciples, and show the pending path with an active highlight and assigned/eligible count. A new choice replaces the old one; unit details and tooltips show the chosen Dao and remaining requirements. See Dao evolution rules.
Dao presentation and support Shield follow Disciple insight and Dao evolution. The entity-aware frame-strip key also selects HUD/minimap portraits. Actual attack events drive Magic’s four-frame 400 ms cycle, Wind’s four-pose katana swing, and War’s four-pose spear lunge, including weapon aim during movement. War’s firingLungePx:16 adds a smooth local-forward presentation offset through anticipation, drive, extension and recovery. The worker sprite/shadow and minimap sample the same offset; authoritative position, collision and immediate damage timing remain unchanged. disciple_projectiles.js draws an arrow texture at three times its native aspect-ratio thickness, tinted with the firing owner’s assigned color using the owner id captured with the attack event, from a reusable pool and fixed-cost shimmering orb geometry in the feedback batch. There are no per-orb emitters, filters or particle histories. Projectile endpoints are captured from authorized event/snapshot positions, persist for at most 600 ms, and launch at the 100 ms release pose. Unit range overlays show 0.75-tile reach for Wind, 2.75 tiles for War, and five tiles for Magic.
Dao Master animation review
Public daoMaster rank selects three separate eight-frame strips (standing, three
movement poses, four shot-triggered attacks) using the chosen twin-scarf Wind,
forked-spear War and broad-sleeve Magic designs. Runtime world scale is 1.2 times the
corresponding Adept; Master source crowns/torsos are normalized before that multiplier.
Portraits, selection groups, minimap frames and labels use the matching Master rank.
Masters have no further insight meter. See Master review spec.
Novice Charge uses a passive command-card descriptor: always disabled, with the autocast swirl and server-projected cooldown clocks. Passive descriptors have no primary/context action or hotkey and are excluded from the hotkey command catalog. Charge uses an empty ordinary slot after active commands are placed. Full mixed cards omit the passive tile so active commands and the item column retain their positions. Evolution removes the Novice-only tile.
Cultivator carried items
Carried items have no command-card tiles or RFV bindings. Shop purchase controls remain unchanged. With a completed controllable Shop selected, hovering a visible friendly Cultivator fighter at its rank capacity shows “Full” beside the gameplay cursor in white 22px text with a black outline. The hint also follows locked cursors, clears on selection/hover changes and teardown, and is suppressed over UI, during dragging/placement, or when targeting consumable healing. It uses the public equipped-item count; incoming deliveries continue to reserve slots authoritatively at purchase time. Haste, Double Damage, Armor Treasure, and Vitality Treasure are permanent passive effects; Escape Treasure automatically rescues the carrier on lethal damage. Novices and Adepts have three carried-item slots; Masters have six. In-flight deliveries reserve slots, while Healing Seal uses none and Regen uses one. There is no category cap; duplicate copies of the same effect are rejected, including deliveries already in flight. Regen is a permanent passive restoring 3 HP/s; Healing Seal is placed on the ground. Flying goods and minimap delivery markers share the equipped item icon geometry and color. Vitality adds 150 maximum and current HP and persists through Dao promotion.
Private carried-item rosettes use redundant color and vector silhouettes at the exact unit center: Haste is a gold bolt, Double Damage an orange sword, Armor Treasure a cyan shield, Vitality Treasure a green heart, and Escape Treasure a purple return diamond. Icons are nine world pixels with a thin outline. The full five-item rosette places Escape at its center; smaller inventories stay compact in stable catalog order. Layout geometry scales to additional item counts without inventing items or changing inventory rules. Icons remain visible when health bars are hidden and never appear on Shops. They read only projected carried-item entries and the Escape flag, never the public radiance count. Pooled geometry redraws only when inventory changes; world positions update each frame. Separate ordinary/above-fog item layers follow their HP layers and retain the same authoritative visibility rules and eviction/teardown lifecycle.
Selected portraits show small item counts and a purple Escape outline. A focused readout beside the portraits shows the actual unit type, exact loadout, and current Shop oil value (not historical spend). It initially inspects the most equipped selected unit; pointer hover or keyboard focus inspects that portrait without issuing a command or changing selection. Inventory changes refresh the selection cache, and teardown removes inspection listeners. There are no carried-item hotkeys.
Cultivator unit HP groups sit two world pixels lower (half the unchanged four-pixel HP fill height). The shared Serf/Worker kind uses its owner’s projected faction metadata to avoid moving other factions’ worker bars. Non-Master Insight backing is 2.5 pixels tall with a 1.5-pixel fill and starts flush against the HP backing at local y=5. Masters still omit Insight meters. Neither HP placement nor Insight geometry moves the world-centered item rosette or Dao corona. Escape’s existing fog-safe particle burst and trail still render on rescue.
Cultivator fighter radiance uses the public visual strength itemRadianceTier (0–6), counting
distinct carried items and saturating at six. The former three-item glow is now the six-item glow; counts two, four and five interpolate between the former one/two/three-item appearances at counts one/three/six. Only five distinct items currently exist, so six is a reserved visual endpoint.
Identities remain private; hidden carriers reveal no glow. Frame-strip instances dispose their filters.
Client version guard
App owns VersionGuard for the entire page, across lobby and match transitions. The server
stamps rts-client-build into the document alongside its versioned import map. This immutable
loaded-client identity also supplies __RTS_BUILD__; /version must never overwrite it with a
newer server identity. Reliable welcome and heartbeat pong messages compare buildId against
that identity. On ordinary main/lobby screens, a bounded, no-store /version check runs immediately,
every ten seconds, when the page becomes visible or gains focus, and on history restoration,
including without a WebSocket. Network
failures and unknown builds do not count as mismatches. Unsupported snapshot schema/codec versions
also record pending recovery.
Only ordinary main/lobby screens can show the center-screen mismatch warning or refresh. A mismatch
refreshes ordinary browsers and embedded clients using a build-specific page URL, preserving
existing query parameters and fragments. Session storage bounds recovery per client/server build
pair; the URL also prevents repeated automatic navigation when storage is blocked or stale HTML
survives recovery. A Refresh client button remains for manual retry.
Once the loaded client build matches rtsClientBuild, startup removes that query parameter
using history.replaceState, preserving the other parameters, fragment, and history state without
navigation. Stale or unknown client builds retain the marker for refresh-loop protection.
Countdown, asynchronous room startup, live play, Lab (including its entry/catalog), replays,
spectating, previews, and other game-like modes stay untouched: no warning, no refresh, and no HTTP
version probes. Reliable version observations may be retained silently for recovery after returning
to the ordinary lobby/main screen. An existing notice is hidden when entering a protected context.
Offline benchmark transports skip server version checks. destroy() removes listeners, timers,
pending fetch, and notice DOM.
Healing Seal presentation
Healing Seal is no longer sold by the Shop. Authored/checkpointed fields retain their presentation. The selectable 3×3 field renders on the ground beneath units: fixed green
circle, central green plus, layered soft glow, and a two-second render-clock pulse.
The always-visible green bar represents remaining healing capacity, not combat health.
The bottom selection panel says 275 / 400 healing left; no combat armor label is shown.
Existing pooled graphics, snapshot replacement, fog gating and match teardown own its lifecycle.
Shop selection previews use shopDeliveryPreview through the renderer-neutral feedback seam.
Hovering an eligible friendly unit draws a one-pixel dotted line from the completed selected Shop.
Novices, Adepts and Masters have a Buy menu on R; Serfs do not. It leaves selection intact,
sends one automatic purchase per item key/click and stays open after purchase. Return (V),
Escape and selection changes close it. Throw Sword stays on E. The server resolves recipient
priority and in-flight reservations; see Shop.
Both Shop and Buy menu cards attach three small edge tabs (Util / Defense / Offense) to the existing left border, hide
Healing Seal, and use effect subtitles beneath ESC, HP, ARM, +HP, HST and DD glyphs.
hud_shop_card.js owns this submenu’s descriptors; ClientIntent.commandCardMode = "shopBuy"
owns its lifetime. shopDeliveryPreview accepts a single hover segment or { lines: [...] } containing segments
from the lowest-id completed owned Shop to every selected owned fighter while buying.
Only visible snapshot positions feed this renderer-neutral feedback seam. Item subtitles wrap
instead of truncating effect text. The tabs are absolutely positioned on wrappers around each row’s first cell, so the card keeps its existing four-column width, padding, row sizes and responsive grid.
Armor uses S and +HP uses D to fill the former Healing Seal gap. Return uses the V position. Regen’s +3/s and Armor’s +50% ARM subtitles stay on one line.
Flying goods render their existing colored circle plus a tiny 12×1-pixel HP fill from their combat body.
Delivery bodies retain current snapshot positions through the entity-view pipeline, matching the
non-interpolated ability-object circles so HP bars and selection geometry stay aligned in flight.
Vector Field placement
Magic Adepts and Masters have a separate Vector Field command-card ability on C; Ekat retains Anchor. The first left press fixes the field center; drag-release sets direction, or a stationary first click leaves it armed and a second click sets direction. Cursor movement rotates a rank-aware 4-by-4 or 5-by-5 tile preview about that fixed center. Escape/right-click cancel through ordinary target cancellation. Preview and placed field share a large green arrow and rectangular outline with green particles traveling at the authoritative field speed (3 world pixels per tick, or 90 pixels per second).
Charge presentation: renderer/charge_streaks.js draws seven animated translucent, tapered
speed lines behind visible charging Novices, War Adepts and War Masters, beneath their sprites
and below fog. The server’s public chargeActive flag is the sole activation source; it is not
inferred from speed or private cooldowns. Lines rotate with facing and scale with body/rank.
The existing Graphics pool sweep hides inactive/hidden carriers immediately and owns teardown.
Shop item tooltips
Shop and Buy menu items reuse the existing command-button .cmd-tooltip markup and
CSS hover/focus behavior used by training and research. There is no separate overlay,
hover timer, or tooltip lifecycle. Short authored presentation fields (tooltipName,
summary, qualifier) live with CARRIED_ITEMS in config/carried_items.js; cost comes
from the current ability affordance. The shared Shop formatter adds an unavailable
reason only when applicable. Existing long catalog title text remains rules reference
metadata and is not parsed to generate short copy. Rich-tooltip buttons omit native
title popups and retain the title as an accessible label. Shop items use the exact
existing title/cost/description classes, appearance, and button-relative placement
of Barracks training tooltips, without Shop-specific CSS or positioning.
Cosmic Energy and Breakthrough Shop presentation
The resource HUD displays Cosmic Energy with a ✨ sparkle and its current authoritative total, including projected observer player rows. Breakthrough occupies utility E on the Shop/Buy menu, costs 100 oil, and describes a permanent +25% movement aura within three tiles for friendly units. Its carried and delivery icon uses the existing bolt shape and a pale cyan color. Inventory stays private under existing ability-entry projection; public item radiance includes its carried slot.
Rocket Truck eighteen-round firing
The normal Rocket Truck uses the user-reviewed sixteen-heading painted truck, uniformly fitted to its 48-world-pixel chassis length. Three paged team-paint atlases contain nineteen ammunition states; rocketRackCount selects the page/state and facing selects the direction. This replaces the old rack overlay for normal trucks; static Lab review profiles retain their separately selected art. Server launch order is front rank first, six rails per rank, matching eighteen individual visible slots. The existing MortarLaunch event and public fog-gated rack count are unchanged. Client-only launch snapshots retain visible shooter position/facing so each flying sprite starts at its painted rack slot. Missing shooter context falls back to the already-authorized event origin. Rockets slide along the registered rail angle, follow a curved visual path with red exhaust, and end at the authoritative impact point/time. Mortar impact rendering, impact damage, scatter and decals are unchanged. Flight rendering is cosmetic, not a ballistic simulation or an extra damage source.