Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.
Python agent-orchestrationai-agentai-coding-assistantclaude-codecoding-agentcomputer-usedesktop-applocal-firstmcppersonal-jarvisvoice-assistantvoice-coding
feat(office): Asteroid Run in 3D with twin lasers and guided missiles
rubenluetke10-beep2cb8d68c762d
diff --git a/jarvis/ui/web/frontend/src/components/society/office/ArcadeCabinet.tsx b/jarvis/ui/web/frontend/src/components/society/office/ArcadeCabinet.tsxindex 6a608e0646..8bd172075d 100644--- a/jarvis/ui/web/frontend/src/components/society/office/ArcadeCabinet.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/ArcadeCabinet.tsx@@ -1,25 +1,20 @@/*** The break-room arcade, playable: walking up to the cabinet and pressing E- * opens this overlay with "Asteroid Run". The rules live in arcadeGame.ts;- * this component feeds the keyboard in, runs a fixed-step loop and paints- * the playfield. It is a modal dialog, so the office character stands still- * while you play.+ * opens this overlay with "Asteroid Run" in 3D. The rules live in+ * arcadeGame.ts, the 3D view in ArcadeScene.tsx; this component owns the+ * keyboard, the HUD and the WebGL surface. It is a modal dialog, so the+ * office character stands still while you play.*/-import { useCallback, useEffect, useRef, useState } from "react";+import { Component, useCallback, useEffect, useRef, useState, type ReactNode } from "react";+import { Canvas } from "@react-three/fiber";+import { useReducedMotion } from "framer-motion";import { useT } from "@/i18n";-import {- ARCADE_H, ARCADE_W, RAPID_S, ROCK_RADIUS, SHIP_RADIUS, arcadeLevel, newArcade, stepArcade,- type ArcadeInput, type ArcadePhase, type ArcadeState, type PickupKind,-} from "./arcadeGame";+import { useWebglSurface } from "@/hooks/useWebglSurface";+import { IDLE_INPUT, MAX_MISSILES, MAX_SHIELDS, arcadeLevel, newArcade, type ArcadeInput, type ArcadePhase, type ArcadeState } from "./arcadeGame";+import { ArcadeScene } from "./ArcadeScene";import "./arcade.css";const BEST_KEY = "jarvis.office.arcade.asteroids.best";-const STEP = 1 / 120;-/** Canvas pixels per playfield unit; CSS scales the canvas to fit. */-const SCALE = 3;--const PICKUP_COLOUR: Record<PickupKind, string> = { shield: "#7dd3fc", rapid: "#fde68a", life: "#ff7ab8" };-const ROCK_FILL = ["#8f7b66", "#7d6a57", "#6b5a4a"];function readBest(): number {try { return Number(window.localStorage.getItem(BEST_KEY)) || 0; } catch { return 0; }@@ -29,143 +24,58 @@ function writeBest(score: number): void {try { window.localStorage.setItem(BEST_KEY, String(score)); } catch { /* not persisted this session */ }}-function drawShip(ctx: CanvasRenderingContext2D, s: ArcadeState, now: number): void {- const { shipX: x, shipY: y } = s;- const tilt = Math.max(-0.35, Math.min(0.35, s.vx / 400));- ctx.save();- ctx.translate(x, y);- ctx.rotate(tilt);- // Flame, flickering, longer while thrusting forward.- const flame = 7 + Math.sin(now / 30) * 2 + (s.vy < 0 ? 4 : 0);- ctx.fillStyle = "#ff7a59";- ctx.beginPath(); ctx.moveTo(-3, 7); ctx.lineTo(0, 7 + flame); ctx.lineTo(3, 7); ctx.closePath(); ctx.fill();- ctx.fillStyle = "#ffd166";- ctx.beginPath(); ctx.moveTo(-1.6, 7); ctx.lineTo(0, 7 + flame * 0.6); ctx.lineTo(1.6, 7); ctx.closePath(); ctx.fill();- // Fins.- ctx.fillStyle = "#e0526b";- ctx.beginPath(); ctx.moveTo(-4, 2); ctx.lineTo(-8, 9); ctx.lineTo(-3, 7); ctx.closePath(); ctx.fill();- ctx.beginPath(); ctx.moveTo(4, 2); ctx.lineTo(8, 9); ctx.lineTo(3, 7); ctx.closePath(); ctx.fill();- // Body.- ctx.fillStyle = "#eef2f7";- ctx.beginPath();- ctx.moveTo(0, -11);- ctx.quadraticCurveTo(5, -5, 4, 7);- ctx.lineTo(-4, 7);- ctx.quadraticCurveTo(-5, -5, 0, -11);- ctx.fill();- // Nose cone and window.- ctx.fillStyle = "#e0526b";- ctx.beginPath(); ctx.moveTo(0, -11); ctx.quadraticCurveTo(3.2, -7.5, 3.4, -5); ctx.lineTo(-3.4, -5); ctx.quadraticCurveTo(-3.2, -7.5, 0, -11); ctx.fill();- ctx.fillStyle = "#38bdf8";- ctx.beginPath(); ctx.arc(0, -1, 1.9, 0, Math.PI * 2); ctx.fill();- ctx.restore();- if (s.shield) {- ctx.strokeStyle = `rgba(125, 211, 252, ${0.55 + Math.sin(now / 150) * 0.25})`;- ctx.lineWidth = 1.2;- ctx.beginPath(); ctx.arc(x, y, SHIP_RADIUS + 7, 0, Math.PI * 2); ctx.stroke();- }-}--function drawPickup(ctx: CanvasRenderingContext2D, kind: PickupKind, x: number, y: number, t: number): void {- const pulse = 1 + Math.sin(t * 6) * 0.12;- ctx.save();- ctx.translate(x, y);- ctx.scale(pulse, pulse);- ctx.strokeStyle = PICKUP_COLOUR[kind];- ctx.fillStyle = PICKUP_COLOUR[kind];- ctx.lineWidth = 1.2;- ctx.beginPath(); ctx.arc(0, 0, 6, 0, Math.PI * 2); ctx.stroke();- ctx.beginPath();- if (kind === "shield") { ctx.moveTo(0, -3.5); ctx.lineTo(3, -2); ctx.lineTo(2.4, 1.8); ctx.lineTo(0, 3.6); ctx.lineTo(-2.4, 1.8); ctx.lineTo(-3, -2); }- else if (kind === "rapid") { ctx.moveTo(0.8, -4); ctx.lineTo(-2.4, 0.6); ctx.lineTo(0, 0.6); ctx.lineTo(-0.8, 4); ctx.lineTo(2.4, -0.6); ctx.lineTo(0, -0.6); }- else { ctx.moveTo(0, 3.4); ctx.bezierCurveTo(-5, -0.5, -2.2, -4.5, 0, -1.6); ctx.bezierCurveTo(2.2, -4.5, 5, -0.5, 0, 3.4); }- ctx.closePath(); ctx.fill();- ctx.restore();-}--function paint(ctx: CanvasRenderingContext2D, s: ArcadeState, now: number): void {- const shake = s.shake * 10;- const ox = shake > 0 ? (Math.random() - 0.5) * shake : 0, oy = shake > 0 ? (Math.random() - 0.5) * shake : 0;- ctx.setTransform(SCALE, 0, 0, SCALE, ox * SCALE, oy * SCALE);- const sky = ctx.createLinearGradient(0, 0, 0, ARCADE_H);- sky.addColorStop(0, "#05040d");- sky.addColorStop(1, "#120b2a");- ctx.fillStyle = sky;- ctx.fillRect(-10, -10, ARCADE_W + 20, ARCADE_H + 20);- // Stars stretch into streaks as the run speeds up.- const streak = 1 + Math.min(6, s.time / 20);- for (const star of s.stars) {- ctx.fillStyle = `rgba(220, 225, 255, ${0.25 + star.depth * 0.6})`;- ctx.fillRect(star.x, star.y, star.depth > 0.7 ? 1.2 : 0.8, streak * star.depth);- }- for (const p of s.pickups) drawPickup(ctx, p.kind, p.x, p.y, p.t);- for (const rock of s.rocks) {- const r = ROCK_RADIUS[rock.size];- ctx.save();- ctx.translate(rock.x, rock.y);- ctx.rotate(rock.angle);- ctx.beginPath();- rock.shape.forEach((k, i) => {- const a = (i / rock.shape.length) * Math.PI * 2;- if (i === 0) ctx.moveTo(Math.cos(a) * r * k, Math.sin(a) * r * k); else ctx.lineTo(Math.cos(a) * r * k, Math.sin(a) * r * k);- });- ctx.closePath();- ctx.fillStyle = rock.flash > 0 ? "#ffffff" : ROCK_FILL[rock.size];- ctx.fill();- ctx.strokeStyle = "#b8a38a";- ctx.lineWidth = 1;- ctx.stroke();- // A couple of craters.- ctx.fillStyle = "rgba(0, 0, 0, 0.22)";- ctx.beginPath(); ctx.arc(r * 0.3, -r * 0.2, r * 0.22, 0, Math.PI * 2); ctx.fill();- ctx.beginPath(); ctx.arc(-r * 0.35, r * 0.3, r * 0.15, 0, Math.PI * 2); ctx.fill();- ctx.restore();- }- ctx.fillStyle = "#fde68a";- for (const shot of s.shots) ctx.fillRect(shot.x - 0.7, shot.y - 3, 1.4, 6);- for (const p of s.particles) {- ctx.globalAlpha = Math.max(0, p.life / p.max);- ctx.fillStyle = p.colour;- ctx.fillRect(p.x - 0.8, p.y - 0.8, 1.6, 1.6);- }- ctx.globalAlpha = 1;- // The ship blinks while it is invulnerable after a hit.- if (s.phase !== "over" && (s.invulnerable <= 0 || Math.floor(now / 100) % 2 === 0)) drawShip(ctx, s, now);- // Rapid-fire time left, as a bar along the bottom.- if (s.rapid > 0) {- ctx.fillStyle = "#fde68a";- ctx.fillRect(4, ARCADE_H - 4, (ARCADE_W - 8) * (s.rapid / RAPID_S), 1.5);- }+/** A scene that throws shows a quiet line instead of taking the office down with it. */+class SceneBoundary extends Component<{ fallback: string; children: ReactNode }, { failed: boolean }> {+ state = { failed: false };+ static getDerivedStateFromError() { return { failed: true }; }+ componentDidCatch(error: unknown) { console.warn("[arcade] 3D scene failed", error); }+ render() { return this.state.failed ? <p className="office-arcade-fallback" role="status">{this.props.fallback}</p> : this.props.children; }}const KEY_LEFT = new Set(["ArrowLeft", "KeyA"]);const KEY_RIGHT = new Set(["ArrowRight", "KeyD"]);const KEY_UP = new Set(["ArrowUp", "KeyW"]);const KEY_DOWN = new Set(["ArrowDown", "KeyS"]);-const idleInput = (): ArcadeInput => ({ left: false, right: false, up: false, down: false, fire: false });+const KEY_BOOST = new Set(["ShiftLeft", "ShiftRight"]);++interface Hud { score: number; shields: number; missiles: number; level: number; boost: number; boosting: boolean; rapid: boolean; phase: ArcadePhase }export function ArcadeCabinet({ onClose }: { onClose: () => void }) {const t = useT();- const canvas = useRef<HTMLCanvasElement>(null);+ const host = useRef<HTMLDivElement>(null);const dialog = useRef<HTMLDivElement>(null);const game = useRef<ArcadeState>(newArcade());- const input = useRef<ArcadeInput>(idleInput());- const [hud, setHud] = useState({ score: 0, lives: 3, level: 1, phase: "ready" as ArcadePhase });+ const input = useRef<ArcadeInput>({ ...IDLE_INPUT });+ const reduced = useReducedMotion() ?? false;+ const { generation } = useWebglSurface(host);+ const [hud, setHud] = useState<Hud>({ score: 0, shields: 3, missiles: MAX_MISSILES, level: 1, boost: 1, boosting: false, rapid: false, phase: "ready" });const [best, setBest] = useState(readBest);const bestRef = useRef(best);const lastPhase = useRef<ArcadePhase>("ready");+ // The HUD follows the game at a relaxed pace; the scene itself runs every frame.const sync = useCallback(() => {const s = game.current;- const score = Math.floor(s.score), level = arcadeLevel(s);- setHud((h) => (h.score === score && h.lives === s.lives && h.level === level && h.phase === s.phase- ? h : { score, lives: s.lives, level, phase: s.phase }));- if (score > bestRef.current) { bestRef.current = score; setBest(score); }+ const next: Hud = {+ score: Math.floor(s.score), shields: s.shields, missiles: s.missileAmmo, level: arcadeLevel(s), boost: Math.round(s.boost * 50) / 50,+ boosting: s.boosting, rapid: s.rapid > 0, phase: s.phase,+ };+ setHud((h) => (h.score === next.score && h.shields === next.shields && h.missiles === next.missiles && h.level === next.level && h.boost === next.boost+ && h.boosting === next.boosting && h.rapid === next.rapid && h.phase === next.phase ? h : next));+ if (next.score > bestRef.current) { bestRef.current = next.score; setBest(next.score); }// Store a new best once, when a run stops (game over or pause), not every frame.if (lastPhase.current === "playing" && s.phase !== "playing" && bestRef.current > readBest()) writeBest(bestRef.current);lastPhase.current = s.phase;}, []);+ useEffect(() => {+ const id = window.setInterval(sync, 80);+ return () => window.clearInterval(id);+ }, [sync]);++ // Closing mid-run still keeps a new best score.+ useEffect(() => () => { if (bestRef.current > readBest()) writeBest(bestRef.current); }, []);+const startOrResume = useCallback(() => {const s = game.current;if (s.phase === "over") game.current = { ...newArcade(), phase: "playing" };@@ -174,9 +84,6 @@ export function ArcadeCabinet({ onClose }: { onClose: () => void }) {sync();}, [sync]);- // Closing mid-run still keeps a new best score.- useEffect(() => () => { if (bestRef.current > readBest()) writeBest(bestRef.current); }, []);-// Keyboard: the dialog owns every key while it is open (capture phase, so// the office's own Escape and E handlers never see them).useEffect(() => {@@ -197,6 +104,7 @@ export function ArcadeCabinet({ onClose }: { onClose: () => void }) {else if (KEY_RIGHT.has(code)) input.current.right = true;else if (KEY_UP.has(code)) input.current.up = true;else if (KEY_DOWN.has(code)) input.current.down = true;+ else if (KEY_BOOST.has(code)) input.current.boost = true;else if (code === "Space" || code === "Enter") {if (s.phase === "playing") input.current.fire = code === "Space" || input.current.fire;else if (!event.repeat) startOrResume();@@ -209,11 +117,12 @@ export function ArcadeCabinet({ onClose }: { onClose: () => void }) {else if (KEY_RIGHT.has(code)) input.current.right = false;else if (KEY_UP.has(code)) input.current.up = false;else if (KEY_DOWN.has(code)) input.current.down = false;+ else if (KEY_BOOST.has(code)) input.current.boost = false;else if (code === "Space") input.current.fire = false;};// Losing window focus pauses the game and forgets held keys.const blur = () => {- input.current = idleInput();+ input.current = { ...IDLE_INPUT };if (game.current.phase === "playing") { game.current.phase = "paused"; sync(); }};document.addEventListener("keydown", down, true);@@ -226,25 +135,6 @@ export function ArcadeCabinet({ onClose }: { onClose: () => void }) {};}, [onClose, startOrResume, sync]);- // Fixed-step simulation, painted once per animation frame.- useEffect(() => {- const ctx = canvas.current?.getContext("2d") ?? null;- if (!ctx) return;- let raf = 0;- let last = performance.now();- let acc = 0;- const tick = (now: number) => {- acc += Math.min(0.1, (now - last) / 1000);- last = now;- while (acc >= STEP) { stepArcade(game.current, input.current, STEP); acc -= STEP; }- paint(ctx, game.current, now);- sync();- raf = requestAnimationFrame(tick);- };- raf = requestAnimationFrame(tick);- return () => cancelAnimationFrame(raf);- }, [sync]);-useEffect(() => { dialog.current?.focus({ preventScroll: true }); }, []);const message = hud.phase === "ready" ? t("society.office.arcade_start")@@ -254,25 +144,50 @@ export function ArcadeCabinet({ onClose }: { onClose: () => void }) {return (<div className="office-arcade-backdrop" data-office-ui onPointerDown={(event) => { if (event.target === event.currentTarget) onClose(); }}>- <div ref={dialog} className="office-card office-arcade" role="dialog" data-state="open" aria-modal="true"+ <div ref={dialog} className="office-arcade" role="dialog" data-state="open" aria-modal="true"aria-label={t("society.office.arcade_title")} tabIndex={-1}>- <header className="office-arcade-head">- <h2>{t("society.office.arcade_title")}</h2>- <button type="button" className="office-icon-button" onClick={onClose} aria-label={t("society.office.close")}>×</button>- </header>- <div className="office-arcade-score" aria-live="polite">- <span>{t("society.office.arcade_score")} <b>{hud.score}</b></span>- <span>{t("society.office.arcade_level")} <b>{hud.level}</b></span>- <span>{t("society.office.arcade_lives")} <b>{hud.lives}</b></span>- <span>{t("society.office.arcade_best")} <b>{best}</b></span>- </div>- <div className="office-arcade-screen">- <canvas ref={canvas} width={ARCADE_W * SCALE} height={ARCADE_H * SCALE} aria-hidden />+ <div ref={host} className="office-arcade-screen">+ <SceneBoundary fallback={t("society.office.no_graphics")}>+ <Canvas key={generation} dpr={[1, 1.75]} camera={{ fov: 62, near: 0.1, far: 220, position: [3.6, 3, 10.5] }}+ gl={{ antialias: true, powerPreference: "high-performance" }}>+ <ArcadeScene state={game} input={input} reduced={reduced} />+ </Canvas>+ </SceneBoundary>+ <div className="office-arcade-hud" aria-live="polite">+ <div className="office-arcade-hud-line">+ <span>{t("society.office.arcade_score")} {hud.score}</span>+ <span aria-hidden>·</span>+ <span aria-label={`${t("society.office.arcade_shields")} ${hud.shields}`}>+ {t("society.office.arcade_shields")}{" "}+ <span className="office-arcade-shields">+ {Array.from({ length: MAX_SHIELDS }, (_, i) => <i key={i} data-on={i < hud.shields ? "true" : "false"} />)}+ </span>+ </span>+ <span aria-hidden>·</span>+ <span aria-label={`${t("society.office.arcade_missiles")} ${hud.missiles}`}>+ {t("society.office.arcade_missiles")}{" "}+ <span className="office-arcade-missiles">+ {Array.from({ length: MAX_MISSILES }, (_, i) => <i key={i} data-on={i < hud.missiles ? "true" : "false"} />)}+ </span>+ </span>+ <span aria-hidden>·</span>+ <span data-active={hud.boosting ? "true" : "false"} className="office-arcade-boost-label">{t("society.office.arcade_boost")}</span>+ {hud.rapid && <><span aria-hidden>·</span><span className="office-arcade-rapid">{t("society.office.arcade_rapid")}</span></>}+ </div>+ <div className="office-arcade-bar" aria-hidden><i style={{ width: `${hud.boost * 100}%` }} /></div>+ <div className="office-arcade-hud-sub">+ {t("society.office.arcade_level")} {hud.level} · {t("society.office.arcade_best")} {best}+ </div>+ </div>+ <button type="button" className="office-arcade-close" onClick={onClose} aria-label={t("society.office.close")}>×</button>{message && (- <button type="button" className="office-arcade-message" onClick={startOrResume}>{message}</button>+ <button type="button" className="office-arcade-message" onClick={startOrResume}>+ <strong>{t("society.office.arcade_title")}</strong>+ <span>{message}</span>+ </button>)}+ <p className="office-arcade-keys">{t("society.office.arcade_keys")}</p></div>- <p className="office-hint office-arcade-keys">{t("society.office.arcade_keys")}</p></div></div>);diff --git a/jarvis/ui/web/frontend/src/components/society/office/ArcadeScene.tsx b/jarvis/ui/web/frontend/src/components/society/office/ArcadeScene.tsxnew file mode 100644index 0000000000..977eb3833a--- /dev/null+++ b/jarvis/ui/web/frontend/src/components/society/office/ArcadeScene.tsx@@ -0,0 +1,418 @@+/**+ * The 3D view of Asteroid Run: a low-poly rocket seen from behind, faceted+ * asteroids tumbling out of the depth, laser bolts, debris and a warp-streak+ * star field. Everything that moves is pooled (instanced meshes and one line+ * buffer) and written straight from the game state every frame, so a busy+ * late-game field costs no React work at all.+ */+import { useEffect, useMemo, useRef } from "react";+import { useFrame, useThree } from "@react-three/fiber";+import {+ AdditiveBlending, BufferAttribute, BufferGeometry, CapsuleGeometry, Color, ConeGeometry, CylinderGeometry, DynamicDrawUsage, Fog, IcosahedronGeometry,+ InstancedMesh, LineBasicMaterial, LineSegments, MeshBasicMaterial, MeshStandardMaterial, Object3D, OctahedronGeometry,+ BoxGeometry, PointLight, RingGeometry, SphereGeometry, TetrahedronGeometry, Vector3, type Group, type Mesh,+} from "three";+import {+ BLAST_S, GUN_OFFSET, ROCK_RADIUS, ROCK_VARIANTS, SPAWN_Z, launchMissile, lockedRockIds, stepArcade,+ type ArcadeInput, type ArcadeState,+} from "./arcadeGame";++const STEP = 1 / 120;+const ROCKS_PER_VARIANT = 90;+const MAX_LASERS = 60;+const MAX_DEBRIS = 500;+const MAX_PICKUPS = 12;+const MAX_MISSILES_IN_FLIGHT = 12;+const MAX_LOCKS = 12;+const MAX_BLASTS = 24;+const BLAST_HOT = new Color("#fff1c2");+const BLAST_COOL = new Color("#ff5a1f");+/** A click this close (CSS px) to a rock's outline picks it. */+const PICK_SLOP_PX = 26;+/** Imperial-green bolts: a white-hot core in a green glow. */+const LASER_GLOW = "#2dff5a";+const STAR_COUNT = 900;+const SPACE = "#0b0a14";++/** A jagged icosahedron: the same seed always gives the same rock. */+function rockGeometry(seed: number): BufferGeometry {+ let s = seed * 9301 + 49297;+ const rand = () => { s = (s * 9301 + 49297) % 233280; return s / 233280; };+ const base = new IcosahedronGeometry(1, 1);+ const pos = base.getAttribute("position");+ // Displace shared corners by the same amount so the surface stays closed.+ const offsets = new Map<string, number>();+ for (let i = 0; i < pos.count; i += 1) {+ const key = `${pos.getX(i).toFixed(3)},${pos.getY(i).toFixed(3)},${pos.getZ(i).toFixed(3)}`;+ let k = offsets.get(key);+ if (k === undefined) { k = 0.72 + rand() * 0.5; offsets.set(key, k); }+ pos.setXYZ(i, pos.getX(i) * k, pos.getY(i) * k * (0.85 + (seed % 3) * 0.08), pos.getZ(i) * k);+ }+ const geometry = base.toNonIndexed();+ geometry.computeVertexNormals();+ base.dispose();+ return geometry;+}++const ROCK_TONES = ["#8b93b5", "#a9b1cf", "#6f7898", "#c7cde2", "#7e86a8"].map((c) => new Color(c));+const WHITE = new Color("#ffffff");+const HOT = new Color("#ffc157");+const DUST = new Color("#9aa2c2");++function Rocket({ state, reduced }: { state: React.MutableRefObject<ArcadeState>; reduced: boolean }) {+ const group = useRef<Group>(null);+ const flame = useRef<Mesh>(null);+ const shield = useRef<Mesh>(null);+ const light = useRef<PointLight>(null);+ const muzzle = useRef<Group>(null);+ const muzzleLight = useRef<PointLight>(null);+ const parts = useMemo(() => ({+ body: new CylinderGeometry(0.34, 0.4, 1.5, 12),+ band: new CylinderGeometry(0.405, 0.405, 0.22, 12),+ nose: new ConeGeometry(0.34, 0.7, 12),+ nozzle: new CylinderGeometry(0.28, 0.36, 0.25, 12),+ fin: new BoxGeometry(0.05, 0.55, 0.4),+ flame: new ConeGeometry(0.26, 1.2, 10),+ shield: new IcosahedronGeometry(1.25, 1),+ flash: new SphereGeometry(0.22, 10, 8),+ flashMat: new MeshBasicMaterial({ color: LASER_GLOW, transparent: true, opacity: 0.9, blending: AdditiveBlending, depthWrite: false, toneMapped: false }),+ white: new MeshStandardMaterial({ color: "#eef2f8", roughness: 0.35, metalness: 0.25 }),+ blue: new MeshStandardMaterial({ color: "#3b82f6", roughness: 0.4, metalness: 0.3 }),+ red: new MeshStandardMaterial({ color: "#e0443e", roughness: 0.5, flatShading: true }),+ dark: new MeshStandardMaterial({ color: "#3a4150", roughness: 0.6, metalness: 0.5 }),+ fire: new MeshBasicMaterial({ color: "#ffcc33", toneMapped: false, transparent: true, opacity: 0.95 }),+ bubble: new MeshBasicMaterial({ color: "#7dd3fc", wireframe: true, transparent: true, opacity: 0, toneMapped: false }),+ }), []);+ useEffect(() => () => { Object.values(parts).forEach((p) => p.dispose()); }, [parts]);++ useFrame(({ clock }) => {+ const s = state.current;+ const g = group.current;+ if (!g) return;+ g.visible = s.phase !== "over" && (s.invulnerable <= 0 || Math.floor(clock.elapsedTime * 10) % 2 === 0);+ g.position.set(s.shipX, s.shipY, 0);+ // Bank into turns, pitch with climbs.+ g.rotation.set(-Math.PI / 2 + s.vy * 0.03, 0, -s.vx * 0.045);+ if (flame.current) {+ const flicker = reduced ? 1 : 0.85 + Math.sin(clock.elapsedTime * 40) * 0.12 + Math.random() * 0.08;+ const len = (s.boosting ? 2 : 1) * flicker;+ flame.current.scale.set(s.boosting ? 1.25 : 1, len, s.boosting ? 1.25 : 1);+ flame.current.position.y = -0.75 - 0.6 * len;+ (flame.current.material as MeshBasicMaterial).color.set(s.boosting ? "#7dd3fc" : "#ffcc33");+ }+ if (light.current) light.current.intensity = (s.boosting ? 14 : 8) * (reduced ? 1 : 0.9 + Math.random() * 0.2);+ // Twin green muzzle flashes right after a volley.+ const flash = Math.max(0, 1 - s.sinceShot / 0.07);+ if (muzzle.current) { muzzle.current.visible = flash > 0; muzzle.current.scale.setScalar(0.6 + flash * 0.8); }+ if (muzzleLight.current) muzzleLight.current.intensity = flash * 18;+ if (shield.current) {+ const fade = Math.max(0, 1 - s.sinceHit / 0.6);+ (shield.current.material as MeshBasicMaterial).opacity = fade * 0.7;+ shield.current.rotation.y = clock.elapsedTime;+ }+ });++ return (+ // Built along +y, then laid down to point into the screen (-z).+ <group ref={group}>+ <mesh geometry={parts.body} material={parts.white} />+ <mesh geometry={parts.band} material={parts.blue} position={[0, 0.2, 0]} />+ <mesh geometry={parts.nose} material={parts.blue} position={[0, 1.1, 0]} />+ <mesh geometry={parts.nozzle} material={parts.dark} position={[0, -0.85, 0]} />+ {[0, 1, 2].map((i) => {+ const a = (i / 3) * Math.PI * 2;+ return <mesh key={i} geometry={parts.fin} material={parts.red} position={[Math.sin(a) * 0.45, -0.45, Math.cos(a) * 0.45]} rotation={[0, a, 0]} />;+ })}+ <mesh ref={flame} geometry={parts.flame} material={parts.fire} rotation={[Math.PI, 0, 0]} position={[0, -1.35, 0]} />+ <pointLight ref={light} color="#ff9a3c" distance={9} decay={2} position={[0, -1.6, 0]} />+ <mesh ref={shield} geometry={parts.shield} material={parts.bubble} />+ {/* Muzzles sit at the gun offsets, just ahead of the nose (local +y is forward). */}+ <group ref={muzzle} visible={false}>+ <mesh geometry={parts.flash} material={parts.flashMat} position={[-GUN_OFFSET, 1.3, 0]} />+ <mesh geometry={parts.flash} material={parts.flashMat} position={[GUN_OFFSET, 1.3, 0]} />+ </group>+ <pointLight ref={muzzleLight} color={LASER_GLOW} distance={7} decay={2} intensity={0} position={[0, 1.6, 0]} />+ </group>+ );+}++export function ArcadeScene({ state, input, reduced }: {+ state: React.MutableRefObject<ArcadeState>;+ input: React.MutableRefObject<ArcadeInput>;+ reduced: boolean;+}) {+ const scene = useThree((s) => s.scene);+ const camera = useThree((s) => s.camera);+ const acc = useRef(0);+ const dummy = useMemo(() => new Object3D(), []);+ const colour = useMemo(() => new Color(), []);++ const pools = useMemo(() => {+ const rockMaterial = new MeshStandardMaterial({ flatShading: true, roughness: 0.85, metalness: 0.1, color: "#ffffff" });+ const rocks = Array.from({ length: ROCK_VARIANTS }, (_, v) => {+ const mesh = new InstancedMesh(rockGeometry(v + 1), rockMaterial, ROCKS_PER_VARIANT);+ mesh.instanceMatrix.setUsage(DynamicDrawUsage);+ mesh.frustumCulled = false;+ mesh.setColorAt(0, WHITE);+ return mesh;+ });+ // Bolts lie along z: a thin bright core inside a wider additive glow.+ const boltCore = new CapsuleGeometry(0.06, 5.5, 4, 8);+ boltCore.rotateX(Math.PI / 2);+ const boltGlow = new CapsuleGeometry(0.22, 6.2, 4, 10);+ boltGlow.rotateX(Math.PI / 2);+ const lasers = new InstancedMesh(boltCore, new MeshBasicMaterial({ color: "#eaffee", toneMapped: false }), MAX_LASERS);+ const laserGlow = new InstancedMesh(boltGlow, new MeshBasicMaterial({+ color: LASER_GLOW, transparent: true, opacity: 0.55, blending: AdditiveBlending, depthWrite: false, toneMapped: false,+ }), MAX_LASERS);+ // Missiles: a white body built along z with a red-hot tint, plus an engine glow.+ const missileBody = new CylinderGeometry(0.11, 0.11, 1, 8);+ missileBody.rotateX(Math.PI / 2);+ const missiles = new InstancedMesh(missileBody, new MeshStandardMaterial({+ color: "#f1f3f8", roughness: 0.4, metalness: 0.3, emissive: "#ff4d3d", emissiveIntensity: 0.25,+ }), MAX_MISSILES_IN_FLIGHT);+ const missileGlow = new InstancedMesh(new SphereGeometry(0.28, 10, 8), new MeshBasicMaterial({+ color: "#ff9a3c", transparent: true, opacity: 0.85, blending: AdditiveBlending, depthWrite: false, toneMapped: false,+ }), MAX_MISSILES_IN_FLIGHT);+ // Lock-on diamonds around every rock a missile is chasing.+ const locks = new InstancedMesh(new RingGeometry(1.15, 1.32, 4, 1), new MeshBasicMaterial({+ color: "#ff4d3d", transparent: true, opacity: 0.9, blending: AdditiveBlending, depthWrite: false, depthTest: false, toneMapped: false,+ }), MAX_LOCKS);+ const debris = new InstancedMesh(new TetrahedronGeometry(0.16), new MeshStandardMaterial({ flatShading: true, roughness: 0.8, color: "#ffffff" }), MAX_DEBRIS);+ debris.setColorAt(0, WHITE);+ const pickups = new InstancedMesh(new OctahedronGeometry(0.55), new MeshStandardMaterial({ flatShading: true, color: "#ffffff", emissive: "#ffffff", emissiveIntensity: 0.6 }), MAX_PICKUPS);+ pickups.setColorAt(0, WHITE);+ // Fireballs: additive spheres that swell and fade to nothing (colour to black).+ const blasts = new InstancedMesh(new IcosahedronGeometry(1, 2), new MeshBasicMaterial({+ color: "#ffffff", transparent: true, blending: AdditiveBlending, depthWrite: false, toneMapped: false,+ }), MAX_BLASTS);+ blasts.setColorAt(0, WHITE);+ const effects = [lasers, laserGlow, missiles, missileGlow, locks, blasts, debris, pickups];+ for (const m of effects) { m.instanceMatrix.setUsage(DynamicDrawUsage); m.frustumCulled = false; }+ locks.renderOrder = 10;+ // Stars as short segments that stretch into warp streaks with speed.+ const starPos = new Float32Array(STAR_COUNT * 6);+ const stars = Array.from({ length: STAR_COUNT }, () => ({ x: (Math.random() - 0.5) * 140, y: (Math.random() - 0.5) * 90, z: SPAWN_Z + Math.random() * (20 - SPAWN_Z) }));+ const starGeometry = new BufferGeometry();+ starGeometry.setAttribute("position", new BufferAttribute(starPos, 3).setUsage(DynamicDrawUsage));+ const starLines = new LineSegments(starGeometry, new LineBasicMaterial({ color: "#c9d4ff", transparent: true, opacity: 0.75 }));+ starLines.frustumCulled = false;+ return { rocks, rockMaterial, lasers, laserGlow, missiles, missileGlow, locks, blasts, debris, pickups, effects, starLines, starPos, stars };+ }, []);++ useEffect(() => {+ scene.background = new Color(SPACE);+ scene.fog = new Fog(SPACE, 60, 150);+ return () => {+ scene.fog = null;+ for (const m of [...pools.rocks, ...pools.effects]) { m.geometry.dispose(); m.dispose(); }+ pools.rockMaterial.dispose();+ for (const m of pools.effects) (m.material as MeshBasicMaterial | MeshStandardMaterial).dispose();+ pools.starLines.geometry.dispose();+ (pools.starLines.material as LineBasicMaterial).dispose();+ };+ }, [scene, pools]);++ // Click a rock to send a guided missile at it. Picking happens in screen+ // space with some slop, so small, fast rocks far away are still clickable.+ const gl = useThree((s) => s.gl);+ const probe = useMemo(() => new Vector3(), []);+ useEffect(() => {+ const canvas = gl.domElement;+ const onDown = (event: PointerEvent) => {+ if (event.button !== 0) return;+ const s = state.current;+ if (s.phase !== "playing") return;+ const rect = canvas.getBoundingClientRect();+ const px = event.clientX - rect.left, py = event.clientY - rect.top;+ const locked = lockedRockIds(s);+ let best: { id: number; score: number } | null = null;+ for (const rock of s.rocks) {+ if (rock.z > 0 || locked.has(rock.id)) continue;+ probe.set(rock.x, rock.y, rock.z).project(camera);+ if (probe.z > 1) continue;+ const sx = ((probe.x + 1) / 2) * rect.width, sy = ((1 - probe.y) / 2) * rect.height;+ // Screen radius of the rock, from a point one radius to its side.+ probe.set(rock.x + ROCK_RADIUS[rock.size], rock.y, rock.z).project(camera);+ const rr = Math.abs(((probe.x + 1) / 2) * rect.width - sx);+ const d = Math.hypot(px - sx, py - sy);+ if (d > rr + PICK_SLOP_PX) continue;+ const score = d / (rr + PICK_SLOP_PX);+ if (!best || score < best.score) best = { id: rock.id, score };+ }+ if (best) launchMissile(s, best.id);+ };+ canvas.addEventListener("pointerdown", onDown);+ return () => canvas.removeEventListener("pointerdown", onDown);+ }, [gl, camera, state, probe]);++ useFrame((_, rawDt) => {+ const dt = Math.min(rawDt, 0.1);+ acc.current += dt;+ while (acc.current >= STEP) { stepArcade(state.current, input.current, STEP); acc.current -= STEP; }+ const s = state.current;++ // Camera: behind, above and off to the right of the rocket (a three-quarter+ // view that shows its side), easing after it; shake on hits.+ const shake = reduced ? 0 : s.shake * 0.9;+ const cx = s.shipX * 0.55 + 3.6 + (Math.random() - 0.5) * shake, cy = s.shipY * 0.55 + 3 + (Math.random() - 0.5) * shake;+ camera.position.x += (cx - camera.position.x) * Math.min(1, dt * 6);+ camera.position.y += (cy - camera.position.y) * Math.min(1, dt * 6);+ camera.position.z = 10.5;+ camera.lookAt(s.shipX * 0.75 - 0.8, s.shipY * 0.75 + 0.2, -25);++ // Rocks, per silhouette.+ const counts = new Array(ROCK_VARIANTS).fill(0);+ for (const rock of s.rocks) {+ const mesh = pools.rocks[rock.variant];+ const i = counts[rock.variant];+ if (i >= ROCKS_PER_VARIANT) continue;+ counts[rock.variant] = i + 1;+ dummy.position.set(rock.x, rock.y, rock.z);+ dummy.rotation.set(rock.rx, rock.ry, 0);+ dummy.scale.setScalar(ROCK_RADIUS[rock.size]);+ dummy.updateMatrix();+ mesh.setMatrixAt(i, dummy.matrix);+ mesh.setColorAt(i, rock.flash > 0 ? WHITE : ROCK_TONES[Math.floor(rock.tone * ROCK_TONES.length)]);+ }+ pools.rocks.forEach((mesh, v) => {+ mesh.count = counts[v];+ mesh.instanceMatrix.needsUpdate = true;+ if (mesh.instanceColor) mesh.instanceColor.needsUpdate = true;+ });++ let n = 0;+ for (const laser of s.lasers) {+ if (n >= MAX_LASERS) break;+ // The bolt trails behind its tip, which is where hits are counted.+ dummy.position.set(laser.x, laser.y, laser.z + 2.9);+ dummy.rotation.set(0, 0, 0);+ dummy.scale.setScalar(1);+ dummy.updateMatrix();+ pools.lasers.setMatrixAt(n, dummy.matrix);+ pools.laserGlow.setMatrixAt(n, dummy.matrix);+ n += 1;+ }+ pools.lasers.count = n;+ pools.laserGlow.count = n;+ pools.lasers.instanceMatrix.needsUpdate = true;+ pools.laserGlow.instanceMatrix.needsUpdate = true;++ // Missiles point along their flight; the glow sits at the tail.+ n = 0;+ for (const m of s.missiles) {+ if (n >= MAX_MISSILES_IN_FLIGHT) break;+ const v = Math.hypot(m.vx, m.vy, m.vz) || 1;+ dummy.position.set(m.x, m.y, m.z);+ dummy.scale.setScalar(1);+ dummy.lookAt(m.x + m.vx / v, m.y + m.vy / v, m.z + m.vz / v);+ dummy.updateMatrix();+ pools.missiles.setMatrixAt(n, dummy.matrix);+ dummy.position.set(m.x - (m.vx / v) * 0.6, m.y - (m.vy / v) * 0.6, m.z - (m.vz / v) * 0.6);+ dummy.scale.setScalar(reduced ? 1 : 0.8 + Math.random() * 0.5);+ dummy.updateMatrix();+ pools.missileGlow.setMatrixAt(n, dummy.matrix);+ n += 1;+ }+ pools.missiles.count = n;+ pools.missileGlow.count = n;+ pools.missiles.instanceMatrix.needsUpdate = true;+ pools.missileGlow.instanceMatrix.needsUpdate = true;++ n = 0;+ for (const b of s.blasts) {+ if (n >= MAX_BLASTS) break;+ const k = b.age / BLAST_S;+ dummy.position.set(b.x, b.y, b.z);+ dummy.rotation.set(0, 0, 0);+ dummy.scale.setScalar(b.size * (0.35 + Math.sqrt(k) * 0.9));+ dummy.updateMatrix();+ pools.blasts.setMatrixAt(n, dummy.matrix);+ pools.blasts.setColorAt(n, colour.copy(BLAST_HOT).lerp(BLAST_COOL, Math.min(1, k * 1.6)).multiplyScalar(1 - k));+ n += 1;+ }+ pools.blasts.count = n;+ pools.blasts.instanceMatrix.needsUpdate = true;+ if (pools.blasts.instanceColor) pools.blasts.instanceColor.needsUpdate = true;++ // Lock-on diamonds, facing the camera and slowly turning.+ n = 0;+ const locked = lockedRockIds(s);+ for (const rock of s.rocks) {+ if (n >= MAX_LOCKS || !locked.has(rock.id)) continue;+ dummy.position.set(rock.x, rock.y, rock.z);+ dummy.quaternion.copy(camera.quaternion);+ dummy.rotateZ(reduced ? Math.PI / 4 : performance.now() / 400);+ dummy.scale.setScalar(ROCK_RADIUS[rock.size] * 1.1);+ dummy.updateMatrix();+ pools.locks.setMatrixAt(n, dummy.matrix);+ n += 1;+ }+ pools.locks.count = n;+ pools.locks.instanceMatrix.needsUpdate = true;++ n = 0;+ for (const d of s.debris) {+ if (n >= MAX_DEBRIS) break;+ const k = d.life / d.max;+ dummy.position.set(d.x, d.y, d.z);+ dummy.rotation.set(d.spin * k, d.spin * 0.7 * k, 0);+ dummy.scale.setScalar(d.hot ? 0.7 * k + 0.1 : 1.1 * k + 0.2);+ dummy.updateMatrix();+ pools.debris.setMatrixAt(n, dummy.matrix);+ pools.debris.setColorAt(n, d.hot ? colour.copy(HOT).lerp(WHITE, k * 0.4) : DUST);+ n += 1;+ }+ pools.debris.count = n;+ pools.debris.instanceMatrix.needsUpdate = true;+ if (pools.debris.instanceColor) pools.debris.instanceColor.needsUpdate = true;++ n = 0;+ for (const p of s.pickups) {+ if (n >= MAX_PICKUPS) break;+ dummy.position.set(p.x, p.y, p.z);+ dummy.rotation.set(p.spin * 0.6, p.spin, 0);+ dummy.scale.setScalar(1);+ dummy.updateMatrix();+ pools.pickups.setMatrixAt(n, dummy.matrix);+ pools.pickups.setColorAt(n, colour.set(p.kind === "shield" ? "#38bdf8" : "#facc15"));+ n += 1;+ }+ pools.pickups.count = n;+ pools.pickups.instanceMatrix.needsUpdate = true;+ if (pools.pickups.instanceColor) pools.pickups.instanceColor.needsUpdate = true;++ // Star streaks: the faster the field, the longer the lines.+ const moving = s.phase === "playing" ? s.speed : s.phase === "over" ? 0 : 6;+ const streak = Math.max(0.15, moving * 0.035);+ const pos = pools.starPos;+ pools.stars.forEach((star, i) => {+ star.z += moving * dt;+ if (star.z > 14) { star.z = SPAWN_Z; star.x = (Math.random() - 0.5) * 140; star.y = (Math.random() - 0.5) * 90; }+ const o = i * 6;+ pos[o] = star.x; pos[o + 1] = star.y; pos[o + 2] = star.z;+ pos[o + 3] = star.x; pos[o + 4] = star.y; pos[o + 5] = star.z - streak;+ });+ (pools.starLines.geometry.getAttribute("position") as BufferAttribute).needsUpdate = true;+ });++ return (+ <>+ <ambientLight color="#7d88b8" intensity={0.55} />+ <directionalLight color="#e6ecff" intensity={2.2} position={[6, 9, 8]} />+ <directionalLight color="#6d7cff" intensity={1} position={[-8, -4, -6]} />+ <hemisphereLight args={["#aab6ff", "#1b1530", 0.35]} />+ {pools.rocks.map((mesh, i) => <primitive key={i} object={mesh} />)}+ <primitive object={pools.laserGlow} />+ <primitive object={pools.lasers} />+ <primitive object={pools.missiles} />+ <primitive object={pools.missileGlow} />+ <primitive object={pools.locks} />+ <primitive object={pools.blasts} />+ <primitive object={pools.debris} />+ <primitive object={pools.pickups} />+ <primitive object={pools.starLines} />+ <Rocket state={state} reduced={reduced} />+ </>+ );+}diff --git a/jarvis/ui/web/frontend/src/components/society/office/OfficeProps.tsx b/jarvis/ui/web/frontend/src/components/society/office/OfficeProps.tsxindex e6c9cb1fc6..8a0d37a020 100644--- a/jarvis/ui/web/frontend/src/components/society/office/OfficeProps.tsx+++ b/jarvis/ui/web/frontend/src/components/society/office/OfficeProps.tsx@@ -123,32 +123,69 @@ function drawDeskScreen(ctx: CanvasRenderingContext2D, w: number, h: number): voctx.fillRect(w - 80, 44, 60, 90);}-const INVADER = [- "..X.....X..", "...X...X...", "..XXXXXXX..", ".XX.XXX.XX.",- "XXXXXXXXXXX", "X.XXXXXXX.X", "X.X.....X.X", "...XX.XX...",-];--/** Arcade screen: two rows of pixel invaders, a ship and a score. */+/** Arcade screen: the Asteroid Run attract screen, a rocket among faceted rocks. */function drawArcade(ctx: CanvasRenderingContext2D, w: number, h: number): void {- ctx.fillStyle = "#07060f";+ const sky = ctx.createLinearGradient(0, 0, 0, h);+ sky.addColorStop(0, "#07060f");+ sky.addColorStop(1, "#171133");+ ctx.fillStyle = sky;ctx.fillRect(0, 0, w, h);- const px = 4;- for (let row = 0; row < 2; row += 1) {- for (let col = 0; col < 4; col += 1) {- ctx.fillStyle = row === 0 ? "#ff7ab8" : "#7cfc9a";- const ox = 22 + col * 58, oy = 34 + row * 44;- INVADER.forEach((line, y) => {- for (let x = 0; x < line.length; x += 1) if (line[x] === "X") ctx.fillRect(ox + x * px, oy + y * px, px, px);- });- }+ // Warp streaks running out from the vanishing point.+ const vx = w * 0.52, vy = h * 0.42;+ ctx.lineCap = "round";+ for (let i = 0; i < 46; i += 1) {+ const a = (i * 2.399) % (Math.PI * 2), r0 = 14 + ((i * 37) % 60), len = 8 + ((i * 13) % 22);+ ctx.strokeStyle = `rgba(201, 212, 255, ${0.25 + ((i * 7) % 10) / 20})`;+ ctx.lineWidth = 1 + (i % 3) * 0.5;+ ctx.beginPath();+ ctx.moveTo(vx + Math.cos(a) * r0, vy + Math.sin(a) * r0);+ ctx.lineTo(vx + Math.cos(a) * (r0 + len), vy + Math.sin(a) * (r0 + len));+ ctx.stroke();}- ctx.fillStyle = "#7dd3fc";- ctx.fillRect(w / 2 - 18, h - 30, 36, 10);- ctx.fillRect(w / 2 - 4, h - 40, 8, 10);- ctx.fillStyle = "#fde68a";- ctx.fillRect(w / 2 - 1, h - 90, 3, 14);- ctx.fillStyle = "#ffffff";- for (let i = 0; i < 5; i += 1) ctx.fillRect(14 + i * 12, 10, 8, 10);+ // Low-poly rocks: a fan of facets, each triangle shaded by its facing.+ const rock = (cx: number, cy: number, r: number, seed: number) => {+ const n = 7;+ const pts = Array.from({ length: n }, (_, i) => {+ const a = (i / n) * Math.PI * 2 + seed, k = 0.75 + (((seed * 31 + i * 17) % 10) / 10) * 0.4;+ return [cx + Math.cos(a) * r * k, cy + Math.sin(a) * r * k] as const;+ });+ const hub = [cx - r * 0.15, cy - r * 0.2] as const;+ pts.forEach((p, i) => {+ const q = pts[(i + 1) % n];+ const light = 0.45 + 0.4 * Math.max(0, Math.cos((i / n) * Math.PI * 2 + seed - 2.3));+ ctx.fillStyle = `rgb(${Math.round(120 * light + 60)}, ${Math.round(128 * light + 62)}, ${Math.round(165 * light + 70)})`;+ ctx.beginPath(); ctx.moveTo(hub[0], hub[1]); ctx.lineTo(p[0], p[1]); ctx.lineTo(q[0], q[1]); ctx.closePath(); ctx.fill();+ });+ };+ rock(w * 0.84, h * 0.2, 24, 1);+ rock(w * 0.16, h * 0.3, 15, 2);+ rock(w * 0.62, h * 0.24, 9, 3);+ rock(w * 0.3, h * 0.62, 7, 4);+ rock(w * 0.82, h * 0.7, 17, 5);+ // The rocket, flying into the screen: exhaust, fins, body, nose, window.+ const rx = w * 0.46, ry = h * 0.7;+ ctx.save();+ ctx.translate(rx, ry);+ ctx.rotate(-0.5);+ ctx.fillStyle = "#ffcc33";+ ctx.beginPath(); ctx.moveTo(-7, 14); ctx.lineTo(0, 44); ctx.lineTo(7, 14); ctx.closePath(); ctx.fill();+ ctx.fillStyle = "#e0443e";+ ctx.beginPath(); ctx.moveTo(-9, 2); ctx.lineTo(-20, 18); ctx.lineTo(-8, 14); ctx.closePath(); ctx.fill();+ ctx.beginPath(); ctx.moveTo(9, 2); ctx.lineTo(20, 18); ctx.lineTo(8, 14); ctx.closePath(); ctx.fill();+ ctx.fillStyle = "#eef2f8";+ ctx.fillRect(-9, -16, 18, 30);+ ctx.fillStyle = "#3b82f6";+ ctx.fillRect(-9, -6, 18, 5);+ ctx.beginPath(); ctx.moveTo(-9, -16); ctx.lineTo(0, -32); ctx.lineTo(9, -16); ctx.closePath(); ctx.fill();+ ctx.restore();+ // A laser bolt and the score line.+ ctx.strokeStyle = "#ffe066";+ ctx.lineWidth = 2.5;+ ctx.beginPath(); ctx.moveTo(w * 0.55, h * 0.48); ctx.lineTo(w * 0.6, h * 0.36); ctx.stroke();+ ctx.fillStyle = "#e6ebff";+ for (let i = 0; i < 4; i += 1) ctx.fillRect(12 + i * 10, 10, 7, 7);+ ctx.fillStyle = "#facc15";+ ctx.fillRect(12, 22, 54, 3);}/** Elevator floor indicator: an amber "up" arrow and a dim "down" arrow. */diff --git a/jarvis/ui/web/frontend/src/components/society/office/arcade.css b/jarvis/ui/web/frontend/src/components/society/office/arcade.cssindex de0d69a395..975c58134c 100644--- a/jarvis/ui/web/frontend/src/components/society/office/arcade.css+++ b/jarvis/ui/web/frontend/src/components/society/office/arcade.css@@ -1,14 +1,32 @@-/* The playable break-room arcade (ArcadeCabinet). The playfield is a lit- screen and stays dark in both themes; the frame around it follows the theme. */-.office-arcade-backdrop { position:absolute; inset:0; z-index:70; display:flex; align-items:center; justify-content:center; padding:16px; background:hsl(var(--background) / .55); }-.office-arcade { display:flex; flex-direction:column; gap:8px; width:min(520px, 100%); max-height:100%; padding:10px 14px 12px; overflow:auto; }-.office-arcade:focus { outline:none; }-.office-arcade-head { display:flex; align-items:center; justify-content:space-between; gap:8px; }-.office-arcade-head h2 { margin:0; font-size:14px; font-weight:700; }-.office-arcade-score { display:flex; flex-wrap:wrap; justify-content:space-between; gap:4px 12px; font-size:12px; color:hsl(var(--muted-foreground)); font-variant-numeric:tabular-nums; }-.office-arcade-score b { color:hsl(var(--foreground)); }-.office-arcade-screen { position:relative; align-self:center; width:min(100%, calc((100vh - 170px) * 240 / 320)); aspect-ratio:240 / 320; border-radius:10px; overflow:hidden; border:6px solid hsl(var(--border)); background:#07060f; }-.office-arcade-screen canvas { display:block; width:100%; height:100%; }-.office-arcade-message { position:absolute; left:50%; top:58%; transform:translate(-50%, -50%); max-width:86%; border:1px solid #fde68a; border-radius:8px; padding:8px 14px; background:rgb(7 6 15 / .85); color:#fde68a; font-size:13px; font-weight:600; letter-spacing:.02em; cursor:pointer; text-align:center; }-.office-arcade-message:focus-visible { outline:2px solid hsl(var(--ring)); outline-offset:2px; }-.office-arcade-keys { text-align:center; }+/* The playable break-room arcade (ArcadeCabinet). The game screen is deep+ space and stays dark in both themes; the dimmed backdrop follows the theme. */+.office-arcade-backdrop { position:absolute; inset:0; z-index:70; display:flex; align-items:center; justify-content:center; padding:16px; background:hsl(var(--background) / .6); }+.office-arcade { width:min(1100px, 100%, calc((100vh - 80px) * 16 / 9)); outline:none; }+.office-arcade-screen { position:relative; width:100%; aspect-ratio:16 / 9; border-radius:14px; overflow:hidden; background:#0b0a14; border:1px solid hsl(var(--border)); box-shadow:0 18px 60px rgb(0 0 0 / .45); }+.office-arcade-screen canvas { display:block; }+.office-arcade-fallback { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; margin:0; color:#c9d4ff; font-size:13px; }++/* HUD: small caps in the top-left corner, like an arcade overlay. */+.office-arcade-hud { position:absolute; left:18px; top:14px; pointer-events:none; color:#e6ebff; font-size:12px; font-weight:600; letter-spacing:.08em; text-transform:uppercase; font-variant-numeric:tabular-nums; text-shadow:0 1px 3px rgb(0 0 0 / .8); }+.office-arcade-hud-line { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }+.office-arcade-shields { display:inline-flex; gap:3px; vertical-align:middle; }+.office-arcade-shields i { width:8px; height:8px; transform:rotate(45deg); background:#e6ebff; }+.office-arcade-shields i[data-on="false"] { background:transparent; box-shadow:inset 0 0 0 1px rgb(230 235 255 / .35); }+.office-arcade-missiles { display:inline-flex; gap:3px; vertical-align:middle; }+.office-arcade-missiles i { width:0; height:0; border-left:4px solid transparent; border-right:4px solid transparent; border-bottom:9px solid #ff6b57; }+.office-arcade-missiles i[data-on="false"] { border-bottom-color:rgb(255 107 87 / .25); }+.office-arcade-screen canvas { cursor:crosshair; }+.office-arcade-boost-label[data-active="true"] { color:#7dd3fc; }+.office-arcade-rapid { color:#facc15; }+.office-arcade-bar { width:130px; height:4px; margin-top:6px; border-radius:2px; background:rgb(255 255 255 / .12); overflow:hidden; }+.office-arcade-bar i { display:block; height:100%; background:#facc15; transition:width .08s linear; }+.office-arcade-hud-sub { margin-top:6px; font-size:10px; color:rgb(230 235 255 / .65); }+.office-arcade-keys { position:absolute; left:0; right:0; bottom:10px; margin:0; text-align:center; pointer-events:none; font-size:10px; font-weight:600; letter-spacing:.14em; text-transform:uppercase; color:rgb(230 235 255 / .55); }++.office-arcade-close { position:absolute; right:10px; top:8px; border:0; background:rgb(255 255 255 / .08); color:#e6ebff; width:28px; height:28px; border-radius:8px; font-size:18px; line-height:1; cursor:pointer; }+.office-arcade-close:hover { background:rgb(255 255 255 / .16); }+.office-arcade-close:focus-visible, .office-arcade-message:focus-visible { outline:2px solid hsl(var(--ring)); outline-offset:2px; }+.office-arcade-message { position:absolute; left:50%; top:50%; transform:translate(-50%, -50%); display:flex; flex-direction:column; align-items:center; gap:8px; max-width:80%; border:1px solid rgb(250 204 21 / .6); border-radius:12px; padding:16px 26px; background:rgb(11 10 20 / .78); color:#facc15; cursor:pointer; text-align:center; backdrop-filter:blur(4px); }+.office-arcade-message strong { font-size:26px; letter-spacing:.12em; text-transform:uppercase; color:#e6ebff; }+.office-arcade-message span { font-size:13px; font-weight:600; letter-spacing:.06em; }+@media (max-width:600px) { .office-arcade-hud { left:10px; top:8px; font-size:10px; } .office-arcade-message strong { font-size:18px; } }diff --git a/jarvis/ui/web/frontend/src/components/society/office/arcadeGame.test.ts b/jarvis/ui/web/frontend/src/components/society/office/arcadeGame.test.tsindex 03267f05df..c2508c47ea 100644--- a/jarvis/ui/web/frontend/src/components/society/office/arcadeGame.test.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/arcadeGame.test.ts@@ -1,19 +1,20 @@import { describe, expect, it } from "vitest";import {- ARCADE_H, ARCADE_W, ROCK_RADIUS, arcadeLevel, newArcade, spawnInterval, speedFactor, stepArcade,+ GUN_OFFSET, IDLE_INPUT, MAX_MISSILES, PLAY_X, launchMissile, lockedRockIds, PLAY_Y, ROCK_RADIUS, arcadeLevel, newArcade, spawnInterval, speedFactor, stepArcade,type ArcadeInput, type ArcadeState, type Rock,} from "./arcadeGame";-const idle: ArcadeInput = { left: false, right: false, up: false, down: false, fire: false };+const idle: ArcadeInput = IDLE_INPUT;const DT = 1 / 120;const run = (s: ArcadeState, input: ArcadeInput, seconds: number, random: () => number = () => 0.5) => {for (let t = 0; t < seconds; t += DT) stepArcade(s, input, DT, random);};+let rockIds = 1000;const rock = (over: Partial<Rock>): Rock => ({- x: 0, y: 0, vx: 0, vy: 0, size: 0, hp: 1, angle: 0, spin: 0, shape: [1, 1, 1, 1, 1, 1], flash: 0, ...over,+ id: rockIds++, x: 0, y: 0, z: -40, vx: 0, vy: 0, vz: 0, size: 0, hp: 1, variant: 0, rx: 0, ry: 0, sx: 0, sy: 0, tone: 0, flash: 0, ...over,});const playing = (): ArcadeState => {- const s = newArcade(() => 0.5);+ const s = newArcade();s.phase = "playing";s.spawnTimer = 999;return s;@@ -25,7 +26,7 @@ function seeded(seed: number): () => number {return () => { x = (x * 1664525 + 1013904223) % 4294967296; return x / 4294967296; };}-describe("asteroid run", () => {+describe("asteroid run (3D)", () => {it("does nothing until launched", () => {const s = newArcade();run(s, { ...idle, up: true }, 1);@@ -33,81 +34,102 @@ describe("asteroid run", () => {expect(s.rocks).toHaveLength(0);});- it("flies the rocket in every direction and keeps it on screen", () => {+ it("steers in every direction and stays inside its plane", () => {const s = playing();const y0 = s.shipY;- run(s, { ...idle, up: true }, 0.3);- expect(s.shipY).toBeLessThan(y0);- run(s, { ...idle, left: true }, 5);- expect(s.shipX).toBeGreaterThan(0);- expect(s.shipX).toBeLessThan(15);- run(s, { ...idle, right: true, down: true }, 5);- expect(s.shipX).toBeLessThan(ARCADE_W);- expect(s.shipY).toBeLessThan(ARCADE_H);+ run(s, { ...idle, up: true }, 0.2);+ expect(s.shipY).toBeGreaterThan(y0);+ run(s, { ...idle, left: true, down: true }, 5);+ expect(s.shipX).toBe(-PLAY_X);+ expect(s.shipY).toBe(-PLAY_Y);});it("drifts to a stop when no key is held", () => {const s = playing();run(s, { ...idle, right: true }, 0.3);run(s, idle, 2);- expect(Math.abs(s.vx)).toBeLessThan(1);+ expect(Math.abs(s.vx)).toBeLessThan(0.1);});- it("breaks a big rock into two smaller ones and scores it", () => {+ it("brings rocks towards the rocket and lets them pass", () => {const s = playing();- s.rocks = [rock({ x: 120, y: 100, size: 2, hp: 1 })];- s.shots = [{ x: 120, y: 100 }];- stepArcade(s, idle, 0.001, () => 0.5);+ s.rocks = [rock({ x: 8, y: 4, z: -60 })];+ s.shipX = -8;+ run(s, idle, 0.5);+ expect(s.rocks[0].z).toBeGreaterThan(-60);+ run(s, idle, 5);+ expect(s.rocks).toHaveLength(0);+ expect(s.shields).toBe(3);+ });++ it("a laser splits a big rock and scores it", () => {+ const s = playing();+ s.rocks = [rock({ x: s.shipX, y: s.shipY, z: -20, size: 2, hp: 1 })];+ s.lasers = [{ x: s.shipX, y: s.shipY, z: -17 }];+ stepArcade(s, idle, DT, () => 0.5);expect(s.rocks.map((r) => r.size)).toEqual([1, 1]);- expect(s.score).toBeGreaterThanOrEqual(25);+ expect(s.score).toBeGreaterThanOrEqual(20);});- it("needs several hits for a large rock", () => {+ it("a fast laser never tunnels through a small rock", () => {const s = playing();- s.rocks = [rock({ x: 120, y: 100, size: 2, hp: 4 })];- s.shots = [{ x: 120, y: 100 }];- stepArcade(s, idle, 0.001, () => 0.5);+ s.rocks = [rock({ x: 0, y: 0, z: -30, size: 0, hp: 1 })];+ s.lasers = [{ x: 0, y: 0, z: -29 }];+ stepArcade(s, idle, 1 / 30, () => 0.5);+ expect(s.rocks).toHaveLength(0);+ });++ it("big rocks need several hits", () => {+ const s = playing();+ s.rocks = [rock({ x: 0, y: 0, z: -20, size: 2, hp: 4 })];+ s.lasers = [{ x: 0, y: 0, z: -17 }];+ stepArcade(s, idle, DT, () => 0.5);expect(s.rocks).toHaveLength(1);expect(s.rocks[0].hp).toBe(3);});- it("loses a life on a crash, blinks, and ends on the last life", () => {+ it("loses a shield on a crash, blinks, and ends on the last one", () => {const s = playing();- s.rocks = [rock({ x: s.shipX, y: s.shipY })];- stepArcade(s, idle, 0.001);- expect(s.lives).toBe(2);+ s.rocks = [rock({ x: s.shipX, y: s.shipY, z: 0 })];+ stepArcade(s, idle, DT);+ expect(s.shields).toBe(2);expect(s.invulnerable).toBeGreaterThan(0);- s.rocks = [rock({ x: s.shipX, y: s.shipY })];- stepArcade(s, idle, 0.001);- expect(s.lives).toBe(2);+ s.rocks = [rock({ x: s.shipX, y: s.shipY, z: 0 })];+ stepArcade(s, idle, DT);+ expect(s.shields).toBe(2);s.invulnerable = 0;- s.lives = 1;- s.rocks = [rock({ x: s.shipX, y: s.shipY })];- stepArcade(s, idle, 0.001);+ s.shields = 1;+ s.rocks = [rock({ x: s.shipX, y: s.shipY, z: 0 })];+ stepArcade(s, idle, DT);expect(s.phase).toBe("over");});- it("a shield absorbs one crash", () => {+ it("flying through a pickup collects it", () => {const s = playing();- s.shield = true;- s.rocks = [rock({ x: s.shipX, y: s.shipY })];- stepArcade(s, idle, 0.001);- expect(s.lives).toBe(3);- expect(s.shield).toBe(false);+ s.pickups = [{ x: s.shipX, y: s.shipY, z: 0, kind: "shield", spin: 0 }, { x: s.shipX, y: s.shipY, z: 0, kind: "rapid", spin: 0 }];+ stepArcade(s, idle, DT);+ expect(s.shields).toBe(4);+ expect(s.rapid).toBeGreaterThan(0);});- it("collects pickups by touching them", () => {+ it("boost speeds the field up, drains, and refills", () => {const s = playing();- s.pickups = [{ x: s.shipX, y: s.shipY, kind: "rapid", t: 0 }, { x: s.shipX, y: s.shipY, kind: "life", t: 0 }];- stepArcade(s, idle, 0.001);- expect(s.rapid).toBeGreaterThan(0);- expect(s.lives).toBe(4);+ stepArcade(s, idle, DT);+ const cruise = s.speed;+ run(s, { ...idle, boost: true }, 1);+ expect(s.speed).toBeGreaterThan(cruise * 1.5);+ expect(s.boost).toBeLessThan(1);+ // Held on an empty tank it only flickers back in short bursts.+ run(s, { ...idle, boost: true }, 5);+ expect(s.boost).toBeLessThan(0.25);+ run(s, idle, 3);+ expect(s.boost).toBeGreaterThan(0.3);});it("gets harder the longer you survive", () => {- expect(spawnInterval(0)).toBeGreaterThan(1);+ expect(spawnInterval(0)).toBeGreaterThan(0.8);expect(spawnInterval(120)).toBeLessThan(spawnInterval(30));- expect(speedFactor(100)).toBeGreaterThan(2.5);+ expect(speedFactor(120)).toBe(3);const s = playing();s.time = 45;expect(arcadeLevel(s)).toBe(3);@@ -118,22 +140,55 @@ describe("asteroid run", () => {let early = 0, late = 0;for (let seed = 1; seed <= 20; seed += 1) {const random = seeded(seed);- const s = newArcade(random);+ const s = newArcade();s.phase = "playing";run(s, idle, 8, random);- if (s.lives === 3) early += 1;- run(s, idle, 170, random);+ if (s.shields === 3) early += 1;+ run(s, idle, 200, random);if ((s.phase as string) === "over") late += 1;}expect(early).toBeGreaterThanOrEqual(12);expect(late).toBe(20);});- it("keeps rocks inside the side walls", () => {+ it("fires twin laser bolts from both cannons", () => {const s = playing();- s.rocks = [rock({ x: 3, y: 100, vx: -50, size: 1 })];- stepArcade(s, idle, 0.05);- expect(s.rocks[0].x).toBeGreaterThanOrEqual(ROCK_RADIUS[1]);- expect(s.rocks[0].vx).toBeGreaterThan(0);+ stepArcade(s, { ...idle, fire: true }, DT);+ expect(s.lasers.map((l) => l.x - s.shipX).sort()).toEqual([-GUN_OFFSET, GUN_OFFSET]);+ });++ it("a clicked rock gets a homing missile that destroys it outright", () => {+ const s = playing();+ const target = rock({ x: 6, y: 3, z: -70, size: 2, hp: 4, vx: 1.5 });+ const bystander = rock({ x: -6, y: -3, z: -70, size: 2, hp: 4 });+ s.rocks = [target, bystander];+ expect(launchMissile(s, target.id)).toBe(true);+ expect(lockedRockIds(s).has(target.id)).toBe(true);+ expect(s.missileAmmo).toBe(MAX_MISSILES - 1);+ run(s, idle, 1.5);+ // Gone completely: a missile does not split a big rock into smaller ones.+ expect(s.rocks.map((r) => r.id)).toEqual([bystander.id]);+ expect(s.missiles).toHaveLength(0);+ expect(s.score).toBeGreaterThanOrEqual(20);+ });++ it("runs out of missiles and reloads them one by one", () => {+ const s = playing();+ s.rocks = [rock({ z: -140 }), rock({ z: -140 }), rock({ z: -140 }), rock({ z: -140 })];+ s.rocks.slice(0, 3).forEach((r) => expect(launchMissile(s, r.id)).toBe(true));+ expect(launchMissile(s, s.rocks[3].id)).toBe(false);+ run(s, idle, 4);+ expect(s.missileAmmo).toBe(1);+ });++ it("will not launch at a rock that is already gone", () => {+ const s = playing();+ expect(launchMissile(s, 424242)).toBe(false);+ expect(s.missileAmmo).toBe(MAX_MISSILES);+ });++ it("rock sizes grow from small to large", () => {+ expect(ROCK_RADIUS[0]).toBeLessThan(ROCK_RADIUS[1]);+ expect(ROCK_RADIUS[1]).toBeLessThan(ROCK_RADIUS[2]);});});diff --git a/jarvis/ui/web/frontend/src/components/society/office/arcadeGame.ts b/jarvis/ui/web/frontend/src/components/society/office/arcadeGame.tsindex 5046118ddb..4d36677ddd 100644--- a/jarvis/ui/web/frontend/src/components/society/office/arcadeGame.ts+++ b/jarvis/ui/web/frontend/src/components/society/office/arcadeGame.ts@@ -1,155 +1,228 @@/**- * The break-room arcade game: "Asteroid Run". A rocket flies up through an- * endless asteroid field; dodge or shoot the rocks. It starts gentle and gets- * harder the longer you survive: rocks come faster, denser and bigger.+ * The break-room arcade game: "Asteroid Run", in 3D. The rocket flies into+ * the screen (-z) through an endless asteroid field; it steers in its own+ * plane (x, y) while low-poly rocks come at it out of the depth. Dodge them+ * or shoot them apart. It starts gentle and gets harder the longer you last:+ * the field comes faster, denser and with bigger rocks.** Pure state and a fixed-rate `stepArcade`, so the rules are testable without- * a canvas; the cabinet overlay (ArcadeCabinet) only feeds input and draws.+ * WebGL; the cabinet overlay (ArcadeCabinet) feeds input in and draws.*/-/** Playfield size in logical units; the canvas scales it up. */-export const ARCADE_W = 240;-export const ARCADE_H = 320;+/** Half-extent of the plane the rocket can steer in (world units). */+export const PLAY_X = 9;+export const PLAY_Y = 5;+/** Rocks appear this far ahead and are gone once they pass the camera. */+export const SPAWN_Z = -150;+export const DESPAWN_Z = 14;-export const SHIP_RADIUS = 6;-const SHIP_ACCEL = 900;-const SHIP_MAX_SPEED = 150;-/** Fraction of velocity kept per second when no key is held (gentle drift). */-const SHIP_DRAG = 0.02;-const SHOT_SPEED = 330;-const SHOT_COOLDOWN = 0.2;-const RAPID_COOLDOWN = 0.08;-/** Seconds of blinking invulnerability after losing a life. */-const INVULNERABLE_S = 2;+export const SHIP_RADIUS = 0.6;+const SHIP_ACCEL = 70;+const SHIP_MAX_SPEED = 13;+/** Fraction of steering velocity kept per second when no key is held. */+const SHIP_DRAG = 0.01;+const LASER_SPEED = 150;+const LASER_COOLDOWN = 0.2;+export const RAPID_COOLDOWN = 0.08;+/** Twin cannons either side of the nose, fired as a pair. */+export const GUN_OFFSET = 0.55;+export const MAX_MISSILES = 3;+/** Seconds to reload one missile. */+const MISSILE_RELOAD = 3.5;+const MISSILE_SPEED = 55;+const MISSILE_MAX_SPEED = 150;+const MISSILE_ACCEL = 160;+/** Turn rate: how much of the way to the target heading is taken per second. */+const MISSILE_TURN = 7;export const RAPID_S = 8;-const MAX_LIVES = 5;+const INVULNERABLE_S = 1.6;+export const MAX_SHIELDS = 5;+/** Forward speed of the field at the start, in units per second. */+const BASE_SPEED = 32;+const BOOST_FACTOR = 1.7;+const BOOST_DRAIN = 0.4;+const BOOST_RECHARGE = 0.14;+/** Number of rock silhouettes; the renderer builds one mesh per variant. */+export const ROCK_VARIANTS = 4;export type ArcadePhase = "ready" | "playing" | "paused" | "over";export type RockSize = 0 | 1 | 2;-export type PickupKind = "shield" | "rapid" | "life";+export type PickupKind = "shield" | "rapid";/** Radius, hit points and score per rock size (small, medium, large). */-export const ROCK_RADIUS: Record<RockSize, number> = { 0: 6, 1: 11, 2: 17 };+export const ROCK_RADIUS: Record<RockSize, number> = { 0: 0.8, 1: 1.5, 2: 2.6 };const ROCK_HP: Record<RockSize, number> = { 0: 1, 1: 2, 2: 4 };-const ROCK_POINTS: Record<RockSize, number> = { 0: 100, 1: 50, 2: 25 };+const ROCK_POINTS: Record<RockSize, number> = { 0: 60, 1: 35, 2: 20 };export interface Rock {- x: number; y: number; vx: number; vy: number; size: RockSize; hp: number;- angle: number; spin: number;- /** Per-vertex radius factors: the jagged outline. */- shape: number[];+ /** Stable id, so a missile can keep chasing its rock. */+ id: number;+ x: number; y: number; z: number; vx: number; vy: number; vz: number;+ size: RockSize; hp: number; variant: number;+ /** Tumble: current rotation and spin per axis. */+ rx: number; ry: number; sx: number; sy: number;+ /** Shade 0..1 picked at birth, so the field is not one flat colour. */+ tone: number;/** Seconds of white flash after a hit that did not break it. */flash: number;}-export interface Shot { x: number; y: number }-export interface Pickup { x: number; y: number; kind: PickupKind; t: number }-export interface Particle { x: number; y: number; vx: number; vy: number; life: number; max: number; colour: string }-export interface Star { x: number; y: number; depth: number }+export interface Laser { x: number; y: number; z: number }+export interface Missile {+ x: number; y: number; z: number; vx: number; vy: number; vz: number;+ /** The rock it homes on; null once that rock is gone (it then flies on and burns out). */+ targetId: number | null;+ life: number;+}+export interface Pickup { x: number; y: number; z: number; kind: PickupKind; spin: number }+/** A fireball flash where something blew up; the renderer grows and fades it. */+export interface Blast { x: number; y: number; z: number; age: number; size: number }+export const BLAST_S = 0.45;+export interface Debris { x: number; y: number; z: number; vx: number; vy: number; vz: number; life: number; max: number; hot: boolean; spin: number }export interface ArcadeState {phase: ArcadePhase;/** Seconds survived in this run; drives the difficulty. */time: number;score: number;- lives: number;+ shields: number;shipX: number; shipY: number; vx: number; vy: number;invulnerable: number;- shield: boolean;rapid: number;cooldown: number;- shots: Shot[];+ /** Boost energy 0..1; `boosting` is whether boost was on in the last step. */+ boost: number;+ boosting: boolean;+ /** Forward speed of the field in the last step (the renderer streaks stars with it). */+ speed: number;+ lasers: Laser[];+ missiles: Missile[];+ /** Missiles ready to launch, and seconds until the next one is reloaded. */+ missileAmmo: number;+ missileReload: number;+ /** Seconds since the last laser volley, for the muzzle flash. */+ sinceShot: number;+ nextRockId: number;rocks: Rock[];pickups: Pickup[];- particles: Particle[];- stars: Star[];+ debris: Debris[];+ blasts: Blast[];spawnTimer: number;- /** Screen shake left, in seconds. */+ /** Camera shake left, in seconds. */shake: number;+ /** Seconds since the last hit on the ship, for the shield flash. */+ sinceHit: number;}-export interface ArcadeInput { left: boolean; right: boolean; up: boolean; down: boolean; fire: boolean }+export interface ArcadeInput { left: boolean; right: boolean; up: boolean; down: boolean; fire: boolean; boost: boolean }++export const IDLE_INPUT: ArcadeInput = { left: false, right: false, up: false, down: false, fire: false, boost: false };/** 1, 2, 3 … one level per 20 seconds survived. */export function arcadeLevel(state: ArcadeState): number {return 1 + Math.floor(state.time / 20);}-/** Seconds between new rocks: 1.3 s at the start, down towards 0.2 s. */+/** Seconds between new rocks: 0.9 s at the start, down towards 0.12 s. */export function spawnInterval(time: number): number {- return Math.max(0.2, 1.3 / (1 + time / 25));+ return Math.max(0.12, 0.9 / (1 + time / 20));}-/** How fast rocks fall relative to the start: doubles after about 50 s. */+/** How fast the field comes at you relative to the start: doubles after a minute. */export function speedFactor(time: number): number {- return 1 + time / 50;+ return 1 + time / 60;}-export function newArcade(random: () => number = Math.random): ArcadeState {- const stars: Star[] = [];- for (let i = 0; i < 70; i += 1) stars.push({ x: random() * ARCADE_W, y: random() * ARCADE_H, depth: 0.2 + random() * 0.8 });+export function newArcade(): ArcadeState {return {- phase: "ready", time: 0, score: 0, lives: 3,- shipX: ARCADE_W / 2, shipY: ARCADE_H - 40, vx: 0, vy: 0,- invulnerable: 0, shield: false, rapid: 0, cooldown: 0,- shots: [], rocks: [], pickups: [], particles: [], stars, spawnTimer: 0.8, shake: 0,+ phase: "ready", time: 0, score: 0, shields: 3,+ shipX: 0, shipY: -1, vx: 0, vy: 0,+ invulnerable: 0, rapid: 0, cooldown: 0, boost: 1, boosting: false, speed: BASE_SPEED,+ lasers: [], missiles: [], missileAmmo: MAX_MISSILES, missileReload: 0, sinceShot: 99, nextRockId: 1, rocks: [], pickups: [], debris: [], blasts: [], spawnTimer: 0.6, shake: 0, sinceHit: 99,};}-function makeRock(size: RockSize, x: number, y: number, vx: number, vy: number, random: () => number): Rock {- const points = 9 + size * 2;- const shape = Array.from({ length: points }, () => 0.72 + random() * 0.4);- return { x, y, vx, vy, size, hp: ROCK_HP[size], angle: random() * Math.PI * 2, spin: (random() - 0.5) * 2.4, shape, flash: 0 };+function makeRock(state: ArcadeState, size: RockSize, x: number, y: number, z: number, vx: number, vy: number, vz: number, random: () => number): Rock {+ return {+ id: state.nextRockId++, x, y, z, vx, vy, vz, size, hp: ROCK_HP[size], variant: Math.floor(random() * ROCK_VARIANTS),+ rx: random() * Math.PI * 2, ry: random() * Math.PI * 2, sx: (random() - 0.5) * 2, sy: (random() - 0.5) * 2,+ tone: random(), flash: 0,+ };}function spawnRock(state: ArcadeState, random: () => number): void {// Bigger rocks become more common as the run goes on.- const bigChance = Math.min(0.45, 0.12 + state.time / 250);+ const bigChance = Math.min(0.4, 0.12 + state.time / 300);const roll = random();- const size: RockSize = roll < bigChance ? 2 : roll < bigChance + 0.4 ? 1 : 0;- const r = ROCK_RADIUS[size];- const speed = (40 + random() * 35) * speedFactor(state.time) * (size === 0 ? 1.25 : 1);- const x = r + random() * (ARCADE_W - 2 * r);- state.rocks.push(makeRock(size, x, -r - 2, (random() - 0.5) * 40, speed, random));+ const size: RockSize = roll < bigChance ? 2 : roll < bigChance + 0.38 ? 1 : 0;+ // Most rocks cross the plane you fly in; some pass wide, for depth.+ const aimed = random() < 0.2 + Math.min(0.35, state.time / 200);+ const x = aimed ? state.shipX + (random() - 0.5) * 4 : (random() - 0.5) * (PLAY_X * 2 + 10);+ const y = aimed ? state.shipY + (random() - 0.5) * 3 : (random() - 0.5) * (PLAY_Y * 2 + 6);+ const drift = 1.5 + state.time / 40;+ state.rocks.push(makeRock(state, size, x, y, SPAWN_Z - random() * 20,+ (random() - 0.5) * drift, (random() - 0.5) * drift, random() * 10 * speedFactor(state.time), random));}-function burst(state: ArcadeState, x: number, y: number, count: number, colour: string, speed: number, random: () => number): void {+function burst(state: ArcadeState, x: number, y: number, z: number, count: number, speed: number, hot: boolean, random: () => number): void {for (let i = 0; i < count; i += 1) {- const a = random() * Math.PI * 2, v = speed * (0.3 + random() * 0.7), life = 0.35 + random() * 0.5;- state.particles.push({ x, y, vx: Math.cos(a) * v, vy: Math.sin(a) * v, life, max: life, colour });+ const u = random() * 2 - 1, a = random() * Math.PI * 2, s = Math.sqrt(1 - u * u);+ const v = speed * (0.35 + random() * 0.65), life = 0.5 + random() * 0.7;+ state.debris.push({ x, y, z, vx: s * Math.cos(a) * v, vy: s * Math.sin(a) * v, vz: u * v, life, max: life, hot, spin: (random() - 0.5) * 12 });}+ // A cap keeps a long, busy run from growing the debris list without bound.+ if (state.debris.length > 500) state.debris.splice(0, state.debris.length - 500);}-function breakRock(state: ArcadeState, rock: Rock, random: () => number): void {+/** Break a rock: lasers split it into smaller ones, a missile (`split` false) leaves nothing. */+function breakRock(state: ArcadeState, rock: Rock, random: () => number, split = true): void {state.score += ROCK_POINTS[rock.size];- burst(state, rock.x, rock.y, 8 + rock.size * 8, "#c9b79c", 60 + rock.size * 20, random);- burst(state, rock.x, rock.y, 5 + rock.size * 3, "#ffb454", 90, random);- if (rock.size > 0) {+ state.blasts.push({ x: rock.x, y: rock.y, z: rock.z, age: 0, size: ROCK_RADIUS[rock.size] * (split ? 1.6 : 2.4) });+ burst(state, rock.x, rock.y, rock.z, 10 + rock.size * 10, 6 + rock.size * 3, false, random);+ burst(state, rock.x, rock.y, rock.z, 6 + rock.size * 4, 9, true, random);+ if (split && rock.size > 0) {const child = (rock.size - 1) as RockSize;for (const side of [-1, 1]) {- state.rocks.push(makeRock(child, rock.x + side * ROCK_RADIUS[child] * 0.6, rock.y,- rock.vx + side * (25 + random() * 25), rock.vy * (0.85 + random() * 0.3), random));+ state.rocks.push(makeRock(state, child, rock.x + side * ROCK_RADIUS[child] * 0.7, rock.y, rock.z,+ rock.vx + side * (3 + random() * 3), rock.vy + (random() - 0.5) * 5, rock.vz, random));}}// Now and then a rock leaves something useful behind.const roll = random();- if (roll < 0.03) state.pickups.push({ x: rock.x, y: rock.y, kind: "life", t: 0 });- else if (roll < 0.09) state.pickups.push({ x: rock.x, y: rock.y, kind: "shield", t: 0 });- else if (roll < 0.15) state.pickups.push({ x: rock.x, y: rock.y, kind: "rapid", t: 0 });+ if (roll < 0.07) state.pickups.push({ x: rock.x, y: rock.y, z: rock.z, kind: "shield", spin: 0 });+ else if (roll < 0.15) state.pickups.push({ x: rock.x, y: rock.y, z: rock.z, kind: "rapid", spin: 0 });+}++/**+ * Launch a guided missile at a rock (the player clicked it). Returns false when+ * no missile is loaded, the game is not running, or the rock is already gone.+ */+export function launchMissile(state: ArcadeState, rockId: number): boolean {+ if (state.phase !== "playing" || state.missileAmmo < 1) return false;+ if (!state.rocks.some((rock) => rock.id === rockId)) return false;+ state.missileAmmo -= 1;+ if (state.missileReload <= 0) state.missileReload = MISSILE_RELOAD;+ // Out of the belly, nudged up and forward, then it finds its way.+ state.missiles.push({ x: state.shipX, y: state.shipY - 0.3, z: -0.8, vx: state.vx * 0.3, vy: 6, vz: -MISSILE_SPEED, targetId: rockId, life: 6 });+ return true;+}++/** Ids of the rocks a missile is currently chasing (the renderer marks them). */+export function lockedRockIds(state: ArcadeState): Set<number> {+ const ids = new Set<number>();+ for (const m of state.missiles) if (m.targetId !== null) ids.add(m.targetId);+ return ids;}function hitShip(state: ArcadeState, random: () => number): void {- state.shake = 0.35;- if (state.shield) {- state.shield = false;- state.invulnerable = 1;- burst(state, state.shipX, state.shipY, 18, "#7dd3fc", 120, random);- return;- }- state.lives -= 1;- burst(state, state.shipX, state.shipY, 30, "#ff7a59", 140, random);- if (state.lives <= 0) {- state.lives = 0;+ state.shake = 0.45;+ state.sinceHit = 0;+ state.shields -= 1;+ burst(state, state.shipX, state.shipY, 0, 24, 8, true, random);+ state.blasts.push({ x: state.shipX, y: state.shipY, z: 0, age: 0, size: 2.2 });+ if (state.shields <= 0) {+ state.shields = 0;state.phase = "over";+ burst(state, state.shipX, state.shipY, 0, 60, 12, true, random);} else {state.invulnerable = INVULNERABLE_S;state.rapid = 0;@@ -158,115 +231,155 @@ function hitShip(state: ArcadeState, random: () => number): void {/** Advance the game by `dt` seconds. `random` returns [0, 1) and is injectable for tests. */export function stepArcade(state: ArcadeState, input: ArcadeInput, dt: number, random: () => number = Math.random): void {- // Particles and stars keep drifting on the game-over screen; everything else stops.- for (const p of state.particles) { p.x += p.vx * dt; p.y += p.vy * dt; p.life -= dt; }- state.particles = state.particles.filter((p) => p.life > 0);+ // Debris keeps flying on the game-over screen; everything else stops.+ for (const d of state.debris) { d.x += d.vx * dt; d.y += d.vy * dt; d.z += d.vz * dt; d.life -= dt; }+ state.debris = state.debris.filter((d) => d.life > 0);+ for (const b of state.blasts) { b.age += dt; b.z += (state.phase === "playing" ? state.speed * 0.5 : 0) * dt; }+ state.blasts = state.blasts.filter((b) => b.age < BLAST_S);state.shake = Math.max(0, state.shake - dt);- if (state.phase !== "playing" && state.phase !== "over") return;- const starSpeed = 30 * speedFactor(state.time);- for (const s of state.stars) {- s.y += starSpeed * s.depth * dt;- if (s.y > ARCADE_H) { s.y -= ARCADE_H; s.x = random() * ARCADE_W; }- }+ state.sinceHit += dt;if (state.phase !== "playing") return;state.time += dt;- state.score += dt * 10 * arcadeLevel(state);state.invulnerable = Math.max(0, state.invulnerable - dt);state.rapid = Math.max(0, state.rapid - dt);state.cooldown = Math.max(0, state.cooldown - dt);- // Ship: accelerate towards the held direction, drift to a stop otherwise.+ // Boost: faster field, double score; it drains while held and refills slowly.+ const canBoost = state.boosting ? state.boost > 0 : state.boost > 0.2;+ state.boosting = input.boost && canBoost;+ state.boost = state.boosting ? Math.max(0, state.boost - BOOST_DRAIN * dt) : Math.min(1, state.boost + BOOST_RECHARGE * dt);+ state.speed = BASE_SPEED * speedFactor(state.time) * (state.boosting ? BOOST_FACTOR : 1);+ state.score += dt * state.speed * 0.25 * (state.boosting ? 2 : 1);++ // Steering: accelerate towards the held direction, drift to a stop otherwise.const ax = (input.right ? 1 : 0) - (input.left ? 1 : 0);- const ay = (input.down ? 1 : 0) - (input.up ? 1 : 0);+ const ay = (input.up ? 1 : 0) - (input.down ? 1 : 0);state.vx += ax * SHIP_ACCEL * dt;state.vy += ay * SHIP_ACCEL * dt;const drag = Math.pow(SHIP_DRAG, dt);if (ax === 0) state.vx *= drag;if (ay === 0) state.vy *= drag;- const speed = Math.hypot(state.vx, state.vy);- if (speed > SHIP_MAX_SPEED) { state.vx *= SHIP_MAX_SPEED / speed; state.vy *= SHIP_MAX_SPEED / speed; }+ const v = Math.hypot(state.vx, state.vy);+ if (v > SHIP_MAX_SPEED) { state.vx *= SHIP_MAX_SPEED / v; state.vy *= SHIP_MAX_SPEED / v; }state.shipX += state.vx * dt;state.shipY += state.vy * dt;- const minX = SHIP_RADIUS + 2, maxX = ARCADE_W - SHIP_RADIUS - 2, minY = 40, maxY = ARCADE_H - SHIP_RADIUS - 8;- if (state.shipX < minX || state.shipX > maxX) { state.shipX = Math.min(maxX, Math.max(minX, state.shipX)); state.vx = 0; }- if (state.shipY < minY || state.shipY > maxY) { state.shipY = Math.min(maxY, Math.max(minY, state.shipY)); state.vy = 0; }- // Engine exhaust.- if (random() < 0.7) {- const life = 0.2 + random() * 0.2;- state.particles.push({ x: state.shipX + (random() - 0.5) * 3, y: state.shipY + 9, vx: (random() - 0.5) * 20, vy: 60 + random() * 40, life, max: life, colour: random() < 0.5 ? "#ffd166" : "#ff7a59" });- }+ if (Math.abs(state.shipX) > PLAY_X) { state.shipX = Math.sign(state.shipX) * PLAY_X; state.vx = 0; }+ if (Math.abs(state.shipY) > PLAY_Y) { state.shipY = Math.sign(state.shipY) * PLAY_Y; state.vy = 0; }- // Shooting: twin shots while rapid fire lasts.+ // Lasers: twin guns while rapid fire lasts.+ state.sinceShot += dt;if (input.fire && state.cooldown <= 0) {- if (state.rapid > 0) state.shots.push({ x: state.shipX - 4, y: state.shipY - 6 }, { x: state.shipX + 4, y: state.shipY - 6 });- else state.shots.push({ x: state.shipX, y: state.shipY - 9 });- state.cooldown = state.rapid > 0 ? RAPID_COOLDOWN : SHOT_COOLDOWN;+ state.lasers.push({ x: state.shipX - GUN_OFFSET, y: state.shipY, z: -1.2 }, { x: state.shipX + GUN_OFFSET, y: state.shipY, z: -1.2 });+ state.cooldown = state.rapid > 0 ? RAPID_COOLDOWN : LASER_COOLDOWN;+ state.sinceShot = 0;+ }++ // Missile reload, one at a time.+ if (state.missileAmmo < MAX_MISSILES) {+ state.missileReload -= dt;+ if (state.missileReload <= 0) {+ state.missileAmmo += 1;+ state.missileReload = state.missileAmmo < MAX_MISSILES ? MISSILE_RELOAD : 0;+ }}- for (const s of state.shots) s.y -= SHOT_SPEED * dt;- state.shots = state.shots.filter((s) => s.y > -6);// New rocks.state.spawnTimer -= dt;while (state.spawnTimer <= 0) {spawnRock(state, random);- state.spawnTimer += spawnInterval(state.time) * (0.7 + random() * 0.6);+ state.spawnTimer += spawnInterval(state.time) * (0.6 + random() * 0.8);}- // Rocks move, bounce off the side walls, and leave at the bottom.+ // Everything ahead comes at the rocket with the field.for (const rock of state.rocks) {- rock.x += rock.vx * dt;- rock.y += rock.vy * dt;- rock.angle += rock.spin * dt;+ rock.x += rock.vx * dt; rock.y += rock.vy * dt; rock.z += (state.speed + rock.vz) * dt;+ rock.rx += rock.sx * dt; rock.ry += rock.sy * dt;rock.flash = Math.max(0, rock.flash - dt);- const r = ROCK_RADIUS[rock.size];- if (rock.x < r) { rock.x = r; rock.vx = Math.abs(rock.vx); }- if (rock.x > ARCADE_W - r) { rock.x = ARCADE_W - r; rock.vx = -Math.abs(rock.vx); }}+ for (const p of state.pickups) { p.z += state.speed * 0.8 * dt; p.spin += dt * 3; }- // Shots against rocks.+ // Lasers against rocks: swept along z, so a fast shot never tunnels through.const broken = new Set<Rock>();- state.shots = state.shots.filter((shot) => {+ state.lasers = state.lasers.filter((laser) => {+ const z0 = laser.z;+ laser.z -= LASER_SPEED * dt;+ if (laser.z < SPAWN_Z - 30) return false;for (const rock of state.rocks) {if (broken.has(rock)) continue;- const r = ROCK_RADIUS[rock.size];- if ((shot.x - rock.x) ** 2 + (shot.y - rock.y) ** 2 <= (r + 1.5) ** 2) {- rock.hp -= 1;- rock.flash = 0.08;- burst(state, shot.x, shot.y, 3, "#fde68a", 50, random);- if (rock.hp <= 0) broken.add(rock);- return false;- }+ const r = ROCK_RADIUS[rock.size] + 0.35;+ const closing = (state.speed + rock.vz) * dt;+ if (rock.z > z0 + r || rock.z < laser.z - r - closing) continue;+ if ((laser.x - rock.x) ** 2 + (laser.y - rock.y) ** 2 > r * r) continue;+ rock.hp -= 1;+ rock.flash = 0.09;+ burst(state, laser.x, laser.y, rock.z + ROCK_RADIUS[rock.size] * 0.6, 4, 5, true, random);+ if (rock.hp <= 0) broken.add(rock);+ return false;}return true;});- if (broken.size > 0) {- state.rocks = state.rocks.filter((rock) => !broken.has(rock));+ // Missiles home on their rock and blow it apart completely, whatever its size.+ const wrecked = new Set<Rock>();+ state.missiles = state.missiles.filter((m) => {+ m.life -= dt;+ const target = m.targetId === null ? undefined : state.rocks.find((rock) => rock.id === m.targetId && !broken.has(rock) && !wrecked.has(rock));+ if (!target) m.targetId = null;+ const speed = Math.min(MISSILE_MAX_SPEED, Math.hypot(m.vx, m.vy, m.vz) + MISSILE_ACCEL * dt);+ if (target) {+ // Lead the target a little, then turn the velocity towards it.+ const lead = Math.hypot(target.x - m.x, target.y - m.y, target.z - m.z) / speed;+ const tx = target.x + target.vx * lead - m.x, ty = target.y + target.vy * lead - m.y;+ const tz = target.z + (state.speed + target.vz) * lead - m.z;+ const tl = Math.hypot(tx, ty, tz) || 1;+ const k = Math.min(1, MISSILE_TURN * dt);+ m.vx += (tx / tl * speed - m.vx) * k; m.vy += (ty / tl * speed - m.vy) * k; m.vz += (tz / tl * speed - m.vz) * k;+ }+ const v = Math.hypot(m.vx, m.vy, m.vz) || 1;+ m.vx *= speed / v; m.vy *= speed / v; m.vz *= speed / v;+ m.x += m.vx * dt; m.y += m.vy * dt; m.z += m.vz * dt;+ // Exhaust: a hot spark and a puff of smoke behind it.+ if (random() < 0.8) {+ const life = 0.25 + random() * 0.3;+ state.debris.push({ x: m.x - m.vx / v * 0.6, y: m.y - m.vy / v * 0.6, z: m.z - m.vz / v * 0.6, vx: (random() - 0.5) * 2, vy: (random() - 0.5) * 2, vz: (random() - 0.5) * 2, life, max: life, hot: random() < 0.5, spin: 4 });+ }+ if (target && Math.hypot(target.x - m.x, target.y - m.y, target.z - m.z) < ROCK_RADIUS[target.size] + 0.6) {+ wrecked.add(target);+ return false;+ }+ return m.life > 0 && m.z > SPAWN_Z - 40 && m.z < DESPAWN_Z;+ });+ for (const rock of wrecked) burst(state, rock.x, rock.y, rock.z, 30 + rock.size * 15, 14, true, random);++ if (broken.size > 0 || wrecked.size > 0) {+ state.rocks = state.rocks.filter((rock) => !broken.has(rock) && !wrecked.has(rock));for (const rock of broken) breakRock(state, rock, random);+ for (const rock of wrecked) breakRock(state, rock, random, false);}- state.rocks = state.rocks.filter((rock) => rock.y - ROCK_RADIUS[rock.size] < ARCADE_H + 4);- // Pickups fall slowly and are collected by touch.- for (const p of state.pickups) { p.y += 45 * dt; p.t += dt; }+ // Pickups are collected by flying through them.state.pickups = state.pickups.filter((p) => {- if (Math.hypot(p.x - state.shipX, p.y - state.shipY) <= SHIP_RADIUS + 7) {- if (p.kind === "shield") state.shield = true;- else if (p.kind === "rapid") state.rapid = RAPID_S;- else state.lives = Math.min(MAX_LIVES, state.lives + 1);+ if (Math.abs(p.z) < 1.2 && Math.hypot(p.x - state.shipX, p.y - state.shipY) < 1.4) {+ if (p.kind === "shield") state.shields = Math.min(MAX_SHIELDS, state.shields + 1);+ else state.rapid = RAPID_S;state.score += 50;- burst(state, p.x, p.y, 12, "#a7f3d0", 70, random);+ burst(state, p.x, p.y, p.z, 14, 6, true, random);return false;}- return p.y < ARCADE_H + 8;+ return p.z < DESPAWN_Z;});- // A rock hits the ship (slightly forgiving hitbox).+ // A rock reaching the rocket's plane (slightly forgiving hitbox).if (state.invulnerable <= 0) {- const hit = state.rocks.find((rock) => Math.hypot(rock.x - state.shipX, rock.y - state.shipY) < ROCK_RADIUS[rock.size] * 0.85 + SHIP_RADIUS - 1);+ const hit = state.rocks.find((rock) => {+ const r = ROCK_RADIUS[rock.size] * 0.8 + SHIP_RADIUS;+ return Math.abs(rock.z) < r && Math.hypot(rock.x - state.shipX, rock.y - state.shipY) < r;+ });if (hit) {state.rocks = state.rocks.filter((rock) => rock !== hit);- burst(state, hit.x, hit.y, 12, "#c9b79c", 80, random);+ burst(state, hit.x, hit.y, hit.z, 16, 7, false, random);hitShip(state, random);}}+ state.rocks = state.rocks.filter((rock) => rock.z < DESPAWN_Z);}diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json b/jarvis/ui/web/frontend/src/i18n/locales/society/de.jsonindex 48dd00453f..7f6f2c9a4f 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json@@ -898,12 +898,15 @@"arcade_title": "Asteroid Run","arcade_score": "Punkte","arcade_level": "Level",- "arcade_lives": "Leben","arcade_best": "Rekord","arcade_start": "Leertaste drücken zum Starten","arcade_paused": "Pause: Leertaste zum Weiterfliegen","arcade_over": "Abgestürzt mit {0} Punkten. Leertaste für einen neuen Flug",- "arcade_keys": "WASD oder Pfeile fliegen · Leertaste schießt · P pausiert · E oder Esc verlässt · Schild, Blitz und Herz einsammeln",+ "arcade_keys": "WASD / Pfeile lenken · Leertaste Laser · Asteroid anklicken: Rakete · Shift Boost · P Pause · E / Esc verlassen",+ "arcade_shields": "Schilde",+ "arcade_boost": "Boost",+ "arcade_rapid": "Schnellfeuer",+ "arcade_missiles": "Raketen","room_lead": "Chefbüro","room_team": "Teamraum","room_wardrobe": "Garderobe",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json b/jarvis/ui/web/frontend/src/i18n/locales/society/en.jsonindex 8b3dd0e5c7..bd2b34c511 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json@@ -898,12 +898,15 @@"arcade_title": "Asteroid Run","arcade_score": "Score","arcade_level": "Level",- "arcade_lives": "Lives","arcade_best": "Best","arcade_start": "Press Space to launch","arcade_paused": "Paused: press Space to fly on","arcade_over": "Crashed with {0} points. Space flies again",- "arcade_keys": "WASD or arrows fly · Space shoots · P pauses · E or Esc leaves · Grab shield, lightning and heart drops",+ "arcade_keys": "WASD / arrows steer · Space lasers · Click a rock: missile · Shift boost · P pause · E / Esc leave",+ "arcade_shields": "Shields",+ "arcade_boost": "Boost",+ "arcade_rapid": "Rapid fire",+ "arcade_missiles": "Missiles","room_lead": "Lead office","room_team": "Team room","room_wardrobe": "Wardrobe",diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json b/jarvis/ui/web/frontend/src/i18n/locales/society/es.jsonindex d6afba548d..db50cda7c1 100644--- a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json@@ -898,12 +898,15 @@"arcade_title": "Asteroid Run","arcade_score": "Puntos","arcade_level": "Nivel",- "arcade_lives": "Vidas","arcade_best": "Récord","arcade_start": "Pulsa Espacio para despegar","arcade_paused": "Pausa: pulsa Espacio para seguir volando","arcade_over": "Te estrellaste con {0} puntos. Espacio para volar otra vez",- "arcade_keys": "WASD o flechas para volar · Espacio dispara · P pausa · E o Esc para salir · Recoge escudo, rayo y corazón",+ "arcade_keys": "WASD / flechas dirigir · Espacio láser · Clic en un asteroide: misil · Shift turbo · P pausa · E / Esc salir",+ "arcade_shields": "Escudos",+ "arcade_boost": "Turbo",+ "arcade_rapid": "Fuego rápido",+ "arcade_missiles": "Misiles","room_lead": "Despacho del líder","room_team": "Sala de equipos","room_wardrobe": "Vestuario",