refactor: move world concepts into engine

This commit is contained in:
Toad 2026-08-24 15:17:53 +02:00
parent eeedcb8e48
commit 2d15c7ab8d
52 changed files with 3298 additions and 1558 deletions

View file

@ -1,9 +1,18 @@
# Levels & the in-game editor — direction note
Status: **direction agreed, not yet built.** Captures a brainstorm so the next
Status: **historical proposal, partially superseded.** Captures a brainstorm so the next
session starts from the conclusion, not a cold read. Nothing here is committed
code; it's the shape we want and *why*.
> **Architecture note (2026-08-20):** Naming and ownership sections below are
> superseded by `docs/adr/0001-engine-owns-world-concepts.md` and `CONTEXT.md`.
> Canonical terms are now engine `LevelDefinition` (live-level creation input),
> engine `Level` (live runtime), and clone-safe engine `RenderScene`; game owns
> concrete definitions and values. A future serializable editor document needs its
> own name rather than overloading these runtime terms. References below to game-owned world contracts, content
> `kind` fields/registries, `game/Terrain.ts`, or `game/renderScene.ts` describe the
> old code only. Editor goals remain valid but must use the canonical boundary.
## The pivot
The game is heading toward a **multiplayer twitch shooter**. Each match loads a
@ -20,7 +29,7 @@ The game is heading toward a **multiplayer twitch shooter**. Each match loads a
- **Persistence and player carry-over are YAGNI** for now — but must not be walled
off (see hedges).
## Naming: `Level` (data) vs `Scene` (runtime)
## Historical naming proposal: `Level` (data) vs `Scene` (runtime)
Agreed vocabulary — reads as **"bake a `Level` into a `Scene`."** Fits the
type + namespace convention.
@ -210,7 +219,7 @@ field = mutate the document + re-bake.
- **No hardcoded buffer sizes** tied to today's world — mob/framebuffer sizing already
re-runs on `setup`; keep it so odd-shaped match maps just work.
## Current-state facts the next session will need
## Historical current-state facts (before 2026-08-20)
- `buildLevel(textures): Level` (`game/level.ts:175`) is the single entry, called once
in `app/main.ts`. Today's `Level` (`game/level.ts:69-81`) is a **bake result**