Skip to content

Zero-dependency game engine scaffolding (loop, scenes, input) - #2

Draft
whadar wants to merge 1 commit into
masterfrom
claude/high-fidelity-games-5k-loc-9dwqu5
Draft

whadar wants to merge 1 commit into
masterfrom
claude/high-fidelity-games-5k-loc-9dwqu5

Conversation

@whadar

@whadar whadar commented Aug 23, 2026

Copy link
Copy Markdown
Owner

Groundwork for a self-contained games collection under public/games/. Two plain scripts, no build step, no runtime dependencies — they work served statically by the existing Express public/ middleware or opened directly from disk.

What's here

  • public/games/engine/core.js (211 LOC) — math/easing helpers, seeded RNG, localStorage-backed settings shared across games, DPR-aware letterboxed canvas scaling, a fixed-step (1/120s) simulation loop with a spiral-of-death guard, and a scene stack with transparent overlay scenes for pause/dialog screens.
  • public/games/engine/input.js (180 LOC) — named-action bindings layered over keyboard, pointer, gamepad and on-screen touch controls (virtual stick + buttons), so gameplay code never touches raw key codes.

Status

Draft, and deliberately parked. This is the hand-rolled branch of an open architecture decision: build the games on this base, or on an external stack (Pixi/three + Rapier + Howler) that would replace most of this engine layer with imports.

The trade-off in short: the hand-rolled path costs ~1000 LOC of engine before any gameplay and caps out at stylized 2D, but ships ~60KB with zero deps and no build. The library path frees the whole budget for gameplay and raises the fidelity ceiling (3D, skeletal animation, real physics), at the cost of ~1–2MB of runtime and a build step this repo does not currently have.

Nothing downstream depends on these files yet, so they are safe to drop wholesale if the decision goes the other way.


Generated by Claude Code

Groundwork for a self-contained games collection under public/games/:

- engine/core.js: math/easing helpers, seeded RNG, localStorage-backed
  shared settings, DPR-aware letterboxed canvas, fixed-step (1/120s)
  simulation loop with spiral-of-death guard, and a scene stack that
  supports transparent overlay scenes for pause/dialogs.
- engine/input.js: named-action bindings over keyboard, pointer, gamepad
  and on-screen touch controls (virtual stick + buttons), so gameplay
  code never touches raw key codes.

No build step and no runtime dependencies; both files are plain scripts
that work when served statically or opened directly.

Parked here pending an architecture decision on whether the games are
built on this hand-rolled base or on an external stack (Pixi/three +
Rapier + Howler), which would replace most of the engine layer.

Co-Authored-By: Claude <noreply@anthropic.com>
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.

2 participants