Skip to content

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.

feat(verse): a hard-surface courier and flying made for fun (#688)

Ruben Lütkeecfb59ff9659
diff --git a/docs/agent-society/office-map.md b/docs/agent-society/office-map.md
index 84b2a9b93a..0100a86f32 100644
--- a/docs/agent-society/office-map.md
+++ b/docs/agent-society/office-map.md
@@ -637,7 +637,13 @@ street of team rooms round an atrium, with commons people use in between.
stands on it: a chrome and gold starship authored in Blender
(`art/studies/sky-pad-courier-study/source/build_courier.py`, three levels
of detail exported as glTF into `src/assets/society/courier/`), scaled to
- about 19 m beside the 1.3 m figures. The bridge and the deck are walkable
+ about 22 m beside the 1.3 m figures and centred on the deck. A lens hull
+ with a crisp blade edge and needle points, chrome back and charcoal belly
+ split by a gold edge trim, inlaid panel seams and belly vents, a bridge
+ with a framed visor, slim pods with flush gold bands, recessed glowing
+ nozzles and stabilisers round long tail spikes, swept wings, keel and
+ dorsal fins, gold nose pinstripes and red, green and strobing white
+ navigation lights. The bridge and the deck are walkable
(the navigation grid reaches beyond `layout.floor` for them, an idle wander
never does), the courier is solid, and the full map, the minimap and the
overview frame the pad too.
@@ -645,10 +651,14 @@ street of team rooms round an atrium, with commons people use in between.
E there, or a click on the ship once the person stands there, boards it (a
click from afar walks over first, as at the elevator). The flight
(`courierFlight.ts`) is a rigid body with thrust, lift, pitch, yaw and roll:
- *arcade* assist (the default) flies where the nose points, banks into
- turns and levels itself; *simulation* is Newtonian with momentum and
- drift. Cruise 70 m/s, boost to 150 m/s on a charge that drains and
- refills, brake. Every tower, the Dodaios tower with its floor, the pad, the
+ *arcade* assist (the default) is made for fun: it flies where the nose
+ points, turns fast, climbs and dives as steeply as the pilot likes, its
+ lift thrusters push straight up or down at up to 30 m/s whatever the
+ attitude, and it banks into turns and levels its wings (never its nose);
+ *simulation* is Newtonian with momentum and drift. Cruise 85 m/s, boost
+ to 170 m/s on a charge that drains and refills, brake. A click into the
+ view captures the mouse as a stick that springs back to the middle
+ (sideways turns, forwards and back pitches; Escape lets it go). Every tower, the Dodaios tower with its floor, the pad, the
street level and the singularity's core are solid (`courierWorld.ts`):
the ship bounces off in sub-steps no longer than 1.5 m (no tunnelling at
full boost), its shield flashes and the camera shakes. Past the city's
@@ -675,8 +685,8 @@ street of team rooms round an atrium, with commons people use in between.
| Action | Keys | Gamepad |
| --- | --- | --- |
| Throttle up / down | W / S | right / left trigger |
- | Turn left / right | A / D | left stick x |
- | Nose up / down | ↓ / ↑ | left stick y |
+ | Turn left / right | A / D (or the mouse) | left stick x |
+ | Nose up / down | ↑ / ↓ (or the mouse) | left stick y |
| Roll left / right | Q / E, ← / → | right stick x |
| Rise / sink | Space / C or Ctrl | right stick y |
| Boost / brake | Shift / X | A / B |
diff --git a/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod0.glb b/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod0.glb
index 28239017ef..1d980f2841 100644
Binary files a/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod0.glb and b/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod0.glb differ
diff --git a/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod1.glb b/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod1.glb
index 9fda7cc889..a7bf26f596 100644
Binary files a/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod1.glb and b/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod1.glb differ
diff --git a/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod2.glb b/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod2.glb
index 39e6be1745..e851287000 100644
Binary files a/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod2.glb and b/jarvis/ui/web/frontend/src/assets/society/courier/courier-lod2.glb differ
diff --git a/jarvis/ui/web/frontend/src/components/society/office/CourierHud.tsx b/jarvis/ui/web/frontend/src/components/society/office/CourierHud.tsx
index 1368c318e1..3d0c7bcb48 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/CourierHud.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/CourierHud.tsx
@@ -35,6 +35,7 @@ export function CourierHud() {
const helpOpen = useCourier((s) => s.helpOpen);
const settingsOpen = useCourier((s) => s.settingsOpen);
const bindings = useCourier((s) => s.bindings);
+ const mouseLocked = useCourier((s) => s.mouseLocked);
const store = useCourier.getState;
const kmh = Math.round(telemetry.speed * 3.6);
const boostShare = Math.min(1, telemetry.speed / FLIGHT.boost);
@@ -69,7 +70,9 @@ export function CourierHud() {
<button type="button" className="office-chip" aria-pressed={helpOpen} onClick={() => store().set({ helpOpen: !helpOpen })}>{t("society.office.flight_help")}</button>
<button type="button" className="office-chip" onClick={() => store().set({ settingsOpen: true })}>{t("society.office.flight_settings")}</button>
</div>
- {telemetry.landed && <p className="office-hint">{t("society.office.flight_landed_hint").replace("{0}", keysOf("exit"))}</p>}
+ {telemetry.landed
+ ? <p className="office-hint">{t("society.office.flight_landed_hint").replace("{0}", keysOf("exit"))}</p>
+ : <p className="office-hint">{t(mouseLocked ? "society.office.flight_mouse_on" : "society.office.flight_mouse_hint")}</p>}
</div>
{helpOpen && !settingsOpen && (
<div className="courier-help office-card" data-office-ui>
diff --git a/jarvis/ui/web/frontend/src/components/society/office/SkyCourier.tsx b/jarvis/ui/web/frontend/src/components/society/office/SkyCourier.tsx
index c1c7c00fb3..a14573a828 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/SkyCourier.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/office/SkyCourier.tsx
@@ -27,7 +27,7 @@ import courierFar from "@/assets/society/courier/courier-lod2.glb";
import { planCity } from "./cityPlan";
import { cachedCanvasTexture } from "./canvasMaterials";
import { CourierEngineSound } from "./courierAudio";
-import { FLIGHT_ACTIONS, flightInput, PAD_PRESSES, PRESS_ACTIONS, type FlightAction, type PadState } from "./courierControls";
+import { addMouse, FLIGHT_ACTIONS, flightInput, PAD_PRESSES, PRESS_ACTIONS, type FlightAction, type PadState } from "./courierControls";
import { engageAutopilot, FLIGHT, forwardOf, heightOverDeck, NO_INPUT, parkedState, stepFlight, type FlightState } from "./courierFlight";
import { courierSession, useCourier } from "./courierStore";
import { buildCourierWorld, rayDistance } from "./courierWorld";
@@ -41,14 +41,14 @@ import { COURIER_GROUP } from "./stations";
/** Authored geometry the runtime drives (model units = authored metres): where the gear retracts to, the exhausts, the pod tails. */
const MODEL = {
gearTravel: 1.9,
- exhausts: [[-6.6, -0.25, 12.6], [6.6, -0.25, 12.6]] as const,
- tails: [[-6.6, -0.25, 17.2], [6.6, -0.25, 17.2]] as const,
- shield: [8.6, 4.2, 19] as const,
+ exhausts: [[-5.9, -0.15, 13.8], [5.9, -0.15, 13.8]] as const,
+ tails: [[-5.9, -0.15, 20.8], [5.9, -0.15, 20.8]] as const,
+ shield: [9.2, 4, 21] as const,
} as const;
/** Chase camera: behind and above the ship (world metres), and where it looks. Cockpit: the pilot's eyes. */
const CHASE = { back: 22, up: 6, lookAhead: 24, stiffness: 5 } as const;
-const COCKPIT = { up: 1.55, forward: -4.2 } as const;
+const COCKPIT = { up: 1.25, forward: -3.6 } as const;
const FLIGHT_FOV = { cruise: 60, boost: 72 } as const;
// ---------------------------------------------------------------------------
@@ -104,13 +104,16 @@ function panelTexture(): Texture | null {
ctx.fillStyle = "#8a8a8a";
for (let y = 8; y < h; y += 64) for (let x = 6; x < w; x += 12) ctx.fillRect(x, y, 2, 2);
});
- if (tex) { tex.wrapS = tex.wrapT = RepeatWrapping; tex.repeat.set(2.5, 2.5); }
+ // The hull's UVs run across (u) and along (v) it: plates about a metre wide and a metre and a quarter long.
+ if (tex) { tex.wrapS = tex.wrapT = RepeatWrapping; tex.repeat.set(1.5, 3); }
return tex;
}
interface CourierMaterials {
byName: Record<string, Material>;
glow: MeshBasicMaterial;
+ /** The white tail and mast lights: a short flash every second and a half. */
+ strobe: MeshBasicMaterial;
all: Material[];
}
@@ -122,10 +125,19 @@ function courierMaterials(env: Texture): CourierMaterials {
const glass = new MeshStandardMaterial({ color: "#0b1526", metalness: 0.9, roughness: 0.04, envMap: env, envMapIntensity: 1.6 });
const glow = new MeshBasicMaterial({ color: "#6fd8ff", toneMapped: false });
const strip = new MeshBasicMaterial({ color: "#8be9ff", toneMapped: false });
+ const belly = new MeshStandardMaterial({ color: "#2b2e35", metalness: 0.85, roughness: 0.3, envMap: env, envMapIntensity: 0.9, bumpMap: panels, bumpScale: 0.1 });
+ const vent = new MeshStandardMaterial({ color: "#0b0c10", metalness: 0.5, roughness: 0.6 });
+ const navRed = new MeshBasicMaterial({ color: "#ff2a2a", toneMapped: false });
+ const navGreen = new MeshBasicMaterial({ color: "#2aff6a", toneMapped: false });
+ const navWhite = new MeshBasicMaterial({ color: "#ffffff", toneMapped: false });
return {
- byName: { Chrome: chrome, Gold: gold, Graphite: graphite, CanopyGlass: glass, EngineGlow: glow, LightStrip: strip },
+ byName: {
+ Chrome: chrome, Gold: gold, Graphite: graphite, CanopyGlass: glass, EngineGlow: glow, LightStrip: strip,
+ Belly: belly, Vent: vent, NavRed: navRed, NavGreen: navGreen, NavWhite: navWhite,
+ },
glow,
- all: [chrome, gold, graphite, glass, glow, strip],
+ strobe: navWhite,
+ all: [chrome, gold, graphite, glass, glow, strip, belly, vent, navRed, navGreen, navWhite],
};
}
@@ -351,6 +363,8 @@ function Courier({ layout, pad, reduced, awake }: { layout: OfficeLayout; pad: S
// The keys and the sound belong to a flight on screen: another section or a hidden window gets its keys back.
const live = flying && awake;
const held = useRef(new Set<string>());
+ /** Mouse movement while the pointer is captured: a virtual stick that springs back to the middle. */
+ const mouse = useRef({ x: 0, y: 0 });
const padPressed = useRef(new Set<number>());
const sound = useRef<CourierEngineSound | null>(null);
const camPos = useRef(new Vector3());
@@ -438,11 +452,37 @@ function Courier({ layout, pad, reduced, awake }: { layout: OfficeLayout; pad: S
};
const up = (event: KeyboardEvent) => { held.current.delete(event.code); };
const blur = () => held.current.clear();
+ // A click into the view captures the mouse for steering; Escape (the browser's own) lets it go again.
+ const canvas = gl.domElement;
+ const capture = () => {
+ if (document.pointerLockElement === canvas || useCourier.getState().settingsOpen) return;
+ try {
+ const pending = canvas.requestPointerLock?.() as unknown as Promise<void> | undefined;
+ pending?.catch?.((error: unknown) => console.warn("mouse steering unavailable", error));
+ } catch (error) {
+ console.warn("mouse steering unavailable", error);
+ }
+ };
+ const move = (event: MouseEvent) => {
+ if (document.pointerLockElement !== canvas) return;
+ mouse.current.x += event.movementX;
+ mouse.current.y += event.movementY;
+ };
+ const lockChange = () => useCourier.getState().set({ mouseLocked: document.pointerLockElement === canvas });
+ canvas.addEventListener("click", capture);
+ window.addEventListener("mousemove", move);
+ document.addEventListener("pointerlockchange", lockChange);
window.addEventListener("keydown", down, true);
window.addEventListener("keyup", up, true);
window.addEventListener("blur", blur);
pressHandler.current = press;
return () => {
+ canvas.removeEventListener("click", capture);
+ window.removeEventListener("mousemove", move);
+ document.removeEventListener("pointerlockchange", lockChange);
+ if (document.pointerLockElement === canvas) document.exitPointerLock();
+ mouse.current.x = 0; mouse.current.y = 0;
+ useCourier.getState().set({ mouseLocked: false });
window.removeEventListener("keydown", down, true);
window.removeEventListener("keyup", up, true);
window.removeEventListener("blur", blur);
@@ -451,7 +491,7 @@ function Courier({ layout, pad, reduced, awake }: { layout: OfficeLayout; pad: S
sound.current = null;
pressHandler.current = null;
};
- }, [live, camera]);
+ }, [live, camera, gl]);
const pressHandler = useRef<((action: FlightAction) => void) | null>(null);
// Leaving the floor or the map mid-flight: the ship is parked again, the person stands beside it, the lens is
@@ -491,7 +531,12 @@ function Courier({ layout, pad, reduced, awake }: { layout: OfficeLayout; pad: S
if (isDown) padPressed.current.add(button); else padPressed.current.delete(button);
}
}
- const input = store.settingsOpen ? NO_INPUT : flightInput(held.current, store.bindings, gamepad, store.invertPitch);
+ const input = store.settingsOpen ? { ...NO_INPUT } : flightInput(held.current, store.bindings, gamepad, store.invertPitch);
+ // The mouse adds to the keys: sideways turns, up lifts the nose, down dips it.
+ const m = mouse.current;
+ addMouse(input, m, store.invertPitch);
+ const springBack = Math.exp(-10 * dt);
+ m.x *= springBack; m.y *= springBack;
stepFlight(s, input, dt, store.assist, world, home);
if (s.impact > lastImpact.current + 6 && sound.current) sound.current.impact(s.impact);
lastImpact.current = s.impact;
@@ -527,6 +572,7 @@ function Courier({ layout, pad, reduced, awake }: { layout: OfficeLayout; pad: S
if (levels) for (const { node, y } of levels.gear) node.position.y = y + (1 - st.gear) * MODEL.gearTravel;
const power = st.landed ? 0.12 : 0.25 + st.throttle * 0.75;
materials?.glow.color.setRGB(0.25 + power * 0.6, 0.55 + power * 0.45, 1).multiplyScalar(0.6 + power * 1.8);
+ materials?.strobe.color.setScalar(reduced || (clock.elapsedTime % 1.5) < 0.09 ? 1.6 : 0.12);
flameMaterial.uniforms.uTime.value = reduced ? 0 : clock.elapsedTime;
flameMaterial.uniforms.uPower.value = st.landed ? 0 : 0.35 + st.throttle * 0.9;
for (const f of flames.current) if (f) f.scale.set(1, 1, st.landed ? 0.01 : 2 + st.throttle * 7);
diff --git a/jarvis/ui/web/frontend/src/components/society/office/courierControls.ts b/jarvis/ui/web/frontend/src/components/society/office/courierControls.ts
index 3ef9c6ae3b..7a95ff0806 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/courierControls.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/courierControls.ts
@@ -18,7 +18,7 @@ export type FlightBindings = Record<FlightAction, string[]>;
export const DEFAULT_BINDINGS: FlightBindings = {
throttleUp: ["KeyW"], throttleDown: ["KeyS"],
- pitchUp: ["ArrowDown"], pitchDown: ["ArrowUp"],
+ pitchUp: ["ArrowUp"], pitchDown: ["ArrowDown"],
yawLeft: ["KeyA"], yawRight: ["KeyD"],
rollLeft: ["KeyQ", "ArrowLeft"], rollRight: ["KeyE", "ArrowRight"],
liftUp: ["Space"], liftDown: ["KeyC", "ControlLeft"],
@@ -26,7 +26,8 @@ export const DEFAULT_BINDINGS: FlightBindings = {
assist: ["KeyT"], camera: ["KeyV"], land: ["KeyL"], exit: ["KeyF"], help: ["KeyH"],
};
-const STORAGE_KEY = "dodaios.verse.courier.bindings";
+/** Versioned: the first defaults had the arrows the other way round, and a saved copy of them must not survive. */
+const STORAGE_KEY = "dodaios.verse.courier.bindings.v2";
/** The pilot's bindings: the defaults with whatever this browser remembers laid over them. */
export function loadBindings(storage: Pick<Storage, "getItem"> | null = safeStorage()): FlightBindings {
@@ -100,6 +101,7 @@ export function flightInput(held: ReadonlySet<string>, bindings: FlightBindings,
const axis = (plus: FlightAction, minus: FlightAction) => on(plus) - on(minus);
const b = (i: number) => pad?.buttons[i]?.value ?? 0;
const clamp = (v: number) => Math.max(-1, Math.min(1, v));
+ // A stick pushed forward (negative y) dives, as in every flight game.
const pitch = clamp(axis("pitchUp", "pitchDown") + stick(pad?.axes[1]));
return {
throttle: clamp(axis("throttleUp", "throttleDown") + b(7) - b(6)),
@@ -114,3 +116,17 @@ export function flightInput(held: ReadonlySet<string>, bindings: FlightBindings,
/** Gamepad buttons that fire a press action: X lands, Y switches the camera, Back the assist, Start leaves the ship. */
export const PAD_PRESSES: readonly [number, FlightAction][] = [[2, "land"], [3, "camera"], [8, "assist"], [9, "exit"]];
+
+/** Stick travel per pixel of captured mouse movement. */
+export const MOUSE_GAIN = 0.02;
+
+/**
+ * Captured mouse movement (pixels, browser axes: +y is down) added to an input: moving the mouse sideways turns,
+ * moving it up lifts the nose and down dips it (the other way round with inverted pitch).
+ */
+export function addMouse(input: FlightInput, mouse: { x: number; y: number }, invertPitch: boolean): FlightInput {
+ const clamp = (v: number) => Math.max(-1, Math.min(1, v));
+ input.yaw = clamp(input.yaw + mouse.x * MOUSE_GAIN);
+ input.pitch = clamp(input.pitch + (invertPitch ? mouse.y : -mouse.y) * MOUSE_GAIN);
+ return input;
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/office/courierFlight.test.ts b/jarvis/ui/web/frontend/src/components/society/office/courierFlight.test.ts
index c547ef0bc5..1641fc0756 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/courierFlight.test.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/courierFlight.test.ts
@@ -1,7 +1,7 @@
import { describe, expect, it } from "vitest";
import { Vector3 } from "three";
import { GROUND_Y, planCity } from "./cityPlan";
-import { DEFAULT_BINDINGS, flightInput, keyLabel, loadBindings, rebind, saveBindings } from "./courierControls";
+import { addMouse, DEFAULT_BINDINGS, flightInput, keyLabel, loadBindings, rebind, saveBindings } from "./courierControls";
import { engageAutopilot, FLIGHT, forwardOf, NO_INPUT, parkedState, stepFlight, type FlightInput, type FlightState } from "./courierFlight";
import { buildCourierWorld, rayDistance, sphereContact } from "./courierWorld";
import { buildOfficeLayout } from "./officeLayout";
@@ -86,6 +86,28 @@ describe("the courier's flight", () => {
expect(s.p.y).toBeGreaterThan(COURIER.standHeight + 5);
});
+ it("in arcade, climbs and dives steeply and its lift goes straight up or down", () => {
+ const s = parkedState(home);
+ fly(s, { lift: 1 }, 2);
+ fly(s, { throttle: 1 }, 2);
+ // Full stick back for a second: the nose comes far up, and stays there when the stick is let go.
+ fly(s, { pitch: 1 }, 0.8);
+ const climb = forwardOf(s.q).y;
+ expect(climb).toBeGreaterThan(0.6);
+ fly(s, {}, 1);
+ expect(forwardOf(s.q).y).toBeGreaterThan(climb - 0.1);
+ // From level flight the sink key sinks fast, and a dive goes down steeply.
+ const level = parkedState(home);
+ fly(level, { lift: 1 }, 2);
+ fly(level, { throttle: 1 }, 2);
+ const y = level.p.y;
+ fly(level, { lift: -1 }, 1);
+ expect(level.p.y).toBeLessThan(y - 10);
+ expect(level.v.y).toBeLessThan(-FLIGHT.lift * 0.5);
+ fly(level, { pitch: -1 }, 0.8);
+ expect(forwardOf(level.q).y).toBeLessThan(-0.6);
+ });
+
it("in arcade, flies where its nose points at the throttle's speed and levels its wings", () => {
const s = parkedState(home);
fly(s, { lift: 1 }, 3);
@@ -100,7 +122,8 @@ describe("the courier's flight", () => {
it("in simulation, keeps drifting the old way after a turn", () => {
const s = parkedState(home);
- fly(s, { lift: 1 }, 3, "simulation");
+ fly(s, { lift: 1 }, 0.6, "simulation");
+ fly(s, { lift: -1 }, 0.6, "simulation");
fly(s, { throttle: 1 }, 3, "simulation");
fly(s, { throttle: -1 }, 2, "simulation");
const before = s.v.clone().normalize();
@@ -189,6 +212,20 @@ describe("the courier's controls", () => {
expect(flightInput(new Set(), DEFAULT_BINDINGS, { axes: [0.1, -0.1, 0, 0], buttons: [] }, false).yaw).toBe(0);
});
+ it("turns the mouse into a stick: up lifts the nose, down dips it, sideways turns", () => {
+ const up = addMouse({ ...NO_INPUT }, { x: 0, y: -20 }, false);
+ expect(up.pitch).toBeGreaterThan(0.3);
+ expect(addMouse({ ...NO_INPUT }, { x: 0, y: 20 }, false).pitch).toBeLessThan(-0.3);
+ expect(addMouse({ ...NO_INPUT }, { x: 0, y: -20 }, true).pitch).toBeLessThan(-0.3);
+ expect(addMouse({ ...NO_INPUT }, { x: 30, y: 0 }, false).yaw).toBeGreaterThan(0.3);
+ // And a mouse moved up for a moment really brings the nose up in flight.
+ const s = parkedState(home);
+ fly(s, { lift: 1 }, 2);
+ fly(s, { throttle: 1 }, 2);
+ for (let i = 0; i < 40; i += 1) stepFlight(s, addMouse({ ...NO_INPUT }, { x: 0, y: -30 }, false), 1 / 60, "arcade", world, home);
+ expect(forwardOf(s.q).y).toBeGreaterThan(0.4);
+ });
+
it("rebinds a key to one action and remembers it", () => {
const next = rebind(DEFAULT_BINDINGS, "boost", "KeyW");
expect(next.boost).toEqual(["KeyW"]);
diff --git a/jarvis/ui/web/frontend/src/components/society/office/courierFlight.ts b/jarvis/ui/web/frontend/src/components/society/office/courierFlight.ts
index 7196e49a9a..fb4d381456 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/courierFlight.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/courierFlight.ts
@@ -7,9 +7,10 @@
* Frame: the ship's nose is its local -z, its top +y, its right +x (as the
* exported model). Speeds are metres per second at the Verse's scale.
*
- * - Arcade assist (the default): the ship flies where it points. Its velocity
- * is pulled towards the nose times the throttle's speed, it banks into turns
- * and levels itself when the stick is let go.
+ * - Arcade assist (the default): made for fun. The ship flies where it points,
+ * turns fast, climbs and dives as steeply as the pilot likes, and its lift
+ * thrusters push straight up or down whatever its attitude. It banks into
+ * turns and levels its wings (never its nose) when the stick is let go.
* - Simulation: Newtonian. Thrust accelerates along the nose, the ship keeps
* its momentum and drifts; only light rotational dampers help.
*/
@@ -59,19 +60,20 @@ export interface FlightState {
}
export const FLIGHT = {
- cruise: 70,
- boost: 150,
+ cruise: 85,
+ boost: 170,
/** Thrust along the nose (m/s²) in simulation, and the boost's factor on it. */
thrust: 24,
boostFactor: 2.4,
- lift: 14,
+ /** Vertical thrust: arcade climbs and sinks at up to this speed (m/s); simulation accelerates with it. */
+ lift: 30,
/** Body rate at full stick (rad/s): pitch, yaw, roll. */
- rates: [1.1, 0.75, 1.9] as const,
+ rates: [1.9, 1.3, 2.8] as const,
/** How fast arcade pulls the velocity onto the nose (1/s), and the simulation's linear drag. */
- grip: 1.7,
+ grip: 2.6,
drag: 0.025,
/** The throttle lever's travel per second at full input. */
- leverRate: 0.6,
+ leverRate: 1.1,
/** Boost charge spent and regained per second. */
boostDrain: 0.22,
boostRecharge: 0.12,
@@ -139,9 +141,7 @@ export function stepFlight(s: FlightState, raw: FlightInput, dt: number, assist:
const bank = Math.asin(Math.max(-1, Math.min(1, _r.y)));
const wanted = -input.yaw * 0.5;
if (!input.roll) target.z += (wanted - bank) * 2.2;
- // Level the nose a little when no pitch is held, so the horizon comes back.
- if (!input.pitch) target.x += -Math.asin(Math.max(-1, Math.min(1, _f.y))) * 0.6;
- s.w.lerp(target, 1 - Math.exp(-8 * dt));
+ s.w.lerp(target, 1 - Math.exp(-10 * dt));
} else {
s.w.addScaledVector(_a.copy(target).sub(s.w), 1 - Math.exp(-3 * dt));
}
@@ -152,7 +152,9 @@ export function stepFlight(s: FlightState, raw: FlightInput, dt: number, assist:
// Translation.
const top = boosting ? FLIGHT.boost : FLIGHT.cruise;
if (assist === "arcade") {
- const want = _t.copy(_f).multiplyScalar(s.throttle * top).addScaledVector(_u, input.lift * FLIGHT.lift);
+ // Lift thrusters push along the world's up, so Space always climbs and the sink key always sinks.
+ const want = _t.copy(_f).multiplyScalar(s.throttle * top);
+ want.y += input.lift * FLIGHT.lift;
s.v.lerp(want, 1 - Math.exp(-FLIGHT.grip * (boosting ? 1.4 : 1) * dt));
} else {
s.v.addScaledVector(_f, s.throttle * FLIGHT.thrust * (boosting ? FLIGHT.boostFactor : 1) * dt);
diff --git a/jarvis/ui/web/frontend/src/components/society/office/courierStore.ts b/jarvis/ui/web/frontend/src/components/society/office/courierStore.ts
index 1a63ec20b3..9a54037761 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/courierStore.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/courierStore.ts
@@ -63,6 +63,8 @@ interface CourierState extends CourierPrefs {
bindings: FlightBindings;
helpOpen: boolean;
settingsOpen: boolean;
+ /** The mouse is captured for steering. */
+ mouseLocked: boolean;
telemetry: CourierTelemetry;
/** Bumped when the pilot asks for the landing assist, or to step out, from the HUD (the keys act in the scene). */
landRequest: number;
@@ -71,7 +73,7 @@ interface CourierState extends CourierPrefs {
disembark: () => void;
setPrefs: (patch: Partial<CourierPrefs>) => void;
setBindings: (bindings: FlightBindings) => void;
- set: (patch: Partial<Pick<CourierState, "helpOpen" | "settingsOpen" | "telemetry">>) => void;
+ set: (patch: Partial<Pick<CourierState, "helpOpen" | "settingsOpen" | "telemetry" | "mouseLocked">>) => void;
requestLanding: () => void;
requestExit: () => void;
setReady: (ready: boolean) => void;
@@ -86,6 +88,7 @@ export const useCourier = create<CourierState>((set, get) => ({
bindings: loadBindings(),
helpOpen: false,
settingsOpen: false,
+ mouseLocked: false,
telemetry: IDLE,
landRequest: 0,
exitRequest: 0,
diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeControls.ts b/jarvis/ui/web/frontend/src/components/society/office/officeControls.ts
index 5772025181..fc322536d5 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/officeControls.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/officeControls.ts
@@ -48,6 +48,7 @@ export const OFFICE_CONTROLS: readonly OfficeControl[] = [
{ id: "fly_throttle", group: "fly", keys: [["W", "S"]], agentsOnly: true },
{ id: "fly_turn", group: "fly", keys: [["A", "D"]], agentsOnly: true },
{ id: "fly_pitch", group: "fly", keys: [["ArrowUp", "ArrowDown"]], agentsOnly: true },
+ { id: "fly_mouse", group: "fly", keys: [["mouse:click"]], agentsOnly: true },
{ id: "fly_roll", group: "fly", keys: [["Q", "E"], ["ArrowLeft", "ArrowRight"]], agentsOnly: true },
{ id: "fly_lift", group: "fly", keys: [["Space", "C"]], agentsOnly: true },
{ id: "fly_boost", group: "fly", keys: [["Shift"]], agentsOnly: true },
diff --git a/jarvis/ui/web/frontend/src/components/society/office/officeStore.ts b/jarvis/ui/web/frontend/src/components/society/office/officeStore.ts
index 0eb1e75f1a..6081008e41 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/officeStore.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/officeStore.ts
@@ -7,6 +7,7 @@
*/
import { create } from "zustand";
import type { CheckpointKind, Point } from "./officeLayout";
+import { courierSession } from "./courierStore";
/**
* `arcade` is a playable arcade cabinet, by furniture id. `team` is a team studio's board, by its
@@ -110,7 +111,8 @@ export const useOfficeStore = create<OfficeState>((set) => ({
selection: null,
nearby: null,
hover: null,
- setHover: (hover) => set((s) => (sameSelection(s.hover, hover) ? s : { hover })),
+ // In the courier a click steers the ship: nothing in the office is hovered, picked or walked to meanwhile.
+ setHover: (hover) => set((s) => (sameSelection(s.hover, hover) || (hover && courierSession.flying) ? s : { hover })),
follow: true,
focus: null,
summons: {},
@@ -144,7 +146,7 @@ export const useOfficeStore = create<OfficeState>((set) => ({
const gone = new Set(agentIds);
return { summons: Object.fromEntries(Object.entries(s.summons).filter(([id]) => !gone.has(id))) };
}),
- select: (selection) => set({ selection }),
+ select: (selection) => { if (!(selection && courierSession.flying)) set({ selection }); },
setNearby: (nearby) => set((s) => (sameSelection(s.nearby, nearby) ? s : { nearby })),
setFollow: (follow) => set((s) => (s.follow === follow ? s : { follow })),
focusOn: (point) => set({ focus: { point, seq: ++seq }, follow: false }),
@@ -161,7 +163,7 @@ export const useOfficeStore = create<OfficeState>((set) => ({
});
return { summons: next };
}),
- requestWalk: (point) => set({ walkTo: { point, seq: ++seq }, follow: true }),
+ requestWalk: (point) => { if (!courierSession.flying) set({ walkTo: { point, seq: ++seq }, follow: true }); },
}));
/**
diff --git a/jarvis/ui/web/frontend/src/components/society/office/skyPad.ts b/jarvis/ui/web/frontend/src/components/society/office/skyPad.ts
index dfa7932087..8dd8dfef6d 100644
--- a/jarvis/ui/web/frontend/src/components/society/office/skyPad.ts
+++ b/jarvis/ui/web/frontend/src/components/society/office/skyPad.ts
@@ -21,17 +21,22 @@ export const SKY_PAD = {
railClearance: 0.65,
} as const;
-/** The courier's size on the pad (metres): its authored 30 m scaled to the Verse's people. */
+/** The courier's size on the pad (metres): its authored ship (a 30 m hull) scaled to the Verse's people. */
export const COURIER = {
scale: 0.6,
- /** Length and span (pods included) at that scale, and the clearance a walker keeps from it. */
- length: 19.4,
- span: 9.3,
+ /** Nose tip and pod-spike tips from the hull's middle, the length between them, the span over the pods' fins. */
+ nose: 15.6 * 0.6,
+ tail: 20.8 * 0.6,
+ length: 36.4 * 0.6,
+ span: 13.9 * 0.6,
clearance: 0.6,
- /** The hull's middle above the deck when it stands on its gear (authored 1.35 m belly + 2.3 m gear, scaled). */
- standHeight: (1.35 * 0.78 + 2.3) * 0.6,
+ /** The hull's middle above the deck when it stands on its gear (authored 0.63 m to the gear roots + 2.3 m gear). */
+ standHeight: (0.7 * 0.9 + 2.3) * 0.6,
} as const;
+/** How far the hull's middle stands from the pad's middle towards the tail, so the whole ship sits centred on the deck. */
+const SHIP_SHIFT = (COURIER.tail - COURIER.nose) / 2;
+
export interface SkyPad {
side: "east";
/** The walkable deck of the bridge (a walker's centre may stand anywhere in it). */
@@ -67,7 +72,8 @@ export function skyPadFor(bounds: Rect, floor: Rect, boulevardZ: number): SkyPad
minZ: boulevardZ - half + SKY_PAD.railClearance, maxZ: boulevardZ + half - SKY_PAD.railClearance,
},
pad: { x: padX, z: boulevardZ, r: SKY_PAD.radius },
- ship: { x: padX, z: boulevardZ, heading: 0 },
+ // Nose to the north (-z): the longer tail half reaches south, so the middle stands a little north of centre.
+ ship: { x: padX, z: boulevardZ - SHIP_SHIFT, heading: 0 },
shipRect,
// Beside the hatch on the courier's west flank, facing it: the first thing the bridge leads to.
board: { x: shipRect.minX - 0.9, z: boulevardZ + 1.2, facing: Math.PI / 2 },
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
index c2cac40169..7f4bf64718 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
@@ -1236,7 +1236,8 @@
"ctl_fly_camera": "Kamera wechseln",
"ctl_fly_land": "Auf dem Pad landen",
"ctl_fly_leave": "Aussteigen (gelandet)",
- "ctl_fly_settings": "Flugeinstellungen und Tasten"
+ "ctl_fly_settings": "Flugeinstellungen und Tasten",
+ "ctl_fly_mouse": "Mit der Maus steuern (ins Bild klicken)"
},
"coding_title": "Coding-Etage",
"coding_empty": "Kein Coding-Agent läuft. Starte einen in der IDE, dann bekommt er hier einen Schreibtisch.",
@@ -1625,7 +1626,9 @@
"flight_action_camera": "Kamera wechseln",
"flight_action_land": "Auf dem Pad landen",
"flight_action_exit": "Aussteigen (gelandet)",
- "flight_action_help": "Steuerung zeigen"
+ "flight_action_help": "Steuerung zeigen",
+ "flight_mouse_hint": "Ins Bild klicken, um mit der Maus zu steuern.",
+ "flight_mouse_on": "Maussteuerung an: bewegen zum Drehen und Nicken. Esc gibt sie frei."
},
"arcade": {
"play_prompt": "{0} spielen",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
index 81199c8fb2..c25e9a1ebd 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
@@ -1236,7 +1236,8 @@
"ctl_fly_camera": "Switch camera",
"ctl_fly_land": "Land on the pad",
"ctl_fly_leave": "Step out (landed)",
- "ctl_fly_settings": "Flight settings and keys"
+ "ctl_fly_settings": "Flight settings and keys",
+ "ctl_fly_mouse": "Steer with the mouse (click the view)"
},
"coding_title": "Coding floor",
"coding_empty": "No coding agent is running. Start one in the IDE and it takes a desk here.",
@@ -1625,7 +1626,9 @@
"flight_action_camera": "Switch camera",
"flight_action_land": "Land on the pad",
"flight_action_exit": "Step out (landed)",
- "flight_action_help": "Show the controls"
+ "flight_action_help": "Show the controls",
+ "flight_mouse_hint": "Click the view to steer with the mouse.",
+ "flight_mouse_on": "Mouse steering on: move to turn and pitch. Esc lets go."
},
"arcade": {
"play_prompt": "Play {0}",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
index d9ecfcb0fc..473cbc46ba 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
@@ -1236,7 +1236,8 @@
"ctl_fly_camera": "Cambiar cámara",
"ctl_fly_land": "Aterrizar en la plataforma",
"ctl_fly_leave": "Bajar (aterrizada)",
- "ctl_fly_settings": "Ajustes de vuelo y teclas"
+ "ctl_fly_settings": "Ajustes de vuelo y teclas",
+ "ctl_fly_mouse": "Pilotar con el ratón (clic en la vista)"
},
"coding_title": "Planta de código",
"coding_empty": "No hay ningún agente de código en marcha. Inicia uno en el IDE y ocupará un escritorio aquí.",
@@ -1625,7 +1626,9 @@
"flight_action_camera": "Cambiar cámara",
"flight_action_land": "Aterrizar en la plataforma",
"flight_action_exit": "Bajar (aterrizada)",
- "flight_action_help": "Mostrar controles"
+ "flight_action_help": "Mostrar controles",
+ "flight_mouse_hint": "Haz clic en la vista para pilotar con el ratón.",
+ "flight_mouse_on": "Ratón activo: muévelo para girar y cabecear. Esc lo suelta."
},
"arcade": {
"play_prompt": "Jugar a {0}",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/pt.json b/jarvis/ui/web/frontend/src/i18n/locales/society/pt.json
index afacc180e2..ba6de4cba5 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/pt.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/pt.json
@@ -1236,7 +1236,8 @@
"ctl_fly_camera": "Mudar câmara",
"ctl_fly_land": "Aterrar na plataforma",
"ctl_fly_leave": "Sair (aterrada)",
- "ctl_fly_settings": "Definições de voo e teclas"
+ "ctl_fly_settings": "Definições de voo e teclas",
+ "ctl_fly_mouse": "Pilotar com o rato (clique na vista)"
},
"coding_title": "Piso de programação",
"coding_empty": "Não há nenhum agente de programação a correr. Inicia um no IDE e ele ocupa aqui uma secretária.",
@@ -1625,7 +1626,9 @@
"flight_action_camera": "Mudar câmara",
"flight_action_land": "Aterrar na plataforma",
"flight_action_exit": "Sair (aterrada)",
- "flight_action_help": "Mostrar controlos"
+ "flight_action_help": "Mostrar controlos",
+ "flight_mouse_hint": "Clique na vista para pilotar com o rato.",
+ "flight_mouse_on": "Rato ativo: mova para virar e arfar. Esc liberta-o."
},
"arcade": {
"play_prompt": "Jogar {0}",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/zh.json b/jarvis/ui/web/frontend/src/i18n/locales/society/zh.json
index c4232a6544..0bc6c56c25 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/zh.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/zh.json
@@ -1236,7 +1236,8 @@
"ctl_fly_camera": "切换视角",
"ctl_fly_land": "降落到平台",
"ctl_fly_leave": "下船(已降落)",
- "ctl_fly_settings": "飞行设置和按键"
+ "ctl_fly_settings": "飞行设置和按键",
+ "ctl_fly_mouse": "用鼠标操控(点击画面)"
},
"coding_title": "编程楼层",
"coding_empty": "没有正在运行的编程智能体。在 IDE 中启动一个,它就会在这里占一个工位。",
@@ -1625,7 +1626,9 @@
"flight_action_camera": "切换视角",
"flight_action_land": "降落到平台",
"flight_action_exit": "下船(已降落)",
- "flight_action_help": "显示操作"
+ "flight_action_help": "显示操作",
+ "flight_mouse_hint": "点击画面即可用鼠标操控。",
+ "flight_mouse_on": "鼠标操控已开启:移动鼠标转向和俯仰,按 Esc 释放。"
},
"arcade": {
"play_prompt": "玩 {0}",