mcpField
W
web-games

web-games

github.com/ranbot-aiDevelopment897 installsUpdated today
Repository

About web-games

Web Browser Game Development is a skill for developers building HTML5, WebGL, or WebGPU games. It helps choose browser frameworks and runtimes, and covers performance, asset loading, audio, PWA setup, and hybrid DOM-and-canvas designs.

Key features

  1. 01Compare browser game frameworks
  2. 02Choose WebGPU or WebGL with fallback guidance
  3. 03Apply browser performance and loading practices
  4. 04Plan game asset formats and loading stages
  5. 05Handle browser audio and PWA requirements
  6. 06Design hybrid DOM and canvas game shells

Use cases

  1. 01Choose a framework for a 2D or 3D browser game
  2. 02Plan rendering for GPU-heavy projects
  3. 03Optimize assets and loading for constrained connections
  4. 04Embed and tear down a canvas game within an HTML interface

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/ranbot-ai/awesome-skills --skill web-games

After installing, type/web-gamesin Claude Code to confirm it loaded.

Details

From the project README

Web Browser Game Development

Framework selection and browser-specific principles. For stack choice details see game-development/engine-selection.


1. Framework Selection

Decision Tree
What type of game?
│
├── 2D Game
│   ├── Full game engine features? → Phaser 4
│   ├── Fast prototype / jam?      → Kaplay
│   ├── Raw rendering power?       → PixiJS 8
│   └── Tiny / no dependency?      → Raw Canvas / WebGL
│
├── 3D Game
│   ├── Full engine (physics, XR)? → Babylon.js
│   └── Rendering focused?         → Three.js
│
├── Hybrid (DOM UI + canvas moments)
│   └── Custom shell + guest viewport
│       (Canvas/Kaplay/Phaser/Pixi inside a region/modal)
│
└── Narrative-first
    └── Ink (inkjs) or Twine export + DOM host
Comparison
FrameworkTypeBest For
Raw Canvas / WebGL2D / low-levelSmall scope, full control
Kaplay2D toolkitRapid prototypes
Phaser 42D engineFull game features
PixiJS 82D rendererRendering, custom systems
Three.js3D rendererVisualizations, lightweight 3D
Babylon.js3D engineFull engine, XR
Hybrid shell + guest

Use when chrome is HTML (menus, inventories, text, dashboards) but bursts of play need a canvas:

  1. Mount guest in a container; pass context in.
  2. Run a local game loop in the guest.
  3. Return results (score, pass/fail); destroy guest (RAF, listeners, GL context as needed).

Do not let the guest own global app routing unless the product is a full-screen game.


2. WebGPU Adoption

Browser Support (2025)
BrowserSupport
Chrome✅ Since v113
Edge✅ Since v113
Firefox✅ Since v131
Safari✅ Since 18.0
Total~73% global
Decision
  • New GPU-heavy projects: Use WebGPU with WebGL fallback
  • Broad legacy / simple 2D: Start with WebGL or Canvas 2D
  • Feature detection: Check navigator.gpu

3. Performance Principles

Browser Constraints
ConstraintStrategy
No local file accessAsset bundling, CDN
Tab throttlingPause when hidden (visibilitychange)
Mobile data limitsCompress assets
Audio autoplayRequire user interaction
Optimization Priority
  1. Asset compression - KTX2, Draco, WebP
  2. Lazy loading - Load on demand
  3. Object pooling - Avoid GC
  4. Draw call batching - Reduce state changes
  5. Web Workers - Offload heavy computation

4. Asset Strategy

TypeFormat
TexturesKTX2 + Basis Universal (or WebP/PNG for simple 2D)
AudioWebM/Opus (fallback: MP3)
3D ModelsglTF + Draco/Meshopt
PhaseLoad
StartupCore assets, <2MB
GameplayStream on demand
BackgroundPrefetch next level

5. PWA for Games

Benefits: offline play, install, fullscreen, optional push. Requirements: service worker, web app manifest, HTTPS.


6. Audio Handling

  • Create/resume AudioContext on first click/tap
  • Prefer Web Audio API; pool sources; preload common SFX
  • Compress with WebM/Opus when possible

7. Anti-Patterns

❌ Don't✅ Do
Load all assets upfrontProgressive loading
Ignore tab visibilityPause when hidden
Block on audio loadLazy load audio
Skip compressionCompress everything
Assume fast connectionHandle slow networks
Leave canvas engines running off-screenTear down guests

Remember: Browser is the most accessible platform. Respect its constraints.

When to Use

Use when building HTML5/WebGL/WebGPU games, choosing a browser runtime, or wiring hybrid DOM+canvas guests.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

Comments

Markdown supported