From f062b417a9572f26e53cd6f81ab414c234cdbe61 Mon Sep 17 00:00:00 2001 From: MelekTaus Date: Fri, 18 Sep 2026 16:56:48 +0200 Subject: [PATCH] Architecture: Rapier 2D in the stack and src/runtime/physics (#145); Development: check total 1045 --- Architecture.md | 6 ++++++ Development.md | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Architecture.md b/Architecture.md index eb06d9a..ec3d70d 100644 --- a/Architecture.md +++ b/Architecture.md @@ -5,6 +5,11 @@ frames skip the compositor queue, so the UI keeps up with the pointer (click to picture measured 72-77 ms before, 16-18 ms after). The price is possible tearing while things move fast; `?vsync` falls back to Pixi's own context. A browser without the mode simply ignores it. +- **Rapier 2D** (`@dimforge/rapier2d-compat`, WebAssembly) — the physics engine. Pixi draws only, so + bodies, forces and contacts come from here (#144). It is a chunk of its own (about 790 KB gzip) that + `runtime/physics/engine.ts` loads once in the background after the editor has opened its project, + so the first picture never waits for it; a failed load is reported in the console and not retried. + Outside the engine everything stays in pixels, inside 100 px are one metre (`toMetres`/`toPixels`). - **Own canvas widget toolkit** (`src/ui/`) — panels, buttons, lists, text/number/color fields, popups. The only lasting DOM element is a hidden `` used as a keyboard bridge (IME, mobile keyboard, clipboard) while a canvas text field is focused; *Upload…* adds a short-lived @@ -77,6 +82,7 @@ src/core/store/ serialize (untrusted JSON → Project), tilemapCells (the src/core/time.ts the global clock: one scaled step a frame, shared by the world, the particles, the shaders and the animation preview src/runtime/ World, Entity, System interface, Input tracker, CollisionSystem, AnimationSystem, BehaviorSystem, Audio (the AudioSink a run plays into — the counterpart of Input on the way out) +src/runtime/physics/ engine (loads Rapier once, reports its state, converts between pixels and metres) src/ui/ widget toolkit (generic, knows nothing about assets) src/viewport/ view (transforms), items (what to draw), symbols (how to draw it), FileLibrary (load once, never retry a failure, tell the listeners) ← TextureLibrary, FontLibrary; diff --git a/Development.md b/Development.md index 59bda33..da10eee 100644 --- a/Development.md +++ b/Development.md @@ -12,7 +12,7 @@ npm run check # typecheck + lint + format:check + tests, the gate CI runs # code is lost (tail's is reported), so a red run reads as green npm run build # writes dist/ and regenerates index.html ./build.sh # the same under `set -o pipefail`, for callers that pipe the output -node tools/seed-e2e.mjs && node tools/e2e.mjs # 1042 editor checks, screenshots in /tmp/gm-e2e-*.png +node tools/seed-e2e.mjs && node tools/e2e.mjs # 1045 editor checks, screenshots in /tmp/gm-e2e-*.png GM_STEPS=20 node tools/e2e.mjs # or 1-12, or 6,20 — a subset while working on one step ./e2e.sh start [GM_STEPS] # the same run detached, see below ./e2e.sh status # live progress, or the last run's result