Client rendering architecture

This document owns the renderer-neutral camera, selection, and presentation boundaries. It is a design contract, not a production-migration roadmap. Current Pixi behavior remains authoritative in client-ui.md, and implementation status lives in rendering-parity.md.

1. Non-negotiable boundary

Rendering work does not change the Rust server, protocol, simulation, fog authority, replay format, or command coordinates. A Pixi worker failure is a visible bounded fatal presentation error for that match: it settles pending work, stops that match’s animation-frame loop, and tears down without selecting another renderer.

2. Semantic camera and projection

All public screen coordinates are viewport-local CSS pixels. DOM offsets, DPR, canvas backing size, engine matrices, and hardware scaling stay inside the adapter. All public numbers are finite; invalid mutation input leaves the current view unchanged.

WorldPoint       = { x, y }
PresentedPoint   = { x, y, heightPx }
ScreenPoint      = { x, y }
ProjectedPoint   = { x, y, depth, clip, visible }
ProjectedExtent  = { width, height, scaleX, scaleY, visible }
WorldBounds      = { minX, minY, maxX, maxY }
CameraSnapshotV1 = {
  version: 1,
  focus: { x, y },
  framingScale,
  boundsPolicy: "mapOverscroll"
}
AudioListenerV1  = { x, y, referenceDistancePx }

heightPx=0 is the authoritative plane. Positive height is presentation-only and never changes the underlying (x,y). clip is inside, outsideViewport, outsideDepth, or behindCamera.

The public SemanticCamera surface is:

project(point) -> ProjectedPoint
groundAtScreen(screen) -> WorldPoint | null
projectedExtent(point, worldWidthPx, worldHeightPx) -> ProjectedExtent
viewportGroundPolygon() -> WorldPoint[]
viewportGroundBounds() -> WorldBounds | null
containsProjected(point, marginCssPx = 0) -> boolean
focusAt(point) -> void
framingForWorldPoints(points, { paddingCssPx = 0 } = {}) -> CameraSnapshotV1 | null
fitWorldPoints(points, { paddingCssPx = 0 } = {}) -> boolean
panByScreenDelta(delta) -> void
dollyBy(factor, anchorScreen?) -> void
setMapTilt(degrees) -> void // experimental projection preference, bounded to 0..45
resize(viewportWidthCssPx, viewportHeightCssPx) -> void
setMapBounds(worldWidthPx, worldHeightPx) -> void
snapshot() -> CameraSnapshotV1
restore(snapshotOrLegacy) -> boolean
audioListener() -> AudioListenerV1
subscribe(listener) -> unsubscribe
projectionSnapshot() -> ProjectionSnapshotV1

groundAtScreen returns null for no valid plane hit and never reuses a previous hit. viewportGroundPolygon is a bounded clockwise polygon or []; its AABB is only a conservative helper, never final selection admission. dollyBy preserves a valid anchor point. New persisted camera data uses CameraSnapshotV1; finite legacy {x,y,zoom} is accepted only at the private restore compatibility edge and immediately normalized.

projectionSnapshot() returns detached {version:1,camera,viewport,mapBounds,perspective?} plus pinned query functions. Fixed perspective snapshots include only finite plain coefficients (fovYRad, pitchRad, focal length, camera distance, and near/far world depths), never an engine matrix. The snapshot contains no live camera, engine, DOM, DPR, or mutable matrix object. The selected backend’s scene and SelectionSceneV1 must use the same snapshot for a presented frame.

The audio listener is the ground focus, with reference distance equal to one viewport width at the focus plane. Navigation, minimap, audio, alerts, control groups, carryover, Lab, observer, capture, and diagnostics use only semantic operations.

Ordinary live-player sessions limit the visible ground footprint to 100 map tiles on either viewport axis. Match converts that tile count to a world-pixel span and both camera adapters combine it with their existing minimum framing scale on every viewport resize. Spectators, replays, Lab sessions, and the Map Editor retain their wider overview ranges.

Experimental battlefield tilt

The experimental graphics preference uses a camera elevation of 55 degrees above the ground, equivalent to 35 degrees away from vertical/top-down (CAMERA.experimentalMapTilt). Both match startup and the in-match toggle use that shared value, alongside the 16-direction Rifleman, MG42 gunner, loaded Panzerfaust and Scout Car artwork. rtsExperimentalGraphics=1 explicitly opts a preview link into this preference at startup without persisting it. Switching it off restores top-down projection. mapTilt always measures from vertical; passing 55 to it would mean a different angle and exceed its current bound. rtsMapTilt=0..45 remains available for isolated angle studies when the preference is off. The tilt is session-local and is not persisted in CameraSnapshotV1. Interact launches accept RTS_INTERACT_MAP_TILT=35 when starting a fresh daemon.

The orthographic base coefficients optionally include mapTilt in detached projection records. Public projection, ground picking, visible-ground polygons and selection queries share the worker’s homography. With centered screen coordinates (u,v), angle a, and focal distance d=3*viewportHeight, projection is (u/(1-v*sin(a)/d), v*cos(a)/(1-v*sin(a)/d)). Camera movement changes the sampled ground; there is no orbit or yaw. The worker draws an overscan ground sheet to a temporary texture, then maps it through a perspective mesh. HUD and marquee remain in screen space. With experimental graphics enabled, tree artwork is inverse-warped around each tree’s ground anchor so its sprite stays upright. Tree shadows and flowers remain on the ground plane; canopies retain their world-Y sorting, fog coverage, culling and teardown ownership. Directional sprite art bakes in its own view: changing terrain tilt does not rotate the character inside a bitmap. New directional generations use 55-degree elevation above ground, with the same camera for standing, running, prone and trench poses; existing sources retain their original generation provenance and require in-game reuse review, especially prone poses. The actual inverse-projected ground span controls live-player zoom limits. GPU resources resize with viewport/DPR and are disposed on teardown. The tilted-plane render texture resizes in place and stays alive across preference off/on cycles until renderer teardown, preserving Pixi bind groups that reference its source.

Experimental infantry preserve the baked sprite shape: feet use the ground homography and bodies use uniform zoom/depth scale. An inverse-projected body quad cancels the sheet’s warp while retaining its world-Y-sorted layer, fog, alpha and canopy ownership. The body click polygon, muzzle origin and health-bar anchor use the same upright offset convention. Directional Rifleman, Panzerfaust and MG artwork retains its 70% visual calibration. On open ground, each frame’s visible lower bound (excluding transparent atlas padding) is translated to the lower edge of its unchanged selection oval. That ground point is the upright body anchor for all headings, moving/firing poses and prone MG frames; world-Y sorting, collision, marquee footprints and command coordinates retain the authoritative entity anchor. Muzzle and HP projection, body click proxies and model shadow ground positions follow the translated body anchor. Trench sinking/clipping retains its existing anchor and is not re-registered to the oval. Stationary Rifleman, Panzerfaust and packed MG hold their first authored idle pose per heading. Idle/breathing source frames remain in their atlases for authoring, but are not played. Locomotion, deployment, launcher handling and firing/recovery still animate. Occupied experimental Riflemen use the approved shallow trench presentation: lower the body 15 local pixels and clip it at ground-local Y=4 after upright prewarping. Keep all sixteen headings, hold the rifle-level aimed pose even without a target, and retain recoil/bolt-cycle animation when firing (skip the lowered raise and return-to-idle poses). Apply this only while the authoritative occupied-trench flag is active. Leaving restores the complete body and releases the mask on rig teardown. Muzzle and health-bar offsets follow the lowered body, and click proxies cover its exposed portion. Contact shadows, collision/marquee footprints and selection rings remain on the ground. The MG uses abdomen registration and a grounded 40×10×2.5 box shadow when prone; its trench setup/firing uses upright poses and the same shallow clipping as Riflemen. Loaded Panzerfausts keep their launcher for movement and rifle fire, equip it during authoritative windup, and return to Rifleman art after launch recovery. New frame origins and muzzle points are explicit packed metadata. Only the experimental preference selects these candidate strips; default graphics retain their existing assets. With experimental graphics enabled, PNG building bodies use the same upright compensation, including every Cultivator atlas (the lotus Nexus, Shop, Portal, Tournament Grounds, Three Dao Pavilion and Technique Library), pump jacks and steel mines. Every atlas part retains its animated pivot, team tint, alpha and authored paint order. Portal silk and its aperture mask share the building anchor so the opening stays aligned. Ground shadows, selection/placement footprints, status overlays, the Healing Seal ground effect, SVG/loading fallbacks, other unit kinds, trees and world labels retain ground-sheet projection. Turning the preference off hides the compensated meshes immediately; pooled rig/container teardown releases their GPU resources.

Experimental tank traps select the user-approved grounded four-view atlas in client/assets/rigs/tank-trap-grounded-v2. Entity ID chooses a stable view; each visible silhouette spans 32 world pixels without changing the one-tile collision/selection footprint. Bodies use fixed neutral steel colors, with no team tint. The three supporting beam ends share the model’s ground plane. Fifteen oriented boxes from that same model provide sun-projected shadows only while the experimental atlas is ready and enabled. A pooled entity-owned ground mark combines a translucent support-triangle imprint with darker patches at the three feet; it never blinks and leaves the actual terrain visible. These marks follow normal building visibility/removal rather than persistent combat-decal history. Normal graphics, pending assets and failed assets retain the existing imperative tank trap.

The same preference selects the user-approved sixteen-direction Tank hull and connected turret/barrel strips. Hull frames follow facing, turret frames follow weaponFacing, each rounded to 22.5-degree steps; the modeled turret-ring offset follows the hull independently. Hull registration uses the measured deck centre and area; turret registration uses the painted body envelope against the same model. Source alpha is preserved without keying out red paint. The new intermediate views were generated together as coherent eight-view component sheets; remaining generated shape differences are accepted in the user approval record. The packed frame origins and muzzle landmarks share the upright projection convention. No firing-state sprites are required: the normal shot clock drives native flash/tracer feedback and a small cannon-only procedural recoil. Missing/pending textures retain the existing Tank rig. Disabling the preference restores the existing Tank art. Scout Cars use sixteen body directions and sixteen independently aimed gun directions, snapped to 22.5-degree steps. The body owns the rear-deck plate, white center marker and corner lines; the plain gun pole stays centered on that mount for every body/weapon pairing. Each body view is registered by its exposed wooden-deck corners using uniform model-area scale and translation. Magenta source regions become the shaded team-paint mask; headlights, wood, tires and mount remain fixed-color. Three conservative body-only shadow boxes come from the same generation model; the gun and pole cast no shadow. Both body and contact shadows snap to the body artwork. A separate ready-Scout-atlas flag preserves the ordinary proxy during loading and when the preference is off. Runtime atlas dimensions are 1920×1920 (32 frames in six columns). Command Cars use the user-approved sixteen-heading experimental strip with subtle recessed rectangular headlights, packed gold radio cargo and two central rear antennas. Body size follows an antenna-excluded body-area registration at the game Command/Scout length ratio (34.8/40.8). The original eight accepted cells remain byte-identical; the user approved the eight intermediate views in the fixed-anchor Scout comparison on 2026-12-03. Normal experimental graphics and the retained command-sixteen-review Lab profile select exactly the same sixteen-view family. The current and historical eight-view strips derive chassis contacts and five conservative cast shadow boxes (including the two antenna masts) from their generation model, snapped to the selected sprite heading. The shared frame-strip shadow override resolver accepts texture-ready experimental vehicle strips as well as explicit Lab overrides, keeping loading/default fallbacks intact. See the Command Car family for provenance, size uncertainty, review scope and deterministic rebuild commands. The other approved Kriegsia NE/SW pairs are archived authoring references and are not selected by this preference. Experimental Tank shadows use three bounding boxes derived from the same posed generation model: hull, turret, and barrel. The hull shadow snaps to the hull sprite heading; the turret/barrel shadows rotate independently around the hull’s turret ring. Model metres use the same packed world scale as the art. The detailed shadow pass receives an explicit ready-Tank-atlas flag, so default graphics and loading fallback retain the older 55×34×33 proxy. Collision geometry is unchanged. These are silhouette approximations rather than the generation model’s wheel, hatch and tube meshes. The contact-shadow ellipse also uses that hull footprint and its snapped heading, including maps without authored sunlight and the detailed-shadow-disabled path. Its geometry is reused while turning. Hull scale is calibrated from upper-deck corner area to the modeled deck’s projected area, instead of fitting the complete silhouette’s principal extent. Turret scale uses painted body area so barrel extent cannot resize the turret. The packer preserves uniform scaling, raw image hashes and the shared ring pivot; generated aspect differences are retained rather than stretched into a different shape.

This extra render pass has GPU/memory cost and is not performance-validated. Map bounds and overview fitting retain their orthographic policy, so map edges may be visible. Other upright unit kinds and trees remain outside this feature.

3. Renderer-neutral selection

Selection is an app-side sibling of the presentation frame and is never sent to a backend:

SelectionProxyV1 = {
  id, kind, owner, selectClass, facing,
  anchor: PresentedPoint,
  footprint: { kind: "circle", radiusPx } |
             { kind: "polygon", points: WorldPoint[] },
  minScreenRadiusCssPx: 6,
  clickFootprint, directClickFootprint, // same shape union as footprint
  clickMinScreenRadiusCssPx, directClickMinScreenRadiusCssPx,
  interaction: DetachedEntityView
}
SelectionSceneV1 = { version: 1, generation, frameId, projection, proxies[] }

Candidates come only from already fog-filtered interpolated views. The producer uses mirrored semantic stats and authoritative building footprints. Authored client-only click geometry is separate from collision bodies and marquee footprints; it never reads runtime asset geometry. Click, hover, entity-target commands, ctrl-in-viewport, control groups, marquee, and Lab entity tools use projected proxies. Ground commands/tools alone use nullable groundAtScreen.

Read-only cursor previews may sample the current semantic projection after camera movement so a visual target remains beneath the cursor. They never issue a command or replace the last successfully presented SelectionSceneV1 used by ground-command input.

The marquee is the actual CSS-pixel screen rectangle. A render failure leaves the previous successfully presented selection scene active. Selection never uses mesh picking, GPU ids, asset bounds at runtime, shadow proxies, or fresh mutable state.

input/click_geometry.js owns point-click tolerances. Engineer, Rifleman, Panzerfaust and Machine Gunner radii grow 50%. Novice, Wind Adept and Magic Adept radii shrink 25%; Wind/Magic Masters keep their existing radii. War Adept grows 25% and War Master grows 50%, after the existing Master body multiplier. Tank and Rocket Truck gain 10% total local length without wider sides. Anti-Tank Gun uses an authored sprite-fitting box in hull-facing coordinates while packed and weapon-facing coordinates while deployed: forward extent −44 to +23 world pixels, lateral ±14 while packed or ±23 otherwise to cover deployed/transitional trails. These bounds were measured from visible articulated atlas pixels, excluding shadows; they are not queried from the renderer during input. Other kinds retain current click areas. Minimum screen click circles scale with circular adjustments. During setup/teardown, a conservative box covers the full shortest-arc rotation between hull and weapon facing, including intermediate corner extrema, because the renderer owns setup timing.

Click picking first admits direct hits: original bodies for expanded circles/vehicles, the replacement circle for reductions, or the full Anti-Tank Gun sprite box. A direct hit always beats another entity’s near-miss region, including ownership preferences. With no direct hit, admitted halos rank by distance to the projected original hit area (polygon plus minimum anchor circle), then anchor distance, depth and stable id, within existing ownership preference. Both click polygons use the presented projection and reject depth-plane gaps. Hover and entity-target commands share this picker; marquee and viewport admission retain original bodies. Simulation collision, placement, formation spacing, visuals and selection rings are unchanged.

With the experimental-graphics preference enabled (on by default after its one-time rollout), standing infantry point-click proxies use an authored upright body box: 22×46 world pixels centered 20 pixels above the foot anchor, with a 28×52 near-miss box. The normal ground circle remains the marquee footprint. This is a presentation-only preference, sent to the Pixi worker as experimentalGraphicsEnabled; it never changes the authoritative entity, fog admission, collision, or command coordinates. Deployed MG point-click proxies instead follow a ground rectangle around the abdomen, while their collision and marquee footprints remain unchanged.

4. Presentation frame

Static map presentation changes only with the static-map revision. Per-rAF data is assembled once by Match. Large grids cross the boundary as source-detached cloneable buffers:

GridSnapshotV2 = {
  version: 2, revision, width, height,
  values: Uint8Array
}

StaticMapPresentationV2 = {
  version: 2, generation, revision,
  widthPx, heightPx, tileSizePx,
  terrain: GridSnapshotV2,
  resourceSites: readonly detached records[],
  doodads: readonly detached records[],
  concealmentTiles: readonly { x, y }[]
}

PresentationFrameV2 = {
  version: 2, generation, frameId, groundDecalRevision, visualTimeMs,
  projection: RendererProjectionV2, staticMapRevision,
  visible: GridSnapshotV2,
  explored: GridSnapshotV2,
  layers: LayerRecordsV1,
  diagnosticsContext
}

The static concealment mask crosses the renderer boundary because it drives the ordinary-unit readability outline. A unit is outlined when its ground point occupies concealment or when its presentation footprint overlaps a foreground concealment tile; decorative doodad pixels are never the semantic source of that cue.

Presented entity records include backend-neutral visualBounds (class, widthPx, depthPx, heightPx) derived from the mirrored entity stats. Placement feedback includes a detached tile-footprint descriptor. Freehand formation feedback crosses tacticalFeedback as one detached formationMovePreview record containing the sampled world-space points and provisional unit slots; every backend renders both the stroke and admitted slots. Live and server-remembered deployed enemy Anti-Tank Gun warnings cross the same boundary as detached enemyAntiTankGunThreat records, including an explicit stale-memory presentation flag, so a backend can render current amber-orange hatching and thinner very-pale-pink frozen hatching without consulting mutable gameplay state. Live warnings take their immutable direction only from the entity’s setupFacing; stale warnings use the remembered record’s frozen facing. Body and weapon facing are never fallback cone directions because they may track targets inside the emplacement field. Friendly selected field-of-fire wedges likewise use only setupFacing and remain unhatched. These are presentation hints only: SelectionSceneV1 remains the sole entity/ground interaction authority. Tank Point crosses tacticalFeedback as a detached pointTargetPreview containing the selected controllable tanks’ centroid and the cursor world point. The Pixi worker draws a center dot and an outlined heading arrow, with no simulation or protocol changes.

The detached feedback context also carries the observer-only all-unit-range preference. When it is enabled, Pixi draws the existing range profile for every currently visible, non-reveal unit record, independent of selection or owner; remembered intel and transient shot reveals never gain ranges. Enemy warnings are player-relative only for a single-player observer snapshot: the feedback assembler resolves that perspective from the snapshot’s one playerResources row, atomically with its fog, entities, and remembered warnings, rather than from eager local vision-control state. All-player, multi-player, and omniscient observer projections omit player-relative enemy warnings.

The main thread keeps this rich ProjectionSnapshotV1 for input, audio, minimap, and selection. PresentationFrameV2 instead carries a function-free RendererProjectionV2 with kind, camera, viewport, mapBounds, and plain backend coefficients. Orthographic records preserve the sampled origin, framing scale, world size, and CSS viewport size exactly; perspective records carry their existing plain coefficients. The Pixi owner reconstructs private projection queries from that data; functions and camera instances never cross the renderer boundary.

The backend owns mutable staging buffers. Frame objects, arrays, and ordinary records are detached and frozen; the explicitly revisioned grid Uint8Array values are copied from mutable game sources and are the only typed-array leaves. Malformed individual records are dropped with bounded category diagnostics; they do not abort the whole frame.

For received interpolated entities, Match creates one aligned frame-local preparation entry per source record. Its complete graph-aware detached interaction feeds SelectionSceneV1; its separately admitted presentation fields feed the entity layer without repeating nested clones. Unadmitted fields can neither reach nor invalidate presentation, while cycles, mutable collection views, unsupported prototypes, excessive depth, and non-finite values in admitted fields retain the existing bounded entity-drop behavior. These entries are positional and frame-local—there is no cross-frame cache or id lookup. A failed or superseded frame never publishes or retains that frame’s interaction; the prior successfully presented selection scene remains authoritative for input.

Back-to-front layer ids are exact:

  1. staticGround
  2. persistentGroundMark
  3. fogGatedWorld
  4. rememberedWorld
  5. belowFogIntel
  6. currentFog
  7. aboveFogReveal
  8. tacticalFeedback
  9. screenOverlay

Each descriptor is {id, order, space, visibilityPolicy, depthPolicy}. Later work may add optional namespaced metadata but cannot rename/reorder layers or weaken visibility policy. Within Pixi’s fog-gated world, tree canopies and unit body/overlay/effect containers share back-to-front world-Y ordering; tree understory and shadows remain below them, while selection, HP and private carried-item rosettes, and fog remain above. Any received ordinary unit occupying concealment, or overlapping a foreground concealment tile with its presentation footprint, gets a white outer edge plus an 85%-opacity owner/team-color silhouette derived from the alpha of its current production rig/frame above the canopy. Decorative tree overlap alone does not trigger this pass. Authoritative visionOnly concealment reveals omit that rig from the normal full-color layer, redraw the same current production rig into a filtered above-fog outline layer, and keep damaged-unit HP above it. The filter samples alpha only and never copies faction-colored pixels; concealment reveals retain the white edge without the team-color fill. These passes consume only already-admitted entities and therefore cannot reveal a hidden enemy.

frame_recovery.js samples one projection and visual time, updates fog, builds feedback, reconciles one monotonic ground-decal revision, assembles one frame, and calls renderer.render(frame). The local uncapped performance controller may temporarily cancel Match’s rAF and call that same live path directly; it does not use fixed capture, skip recurring systems, or retain stale presentation state. Its completion-paced producer is bounded to the worker host’s one active plus one pending frame and restores exactly one rAF callback after draining. PresentationCoordinator owns the pending metadata for every accepted generation/frame id and is the only consumer of renderer lifecycle outcomes. A submission exposes an independent retained promise plus one terminal presented, superseded, failed, or destroyed promise. retained acknowledges only the exact durable decal revision and is independent of displayed pixels; a later failure cannot make Match resend and double-stamp that revision. Only presented advances the public displayed-frame counter and publishes the matching SelectionSceneV1. Superseded and failed frames discard their pending selection scene, while teardown settles pending work as destroyed and blocks late selection/decal/capture side effects.

Pixi’s main-thread host returns asynchronous promise channels, while its module worker performs one PIXI.Application.render() for the accepted frame and acknowledges the exact generation/frame id. Duplicate, stale, unknown, impossibly ordered, or presented-after-destroy outcomes are bounded protocol diagnostics and cannot change the newest visible selection scene.

The PixiPresentationAdapter is the sole bridge to existing Pixi helpers. Its exact private-read allowlist uses {id, reviewTrigger} records: a trigger is a concrete reason to reconsider a read, not a promised cleanup phase. New reads fail the contract.

4.1 Render-worker message boundary

RenderWorkerMessageV1 is the only Phase 3 worker vocabulary. Every request has {version:1,type,generation,payload} and is validated for known type, matching presentation/static versions, safe integer ids, finite bounded dimensions/DPR/timings, and shape-matched typed arrays. Its payload lifetimes are explicit:

Responses are ready after all renderer assets are ready, retained, presented with frame id and worker update/present timings, superseded, bounded failed, and destroyed. The message builder never transfers an assembler-owned buffer: it transfers copies so retained Phase 2 source records remain usable and unchanged. Dynamic frame packets borrow the assembler’s already detached, immutable records until dispatch. The message builder creates separate frame/layer/grid wrappers to omit grid values and durable ground decals without mutating retained records; it does not deep-clone the entire graph locally. The host posts each packet synchronously, and postMessage performs the worker-isolating structured clone. Static-map, durable-decal and transferred grid copies retain their existing lifetimes. Pending and capture frames keep their original immutable source snapshots.

Worker diagnostics retain counters and bounded timing histories on every event, but compute summaries only when diagnostics(), the control snapshot, or the published diagnostic getter is read. The diagnostic statsEpoch increments on each counter reset so summary consumers can detect a reset even when counters catch up between reads. Frame submission/completion never copy and sort histories just to publish an unread snapshot. The published getter returns current counters and ages; teardown replaces an owned getter with a detached final record so global diagnostics cannot retain the destroyed host or overwrite a replacement match.

The immutable static-map DTO always carries effective sun conditions. Missing, null, or invalid map sun uses the shared client default: 14:00 local solar time on 23 Aug 1942 west of Stalingrad (azimuth 224°, elevation 45°, warmth 23). Authored conditions override that default; maps cannot disable sunlight. Effective sun applies the world warmth tint and directional projected unit shadows. When elevation varies, the terrain builder computes smooth height-field relief, while the detailed-shadow layer builds one map-space directional horizon cache in setMap. For each light ray it carries the maximum light-space height z - tan(elevation) * dot(world, sunDirection) from the sun-facing edge. This is the 2.5D equivalent of an orthographic directional-light depth comparison and is a linear sweep, not a viewport-pixel ray march. The cache has four samples per tile regardless of viewport, DPR, camera, or map-world pixel size and never rebuilds during entity/camera frames. Linear sampling on the non-dominant axis follows the authored light ray with at most one cache texel (one quarter tile) of angular rasterization error; sub-texel blockers can soften rather than widening with distance. warmth applies a matching static world tint. Flat maps skip terrain relief while retaining atmosphere and directional unit shadows. Players may disable detailed unit shadows, retaining lightweight native unit shadows and sunlight.

Dry ochre dirt (DIRT_C, map character 5) renders as warm golden sandy soil with small pale grit and sparse sage tufts. A separate map-masked material uses the same static terrain-lighting field and world sun tint as grass. Broad ground-hugging sand fronts pass each fixed point every 20 seconds, retaining 450 world pixels/second travel and 145-pixel softness; ground grains and stones remain anchored. Material boundaries feather into adjacent ground, and map replacement, editor terrain patches, and teardown rebuild or release the layer.

Scout Plane shadows use the aircraft frame strip’s alpha silhouette as a flat plane three tiles above the ground. They retain the sprite’s scale and facing, offset away from the shared sun by 3 * tileSize / tan(sunElevation), with 25% black opacity and a soft blur. They replace the native ellipse on the normal unit-shadow layer independently of the detailed 3D unit-shadow preference; maps without authored sunlight use the shared default sun (north, 45°). This is a presentation-only height and does not alter simulation flight or sight. The silhouette translates over terrain without height-field deformation; each retained instance releases its blur filter during teardown.

Default-enabled detailed unit shadows keep their existing presentation models, but static and dynamic work now share the exact authored azimuth and elevation; there is no unit-only 30-degree clamp. The worker uploads the boxes as one retained instanced mesh. Each dynamic vertex starts at bilinearly sampled terrain elevation and marches monotonically down the authored 3D light ray at the static cache spacing until it brackets the first terrain receiver. Four bisection refinements resolve that bracket to at most tileSize / 64 world pixels (0.5 px for 32 px tiles). The search is bounded by the map edge, map diagonal, and the distance at which the ray falls below the map’s minimum height; missing receivers use the last valid boundary point rather than oscillating between height samples. Sloped receivers therefore do not silently collapse to the z=0 plane. Coverage is rasterized into an R8 camera-window target with a two-texel sampling gutter, rather than rebuilding immediate-mode convex hulls into a map-sized RGBA target. The final terrain mesh performs one static-cache sample and one dynamic-mask sample per fragment. Camera origin, zoom, and CSS viewport are passed explicitly by the renderer owner; concealment-only entities remain excluded and a failed mask draw leaves native rig shadows active. Optional bounded GPU queries measure the unit-mask draw and total present without synchronously waiting for results. The static transform is CPU map-load work, and Pixi composites the terrain mesh as part of the ordinary stage render, so neither interval is duplicated merely to manufacture a separate GPU query label; staticBuilds/staticBuildMs diagnostics and renderer.present.total cover them.

The worker treats an observed WebGL context loss as a terminal presentation failure; it does not silently keep acknowledging black frames. Worker uncaught errors, unhandled rejections, message decode failures, and context loss return a bounded stable code plus available source location. Terminal responses also carry a bounded stack when the browser provides one. The ready response also carries bounded WebGL vendor/renderer/version context. The host retains those details with submitted/presented ids, in-flight/pending ids and ages, and last-message age. MatchNetReporter includes that state in its normal bounded report and immediately emits one report for a new terminal incident. A visible-tab frame that remains unacknowledged for at least two seconds is notable server-side even when no worker error event arrives; hidden-tab throttling does not classify as a worker stall.

The production PixiWorkerPresentationAdapter transfers the sole visible canvas during construction. Before a match owns that adapter, App’s exclusive renderer-preparation slot owns its canvas and worker. Every match start must either transfer that preparation to one compatible live or replay match or await its destruction before constructing another renderer; Lab starts cannot strand a prewarmed surface. It admits one in-flight frame plus one latest pending frame. Replacing the pending frame settles its exact id as superseded; durable decal messages have an independent retained lifetime. Only a current-generation presented acknowledgment publishes that frame’s stored SelectionSceneV1. Fixed capture cancels ordinary pending work, waits for its exact frame, and reads decoded RGBA from that same worker render task. Resize is held behind an in-flight frame and ordered before the next frame; reset and idempotent destroy discard every pending frame, selection, decal, capture, and resize record. Live, replay, spectator, Lab, stress, fixed capture, and Map Editor all use this same worker host. There is no Pixi flag, synchronous canvas, hidden renderer, WebGPU probe, or fallback renderer.

Worker display age starts when the host accepts the frame, before host-pending time, message construction, cloning, and dispatch. Queue age uses that same boundary through worker task start; main-submit timing separately isolates message construction, cloning, and postMessage cost.

The Map Editor keeps its camera/input animation-frame loop responsive but applies backpressure only to worker submission, with no more than one editor presentation in flight. Terrain patches coalesce by tile and complete overlays remain pending until the worker acknowledges the exact revision as presented; edits made while that presentation is in flight merge into the next submission. This lets ordinary match frames remain latest-oriented without treating authoring changes as disposable presentation data. A failed editor worker stops new submissions and reports one visible error. Full editor terrain replacements carry the materialized elevation grid and authored sun conditions. Sun-control input replaces only the latest pending full terrain update, so direction, height, relief shadows, and world color temperature preview live while retaining the one-frame-in-flight backpressure contract.

5. Explicitly deferred

The Pixi v8 version cutover does not require render groups or shared GraphicsContext resources; both remain follow-up performance experiments that need workload evidence and visual review. The current foundations do not require hostile asset validation, checksums/decoder policy, retained event history, generalized registries/pools, benchmark schemas/budgets, required shadows, quality tiers, new or re-authored faction art, or release certification. Add one through a new evidence-backed plan when a playtest, content need, or measurement justifies it.

6. Executable evidence

The Pixi v8.19.0 cutover was reviewed with the deterministic 16-tick decoded-RGBA gate using the same stream, state, camera, viewport, DPR, visual clock, and ready assets on both versions. Exact equality failed on all 16 frames because the native v8 renderer rasterizes differently: changed pixels ranged from 4.654% to 14.911% per frame (12.022% average), with average RGB MAE 1.753/255 and maximum RMSE 11.736. The capture-health, input, nonblank, and changing-frame canaries all passed, and early/mid/late manual review found the same terrain, units, and fight effects without missing or black scenes. This is an explicitly reviewed, accepted rasterization difference—not a claim of exact pixel parity.

The code and focused contracts are the executable specification:

Update this document when those cross-file contracts change. Record actual backend capability in the parity ledger; do not add speculative future implementation detail here.

Resource Depot artwork sizing

The depot’s 384×384 atlas frames retain the original 1.1 padding compensation. Frame size in world pixels is footprint tiles × 32 × 1.1; changing the footprint from 3×3 to 4×4 already scales every sprite layer by 4/3. Do not apply that multiplier again to visualScale. The base layer has 88,083 non-transparent pixels, with alpha bounds [25, 359) × [15, 356): 334×341 source pixels. Its visible bounds grow from 91.85×93.775 world pixels at 3×3 to 122.4667×125.0333 at 4×4. Its frame-relative edge margins and slight top overlap keep the same proportions. The shadow’s 360×367 source-pixel bounds likewise retain the original overlap ratio. The renderer contract decodes the PNG and checks all four alpha edges of every layer through the runtime sprite transform against the original 96-pixel footprint ratios. The SVG fallback is scaled once from its authored 96×96 geometry to 128×128.

Cultivator-owned Resource Depots select the dedicated lotus Nexus PNG through the presented entity’s factionId, derived from public owner metadata before the renderer boundary. Both prepared and ordinary entity snapshots carry that field, including remembered buildings. Building rig maps key this variant as resource_depot.cultivators; texture readiness still identifies the underlying resource_depot kind. Missing or other faction ids retain the normal depot. The Nexus uses the same 4×4 footprint and 1.1 padding compensation with fixed wood/stone and multiplicatively tinted roof paint. Its two-frame atlas intentionally omits both a silhouette shadow and the fallback rectangular footprint shadow; no industrial emblem is overlaid. omitFootprintShadow is preserved for ordinary as well as component building atlases. The approved source and deterministic chroma key/paint-mask generator live in client/assets/rigs/cultivator-nexus/ and scripts/art/nexus-pipeline.mjs.

Rocket Truck raster preview

The Rocket Truck uses the selected PNG with team-light multiplication and a 20% larger render scale. rocket_truck_visuals.js draws the same generated rocket PNG on the six rack rails and in flight. The 16 physical slots mirror rules::balance::rocket_rack_slot; public, fog-gated rocketRackCount drives per-slot depletion. Launches retain their shooter owner/facing and begin at server-provided rack coordinates. Projectiles reuse the existing Panzerfaust straight, constant-speed flight sampler, trail, and fade toward the already-authorized impact coordinate. Only their PNG body, team tint, and rack origin differ. Rocket-specific legacy rectangles, mortar muzzle flashes, and dashed impact warning overlays are suppressed. Mortar and Panzerfaust rendering remain unchanged.

Tank commander machine gun

The Tank keeps its raster hull, turret, and cannon. The Scout Car gun/commander sprite is reused at 70% of its Scout Car dimensions, packed into the Tank atlas at load time from the existing source image. SVG portraits and minimap layers resolve attached sprites back to their original image/crop; the Tank source-sheet dimensions stay unchanged while the worker allocates the extra packed texture space. Its roof pivot sits at turret-local (0, 5) (halfway toward the right edge), rotates its position with weaponFacing, and turns the gun and commander separately using interpolated authoritative commanderFacing. The sprite draws above the turret. commanderFacing is admitted by the presentation entity schema so the worker receives its independent angle. The coaxMuzzle anchor uses the independent gun transform so MG tracers/flashes follow its barrel rather than the cannon. Cannon recoil carries the entire roof assembly. MG bursts reuse the Scout Car’s 160 ms recoil envelope and 6.5-world-pixel backward translation along commanderFacing, without kicking the hull or cannon. Separate client recoil records keep overlapping cannon and MG shots independent. The frame’s pixiCompatibility.poses[].coaxRecoil carries the sampled MG envelope across the worker boundary alongside the existing cannon recoil; the worker facade selects it for explicit weaponRecoil(id, kind, now, WEAPON_KIND.TANK_COAX) reads. Muzzle anchors use the same combined cannon/body and independent MG transforms.

Cultivator Shop sprite

shop uses client/assets/rigs/cultivator-shop/shop-atlas.png, generated by scripts/art/shop-pipeline.mjs. The 384×384 fixed/team-paint frames expand to the 3×4 footprint, restoring the portrait source proportions, with visual scale 1.1 and no fallback footprint shadow. The white cork, rope and awning receive player tint; the ochre shell, 愛, timber and lower rocks stay fixed. It has no production or rally overlay.

Machine-gunner prone frames and the final two authored deployment frames retain their original ground registration. Standing, running and the first two deployment frames use oval-bottom alignment; teardown follows the same poses in reverse.