Skip to content

feat: centralize the example games in basics, demos and games for engine 3 - #18

Merged
Exeloo merged 58 commits into
mainfrom
feat/centralize-games
Nov 13, 2026
Merged

Exeloo merged 58 commits into
mainfrom
feat/centralize-games

Conversation

@Exeloo

@Exeloo Exeloo commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

What does this PR do?

No linked issue: the restructure was asked for directly (centralize every example game here).

Turns the repository into the home of every NanoForge example game, all remade for engine 3.0.0 and natively supported by the editor.

  • basics/ (one engine feature each): input-keyboard, input-mouse, input-gamepad, sprite-2d, sound, music, scenes, network (client + server + shared lib), graphics-3d (was the engine's example/cube-3d).
  • demos/ (the pong family): pong, pong-network (was the engine's example/pong-network), pong-3d (was the engine's example/pong-3d; peer to peer, same server code).
  • games/: breakout (was the editor's examples/breakout), flappy-bird, tic-tac-toe, raid-survival (remade from the old root folders, which are removed).
  • Every example is laid out like nf new output: one component, system or scene per file with the editor's TSDoc tags (@component/@system/@scene, @side), app.use(new EditorLibrary()), engine packages ^3.0.0, CLI/config ^3.0.1, TypeScript 6.
  • shared/: code several examples need, kept byte-identical in each of them (temporary, to be replaced by components-systems packages). scripts/check.ts (pnpm check, pnpm fix) enforces identical copies, one item per file and unique shared paths; scripts/check.test.ts is its self-test.
  • docs/shared-components.md: every shared file, who uses it and the library package that should replace it; library candidates; what is kept apart on purpose and why; gaps found in the library and the engine.
  • CI (.github/workflows/tests.yml): root lint + self-test, then per example a frozen install, tsc per app and nf build.

How do you test this PR?

pnpm install && pnpm lint && pnpm test      # prettier, shared copies, one item per file; check self-test
cd <example> && pnpm install && pnpm dev    # or pnpm editor to open it in the editor

Run on HEAD:

  • pnpm lint → "16 examples checked."; pnpm test → pass 5, fail 0.
  • All 16 examples: pnpm install --frozen-lockfile, tsc --noEmit per app, pnpm build ("Build succeeded"), and the editor's ECS + scene analyzers (no problems, no code-only entity, every component and system modelled).
  • Played in Chrome before the last fix round: pong, breakout, pong-network (two tabs), pong-3d host, flappy-bird, tic-tac-toe; raid-survival headless. The basics, the pong-3d joiner tab, and every game after the last fixes (ball recovery, shared scene-var text and 3D set) were not played.
  • raid-survival server: a handler check (fake registry and network) failed 5 cases before the security fixes and passes all 11 after.

Merge danger

Two-way door: example content only, no published package, no package depends on this repository. Merge it before NanoForge-dev/Engine feat/examples-games and NanoForge-dev/Editor feat/examples-games: their docs and copy scripts point at basics/, demos/ and games/. The cloud-iac games-builder testing job still points at the old root pong-network/.

Follow-up issues

Quality gate

Check Result Notes
Docs Updated README, CONTRIBUTING, docs/shared-components.md, example READMEs
Correctness Pass 2 rounds: near-duplicates unified (scene-var text, 3D drawables, raid Velocity2D/DrawOrder2D), ball speed cap and lost-ball recovery, check.ts fixes; Minor: tunnelling only limited
Performance Findings 2 Important in raid-survival's server, inherited from the original game, left as follow-ups (above)
Accessibility N/A (no UI change outside game canvases)
Security Pass 1 round: one lobby seat per connection, normalized aim direction, own-key message dispatch
Style Pass 1 round: system TSDoc tags, import order, arrow functions, duplicate imports; lint: pass

Scenes (sky, ready, play, game over), components and systems instead of the game-state singleton, closures and the custom render loop. Shared arcade code (just-pressed, sound effects, draw order) goes to shared/arcade.
Match and end popup scenes, scene vars for the game state, mouse input through the input library and the shared 2d drawables instead of konva nodes added from component constructors.
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