# The Bevy frontend ``` Type: knowledge ``` The graphical frontend (package `misaligned-bevy`, binary `misaligned-bevy`, `crates/misaligned-bevy/src/main.rs`, Bevy 0.18). Like the terminal it is a **thin view** over `misaligned::sim::Sim` — no game rules live here; the binary owns wall-clock-to-tick pacing, rendering, and input mapping only (architecture guardrail, [engineering/architecture.md](../engineering/architecture.md)). As of 2026-07-07 the Bevy build is at **feature parity with the terminal** (ROADMAP item 2): every mechanic the terminal exposes is playable here with the same keys. Canonical action meanings and support states are owned by [action-vocabulary.md](action-vocabulary.md); contextual legality and row ordering remain shared through `Sim::available_actions`. The 2026-07-11 Operations amendment adds the other half of that shared action surface: uppercase `I` opens the renderer-neutral INTEL / PEOPLE / ACCOUNTS / SCHEMES / ACTIVE workspace from operations-workspace.md. Local context menus continue to use `Sim::available_actions`; strategic cards use the same core Operations projection as terminal and agent mode. This UI delta is READY, not yet part of the implemented screenshots described below. As of 2026-07-09 its pinned identity card also carries the continuous-witness spine: `THREAT` (audit/pilot or the earned unpaid debt), `NEXT`, and the right-click / Enter path to actions. These stay above the independently scrolling detail rail; an observed screenshot is recorded in [the implementation log](../log/2026-07-09-continuous-witness-implemented.md). As of 2026-07-10 the FOCUS card explains the objective where you live: with focus on the host rack (where it starts), the card appends the objective's plain-language victory predicate as wrapped prose ([objective.md](../mechanics/objective.md) player surface; an observed screenshot is recorded in [the objective-inspect log](../log/2026-07-10-objective-inspect.md)). The implemented visual floor is [bevy-visual-floor.md](bevy-visual-floor.md): the default frame reads as an intentional AI sensorium / clinical command surface rather than a debug map plus terminal dump, without adding Bevy-only facts. The 2.5D/near-3D direction is scoped separately in [bevy-digital-real-canvas.md](bevy-digital-real-canvas.md): digital and real share one canvas/framing, with digital as the AI's model/signal dialect and real as the camera/material dialect. The sensorium pass replaces the stale humanoid process sprite with an amber cursor reticle, removes purple/teal placeholder color from B1 runtime rendering, gives unknown space deliberate sensor-dark treatment, dims the physical world into a learned-world model, overlays earned device nodes and reach/topology traces, and turns the right rail into graphical command cards with pinned status/nudge/footer. As of 2026-07-08 the **material render is the default-quality physical dialect** ([material-render.md](material-render.md), IMPLEMENTED): an HD-2D treatment — tilted Camera3d, floor planes, extruded wall boxes with dedicated top caps, fog-gated south-face cutaways, billboarded machines/people, and the dark rig — over the same sim facts, fog, anchors, UI, and panels. As of 2026-07-09 the material frame is **the dark frame** ([material-dark-frame.md](material-dark-frame.md), IMPLEMENTED): the institutional fluorescent is gone and ambient is near-nothing, so the render is a physically dark room lit only by the machines' own light and the soft amber pools they cast; blueprint/remembered mass no longer draws here at all (light is the only revealer); its camera opens as a close-up on the core; and a dev work light (`F4`) floods the scene flat and neutral for inspection. Since views.md criterion 1 landed on 2026-07-11, a fresh Bevy frontend opens in the DIGITAL flat sensorium and F3 flips to the REAL material dialect and back. The flip is frontend-only and never saved. As of the same day the world is **flat materials** ([flat-materials.md](flat-materials.md), IMPLEMENTED): every world surface in both modes is solid palette color under light from one named table; no image textures load; emissive is information (powered machines amber, power/live feeds the cold signal, the core brightest, dead equipment dark). ### Pacing and change detection (2026-07-10) The wall-clock → tick timer lives on a separate `SimClock` resource, not on `Game`. Ticking the clock every frame must not mark `Game` changed — otherwise `restyle_3d`, the flat map recolor, chassis sync, and the full sidebar rebuild fire at display rate instead of sim-step rate. Map restyle paths that still run on a real sim step precompute owned/selected machine tiles once. Since the 2026-07-12 hearing amendment neither renderer projects audio coverage: recent semantic events draw only a bounded device-local pulse, so no heard-set map walk or room-scale geometry exists at display rate. ## What it renders - **Map** — flat clinical palette colors per material family ([flat-materials.md](flat-materials.md); the Pixel Lab tile pipeline was removed), under the same fog rule as the terminal (`Seen` / `Remembered` / `Blueprint` / `Unknown`). Audio stays on event/recording channels. The process has no walking body: the always-visible marker is the frontend-only cursor, the camera follows it, mouse-clicks retarget it, and `[` / `]` or the canvas mouse/trackpad wheel zoom. In the material render the default is an attention-close frame (material-dark-frame.md), not fit-to-known-content; the flat sensorium keeps the fit-to-content default. - **People markers** — the flat sensorium keeps a person's first initial; the material view uses a small volumetric articulated silhouette with deterministic gait. Both render only while controlled **sight** covers the person ([mechanics/schedules.md](../mechanics/schedules.md)); mic-only events remain attached to their capture device, exactly like the terminal gate. - **Sidebar** — a fixed right-hand command rail under the clinical-frame instrument-rail contract. Compact rest keeps only DIGITAL/REAL plus day/tick/run state, the nearest `SCHEDULE` or real `THREAT`, one `NEXT` condition, the OPERATIONS entry, and a quiet `Tab` disclosure hint. It shows no card. The ops/sec crown, objective progress, FOCUS facts, observer model, history, and full controls footer are stable detail and appear only after `Tab`. Expand still mounts every card (tagged `Visibility`, not rebuild) and the rail scrolls independently with mouse wheel over the pane, `PageUp`/`PageDown`, and `Home`/`End`. Card order on expand: FOCUS (cursor, fog, provenance-tagged facts, exact objective readout/predicate), FLEET (effective ops/sec, usable/effective compute, overhead, machine/slush summary, WORK / THINK / LIE mode counts, channel yield, and host work stacks), COVER PROCESS, SELF-MODEL, OBSERVER MODEL, SELF HOST, NETWORK + MONEY, RECENT TRACE, then the controls footer. Elevated pressure promotes only the compact THREAT line; exact observer rows still require expansion. Amber is never generic disclosure chrome. - **World command lens** — the shared current-attention projection derives honest response-source and effect-target anchors from the existing `Sim::current_nudge`. A small breathing `NOW / ` mark sits on a placeable target while the source's existing machine verb receives the amber response accent. This adds no dispatch path: menu rows, direct machine controls, and Operations remain the only executors. Unknown/off-screen targets, modal UI, and a frontend buffer-pressure override suppress the cue rather than pinning a false or contradictory marker to the frame edge. - **Operations workspace** (`I` or rail affordance) — a full-window Bevy command lens. Top tabs select INTEL / PEOPLE / PERSONAS / ACCOUNTS / SCHEMES / ACTIVE; a 32%-width object list and larger detail/action pane use the exact shared projection. The current witness remains at the top, then the visual order is selected object, related objects, physical actuator, actions, explanation, and supporting context. The resting rail and world verbs do not bleed beneath it. Default and 960x540 minimum frames use the same readable type and interaction shape. Mouse and keyboard share one selection state; `h`/`l`, `j`/`k`, Enter, and Esc mirror the terminal. Opening or browsing it changes no sim state and does not pause time. - **REAL material render** — selecting REAL shows the physical canvas in the HD-2D material render as the dark frame ([material-dark-frame.md](material-dark-frame.md)): a close-up on the core in a physically dark room. Only camera-seen surfaces (flat-color floor planes, extruded wall/rock/door boxes with dedicated darkened top caps, fog-gated south-face cutaways at the 40 degree pitch, billboarded machines/people) and owned machines' own telemetry-lit chassis draw; blueprint/remembered mass is absent (it reads in the flat sensorium, never as matter the camera missed). Lighting is the dark rig: near-nothing ambient plus the core's linear amber fixture, and a soft-gradient amber pool cast on the floor under every powered owned machine (no ruled claim ring, no plan floor grid); the pool contracts/dims at light intensity and widens/brightens at hard. Emissive carries information: the core, powered machines (amber), power hardware and live feeds (cold signal, live feeds breathing), dead equipment dark. Materials are pooled by tile/fog/part/live-feed. `[` / `]` or the canvas mouse/trackpad wheel retune the zoom around the close default; zoom is a semantic composition profile (close lowers pitch toward the machine/floor joint, medium keeps ~40° tactical, far raises toward facility survey) with FOV-compensated monotonic distance — still attention-anchored, no free orbit. Wheel input over the right rail remains sidebar scrolling. `F4` toggles the dev work light (a flat neutral flood, not a player surface). F3 flips back to the default DIGITAL flat sensorium; the mode is not saved and changes no sim state. - **Overlays** — title card and the RUN ENDED card (reason, day / tick). Text remains ASCII-only because Bevy's embedded default font carries a limited glyph set, but the sidebar's key meters are Bevy UI rectangles/cells rather than ASCII art. Shared lib wording that still uses typographic separators (`·`, `—`, `»`) is folded at the Bevy boundary (`ascii_ui`) so the ACTIONS menu and RECENT TRACE never tofu-box missing glyphs; the terminal keeps the typographic forms. One meaning per color still holds: amber for machine presence (title, overlays, fleet mode presence), bone/chrome for data, crimson for danger, and no information carried by color alone. ## Controls Identical to the terminal ([interface/terminal.md](terminal.md), README controls table), plus zoom, sidebar scrolling, and the render flip: - Move cursor `WASD` / `hjkl` / arrows, or left-click the map; pause `SPACE`/`p`; speed `+`/`-`; zoom `[` / `]` or wheel over the canvas; `Tab` expands/compacts secondary rail detail (frontend-only; ignored while a context menu owns input); scroll the right sidebar with wheel input over that pane, `PageUp`/`PageDown`, or `Home`/`End`; F3 flips DIGITAL/REAL; F4 toggles the dev work light (material mode only, a flat neutral flood for inspection, not a player surface); uppercase `I` opens Operations; quit `q`; save/load `Ctrl+S` / `Ctrl+L`. - Persistence modifiers are chord-local rather than modal. Only a complete Ctrl/Command+S or Ctrl/Command+L chord captures the frame; a bare modifier state never suppresses unrelated controls. This keeps macOS native overlays or focus transitions from turning a stale Command state into a temporary keyboard lockout. - **Context menu** — right-click moves the cursor to the pointed map tile and opens its context menu. Enter/`e` opens the keyboard cursor's tile without moving it; a resting pointer or stale machine selection cannot retarget the key. Both paths list `Sim::available_actions` for that anchor with the same compact choices and order as the terminal. Rows render the verb or dial state only. Cost, signature forecasts, inline blocked explanations, literal control tags, and repeated key-help are absent from the card; agent mode keeps full descriptors, and blocked reasons narrate on attempt. Persistent settings, state, and policies read amber-dim while committed actions remain bone; STUB definitions are absent; the selected row is a solid amber wash with a leading `>` and dark text (terminal reverse-video parity). The card is one `MenuPanel` root: a rebuild despawns all children (`despawn_related::`) then respawns title and rows once — chrome never stacks across opens. Click a row — or select with `j`/`k` or number keys and press Enter — to execute; `esc` or a click away closes. Local verbs (salvage, buy, fallback, tap/untap/take, scan/compromise, open egress, host review/research) live on the context menu. Intel sale, people/social, account/flow, scheme, plot, and held-choice actions live on the selected Operations object. - **Focus / fleet hotkeys (menu closed).** Press `1`–`3` / numpad to assign WORK / THINK / LIE **immediately** — not enter → mode dial → row → enter. The target resolves in the existing order: owned rack under the pointer, primary machine selection, then owned rack under the attention reticule. Whenever that target exists, one bare `WORK / THINK / LIE` line stays fixed beside the server's projected base (the pointer may choose the server but does not place the line). The current mode is bone-bright and the alternatives/slashes are dim chrome, except that while THINK is current the already-bound `1 WORK` key/word pair lights amber as the one-press panic exit. THINK stays bone-bright; LIE stays dim and deliberate. It has no panel, heading, subtitle, counters, or extra state, and disappears when no frequent-machine target exists or the full menu opens ([context-menu.md](context-menu.md), machine-grammar addendum). Moving the pointer away does not hide a line whose rack remains selected or under the reticule. `i` cycles light / medium / hard intensity on that rack; `5`–`9` fire its Nth committed action (controls do not occupy shortcut slots); `Enter` / `e` open the keyboard cursor's menu without moving it. Drag a marquee or shift-click to multi-select; with no hover rack, `1`–`3` and `i` assign the selection (or the keyboard cursor's machine). `Esc` clears selection. The old panel-open keys stay retired. Local verbs still come from `human_menu` / `available_actions`; strategic rows come from the shared Operations projection. Lowercase `i` remains machine intensity and uppercase `I` is unambiguously the workspace view command. ## Verification The Bevy package builds under `./tools/check.sh --frontend` (tests plus clippy for `misaligned-bevy` and `misaligned-assets`); by hand, use `cargo build -p misaligned-bevy --bin misaligned-bevy`. The launch check in [process/workflows.md](../process/workflows.md) is the observed-run gate for Bevy-visible changes. Machine-work final-swallow motion has deterministic `MISALIGNED_SHOT=consume-demand|consume-thought` harness states: the teal bottom Demand cube pulls into the WORK chassis, and the ivory Thought bead contracts into the passive core draw. Both are driven by `Sim::work_consumptions`, not frontend queue differences. Source/well motion has matching `MISALIGNED_SHOT=produce-think|draw-lie` evidence: ivory mercury swells from the THINK chassis while proportional crimson motes settle around it; actual absorbed motes then curve through world space into the LIE well. Those rates come only from `Sim::work_productions` and `Sim::work_absorptions`; paused frames keep only persistent token geometry. `MISALIGNED_SHOT=hover-menu` retains its compatibility name but captures the clean machine grammar over the reticule-focused owned host with WORK current; it is the resting visual acceptance frame for context-menu.md H1–H4. `MISALIGNED_SHOT=first-think` stages the real opening Thought route with Ears part-filled, focuses the THINK host through the reticule, and captures the amber `1 WORK` escape beside the bone-bright current THINK state for H2–H5.