Skip to content

chore(playground): add browser-only IDE for writing and exporting a Forge game - #579

Open
stormmuller wants to merge 1 commit into
devfrom
claude/browser-game-ide-vite-pohhum
Open

chore(playground): add browser-only IDE for writing and exporting a Forge game#579
stormmuller wants to merge 1 commit into
devfrom
claude/browser-game-ide-vite-pohhum

Conversation

@stormmuller

Copy link
Copy Markdown
Member

Summary

Adds /playground, a bare-bones, browser-only IDE for writing a small Forge game and downloading it as a self-contained index.html + game.js zip - no backend involved, matching the requested stack (Vite + Monaco + @typescript/vfs + esbuild-wasm, no React).

  • Monaco is configured with Forge's real type declarations registered as extra libs (src/editor/forge-types.ts), so autocomplete, hover, and inline diagnostics work against Forge's actual public API (@forge-game-engine/forge/<subpath> imports).
  • @typescript/vfs powers an independent, in-browser TypeScript language service (src/editor/type-check.ts) that type-checks the game source before every build - esbuild only strips types, it never checks them.
  • esbuild-wasm bundles the game through a custom resolver plugin (src/build/forge-esbuild-plugin.ts) that resolves @forge-game-engine/forge/<subpath> imports - plus Forge's own internal relative imports and its one runtime dependency (seedrandom) - against Forge's compiled dist output, embedded into the app bundle at build time via import.meta.glob. Forge is inlined into the downloaded game rather than referenced externally.
  • fflate zips the generated index.html and bundled game.js and triggers a browser download.

/playground is a separate npm project (its own package.json/node_modules), the same pattern as /documentation-site, depending on @forge-game-engine/forge via a file:.. link resolved through dist. See playground/README.md and the new "Browser Playground" section in AGENTS.md for the full architecture and gotchas.

Titled chore (excluded from the changelog requirement) since this adds a repo-internal dev tool with no effect on the published @forge-game-engine/forge package's API or behavior.

Related issue(s)

N/A

Verification checklist

  • npm run check-types passes with 0 errors
  • npm test passes
  • npm run lint passes with 0 errors
  • npm run cspell passes with 0 errors
  • npm run check-exports passes
  • No public API added/changed under /src; not applicable
  • No documented engine behavior changed; not applicable
  • Not applicable - no /src module with an existing demo was touched
  • playground/ verified independently: npm run typecheck (from playground/) passes with 0 errors, and the full flow (type-check → bundle → zip → download) was exercised end-to-end via Playwright - typed the default game in the editor, clicked Build, extracted the downloaded zip, and confirmed it renders and animates correctly in a real browser.

Changelog

  • Not applicable - PR titled with an excluded type (chore) since this change has no effect on the published package.

Generated by Claude Code

…rge game

Adds /playground, a standalone Vite + Monaco + @typescript/vfs + esbuild-wasm
app for writing a small single-file Forge game in the browser and downloading
it as a self-contained index.html + game.js zip, entirely client-side.

- Monaco is configured with Forge's real type declarations as extra libs, so
  autocomplete/hover/inline diagnostics work against Forge's actual API.
- @typescript/vfs powers an independent, in-browser TypeScript language
  service used to type-check the game source before every build.
- esbuild-wasm bundles the game through a custom resolver plugin that
  resolves @forge-game-engine/forge/<subpath> imports (and Forge's internal
  imports/seedrandom dependency) against Forge's own compiled dist output,
  embedded into the app bundle via import.meta.glob, so Forge is inlined
  into the downloaded game rather than referenced externally.
- fflate zips the generated index.html and bundled game.js for download.

Verified end-to-end via Playwright: typed a game in the editor, clicked
Build, and confirmed the downloaded zip's index.html renders and animates
correctly in a real browser.
@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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