Browser Game Foundations
Purpose
Help agents lock the non-negotiable foundation for a browser game before implementation starts: fantasy, core loop, engine, simulation/render boundaries, input, assets, save/debug/perf, and playtest handoff. This is a guardrail, not a browser-game course.
Use When
- the user has not yet chosen Phaser, Three.js, React Three Fiber, or raw WebGL
- the request spans gameplay, UI, assets, and QA boundaries
- the architecture needs a first pass before code exists
Do Not Use When
- the runtime track is already locked to one specialist engine and only implementation details remain
- the task is only asset production, UI polish, or QA
- the game architecture is already fixed and only a code change is needed
Quick Start
- Name the player fantasy and the core loop in one sentence each.
- Choose the stack from the game shape: Phaser for 2D sprite or tile games, Three.js for plain TypeScript 3D, React Three Fiber for React-hosted 3D, raw WebGL only for shader-first projects.
- Draw the seam: simulation owns game truth; rendering only presents it.
- Keep HUD and menus in DOM overlays by default unless there is a clear reason not to.
- Define the input action map once, then map physical controls to actions in one place.
- Group assets by stable manifest keys, not ad hoc filenames.
- Set save, debug, and performance boundaries before implementation.
- End with a playtest handoff that says what the next specialist must verify.
Operating Constraints
- Do not mix gameplay rules directly into scene callbacks or component render code.
- Do not treat the renderer as the source of truth for game state.
- Do not force HUD and menus into the canvas when DOM overlays will do.
- Do not let filenames become the public asset API.
- Do not hide debug toggles, perf probes, or save boundaries behind implementation noise.
- Do not write a generic engine comparison essay when one decisive stack choice is enough.
- When 3D is chosen, lock units, origins, and collision conventions early enough that the specialist implementation can stay consistent.
Inputs This Skill Expects
- The player's fantasy, genre, and session shape.
- Whether the game is 2D or 3D, and whether an app already lives in React.
- The intended input devices and the actions the player must perform.
- The asset domains that need stable grouping: characters, environment, UI, audio, FX, or equivalent.
- Save, debug, and performance expectations that matter before code exists.
Output Contract
- State the stack choice first and keep it explicit.
- State the core loop next, then the simulation/render boundary.
- Include an input action map, an asset grouping plan, and save/debug/perf boundaries.
- Prefer DOM overlays for text-heavy HUD and menu surfaces.
- Name one playtest hook or verification step that the next specialist should run.
- Keep the answer short enough that implementation can begin without renegotiating the architecture.
Procedure
- Lock fantasy and the core loop.
- Choose the engine only after the game shape is clear.
- Separate simulation from rendering and name the boundary in plain language.
- Define the input action map in one place.
- Group assets with stable manifest keys and clear domains.
- Set save/debug/perf boundaries early.
- Close with a playtest handoff that names the next proof step.
Pitfalls And Gotchas
- Rejected trope: a long engine or framework comparison that postpones the real decision.
- Better alternative: one decisive stack choice plus a boundary contract that another specialist can implement directly.
- Mixing state ownership between game logic and render state.
- Treating renderer objects as save data.
- Leaving HUD, menu, and accessibility surfaces trapped inside the playfield by default.
- Letting debug hooks or perf probes appear only after implementation has already drifted.
- Expanding into a browser-game textbook instead of a planning guardrail.
Progressive Disclosure
Start with the smallest useful answer: fantasy, loop, stack, boundary, inputs, assets, save/debug/perf, handoff. If the request needs deeper engine detail, route that detail to the specialist implementation skill instead of padding this one.
Verification Pattern
- Confirm the answer names a stack and does not waffle.
- Confirm simulation owns game truth and rendering only presents it.
- Confirm the input map is explicit and the asset grouping uses stable keys.
- Confirm save/debug/perf boundaries are stated, not implied.
- Confirm one playtest hook is named.
- Confirm the response avoided turning into an engine manual or generic game-dev overview.
1---2name: browser-game-foundations3description: Guardrail for choosing the browser-game fantasy, stack, boundaries, inputs, assets, and handoff before implementation.4---56# Browser Game Foundations78## Purpose9Help agents lock the non-negotiable foundation for a browser game before implementation starts: fantasy, core loop, engine, simulation/render boundaries, input, assets, save/debug/perf, and playtest handoff. This is a guardrail, not a browser-game course.1011### Use When12- the user has not yet chosen Phaser, Three.js, React Three Fiber, or raw WebGL13- the request spans gameplay, UI, assets, and QA boundaries14- the architecture needs a first pass before code exists1516### Do Not Use When17- the runtime track is already locked to one specialist engine and only implementation details remain18- the task is only asset production, UI polish, or QA19- the game architecture is already fixed and only a code change is needed2021## Quick Start221. Name the player fantasy and the core loop in one sentence each.232. Choose the stack from the game shape: Phaser for 2D sprite or tile games, Three.js for plain TypeScript 3D, React Three Fiber for React-hosted 3D, raw WebGL only for shader-first projects.243. Draw the seam: simulation owns game truth; rendering only presents it.254. Keep HUD and menus in DOM overlays by default unless there is a clear reason not to.265. Define the input action map once, then map physical controls to actions in one place.276. Group assets by stable manifest keys, not ad hoc filenames.287. Set save, debug, and performance boundaries before implementation.298. End with a playtest handoff that says what the next specialist must verify.3031## Operating Constraints32- Do not mix gameplay rules directly into scene callbacks or component render code.33- Do not treat the renderer as the source of truth for game state.34- Do not force HUD and menus into the canvas when DOM overlays will do.35- Do not let filenames become the public asset API.36- Do not hide debug toggles, perf probes, or save boundaries behind implementation noise.37- Do not write a generic engine comparison essay when one decisive stack choice is enough.38- When 3D is chosen, lock units, origins, and collision conventions early enough that the specialist implementation can stay consistent.3940## Inputs This Skill Expects41- The player's fantasy, genre, and session shape.42- Whether the game is 2D or 3D, and whether an app already lives in React.43- The intended input devices and the actions the player must perform.44- The asset domains that need stable grouping: characters, environment, UI, audio, FX, or equivalent.45- Save, debug, and performance expectations that matter before code exists.4647## Output Contract48- State the stack choice first and keep it explicit.49- State the core loop next, then the simulation/render boundary.50- Include an input action map, an asset grouping plan, and save/debug/perf boundaries.51- Prefer DOM overlays for text-heavy HUD and menu surfaces.52- Name one playtest hook or verification step that the next specialist should run.53- Keep the answer short enough that implementation can begin without renegotiating the architecture.5455## Procedure561. Lock fantasy and the core loop.572. Choose the engine only after the game shape is clear.583. Separate simulation from rendering and name the boundary in plain language.594. Define the input action map in one place.605. Group assets with stable manifest keys and clear domains.616. Set save/debug/perf boundaries early.627. Close with a playtest handoff that names the next proof step.6364## Pitfalls And Gotchas65- Rejected trope: a long engine or framework comparison that postpones the real decision.66- Better alternative: one decisive stack choice plus a boundary contract that another specialist can implement directly.67- Mixing state ownership between game logic and render state.68- Treating renderer objects as save data.69- Leaving HUD, menu, and accessibility surfaces trapped inside the playfield by default.70- Letting debug hooks or perf probes appear only after implementation has already drifted.71- Expanding into a browser-game textbook instead of a planning guardrail.7273## Progressive Disclosure74Start with the smallest useful answer: fantasy, loop, stack, boundary, inputs, assets, save/debug/perf, handoff. If the request needs deeper engine detail, route that detail to the specialist implementation skill instead of padding this one.7576## Verification Pattern77- Confirm the answer names a stack and does not waffle.78- Confirm simulation owns game truth and rendering only presents it.79- Confirm the input map is explicit and the asset grouping uses stable keys.80- Confirm save/debug/perf boundaries are stated, not implied.81- Confirm one playtest hook is named.82- Confirm the response avoided turning into an engine manual or generic game-dev overview.