Skip to content

refactor(engine): input as data + live-shadow walk events#209

Merged
JumpLink merged 1 commit into
mainfrom
refactor/input-source-component
Jun 12, 2026
Merged

refactor(engine): input as data + live-shadow walk events#209
JumpLink merged 1 commit into
mainfrom
refactor/input-source-component

Conversation

@JumpLink

Copy link
Copy Markdown
Contributor

The ECS review of the runtime chain (player → trigger → teleport) found the chain largely clean — event-driven decoupling, per-tick state on the session singleton, stateless reactive systems — with two real violations, both fixed here:

  1. Transport-ready rule 3 (InputSourceComponent from day one): PlayerSystem.handleInput read the keyboard directly. Now the new InputSystem is the single device-facing system — it polls the local keyboard each tick and publishes a pure-data intent vector (InputSourceComponentmoveX/moveY normalised, actionHeld) on the session singleton; PlayerSystem consumes the component and never sees a device. Remote peers / replays / AI drivers can drive the player by writing the same component — split-screen and network multiplayer stay a plug-in, not a refactor. Registered before PlayerSystem so the intent is same-frame. Outside runtime mode the intent resets to neutral (mode exit stops the player).
  2. WalkOnTileSystem raced live edits: it resolved tile properties from mapData.layers[].sprites — the snapshot that only updates on the persistence fold — while collision reads the live tilemap shadow. A tile painted mid-play didn't change walk events until a save. It now resolves through the shadow (findTileMapForLayer + getSpritesAt), falling back to mapData for layers without a live tilemap (headless contexts).

Specs (both registered in test.mts; engine suite 717 → 761 assertions, green on gjs + node): InputSystem keyboard→component contract incl. runtime gating, diagonal normalisation and neutral-reset; WalkOnTileSystem live-shadow-wins-over-stale-mapData, mid-play edit visibility, empty-tile default.

Docs in the same commit: collaboration-and-multiplayer.md § 5 now records the shipped v1 (singleton intent vector) and keeps the per-player source-descriptor design as the split-screen phase; the stale TODO entry ("nothing emits player-tile-changed today" — false since movement landed) is rewritten to the actually-remaining work.

@JumpLink JumpLink merged commit 9612b6c into main Jun 12, 2026
1 check passed
@JumpLink JumpLink deleted the refactor/input-source-component branch June 12, 2026 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant