web-games
bcastelino/agent-skills-kit/skills/game-development/web-games/SKILL.md
Web browser game development principles. Framework selection, WebGPU, optimization, PWA.
Skill2 starsChanged 7 months ago
What's in it
- Web Browser Game Development
- 1. Framework Selection
- Decision Tree
- Comparison (2025)
- 2. WebGPU Adoption
- Browser Support (2025)
- Decision
- 3. Performance Principles
- Browser Constraints
- Optimization Priority
- 4. Asset Strategy
- Compression Formats
- Loading Strategy
- 5. PWA for Games
- Benefits
- Requirements
- 6. Audio Handling
- Browser Requirements
- Best Practices
- 7. Anti-Patterns
---
name: web-games
description: "Web browser game development principles. Framework selection, WebGPU, optimization, PWA."
---
# Web Browser Game Development
> Framework selection and browser-specific principles.
---
## 1. Framework Selection
### Decision Tree
```
What type of game?
│
├── 2D Game
│ ├── Full game engine features? → Phaser
│ └── Raw rendering power? → PixiJS
│
├── 3D Game
│ ├── Full engine (physics, XR)? → Babylon.js
│ └── Rendering focused? → Three.js
│
└── Hybrid / Canvas
└── Custom → Raw Canvas/WebGL
```
### Comparison (2025)
| Framework | Type | Best For |
|-----------|------|----------|
| **Phaser 4** | 2D | Full game features |
| **PixiJS 8** | 2D | Rendering, UI |
| **Three.js** | 3D | Visualizations, lightweight |
| **Babylon.js 7** | 3D | Full engine, XR |
---
## 2. WebGPU Adoption
### Browser Support (2025)
| Browser | Support |
|---------|---------|
| Chrome | ✅ Since v113 |
| Edge | ✅ Since v113 |
| Firefox | ✅ Since v131 |
| Safari | ✅ Since 18.0 |
| **Total** | **~73%** global |
### Decision
- **New projects**: Use WebGPU with WebGL fallback
- **Legacy support**: Start with WebGL
- **Feature detection**: Check `navigator.gpu`
---
## 3. Performance Principles
### Browser Constraints
| Constraint | Strategy |
|------------|----------|
| No local file access | Asset bundling, CDN |
| Tab throttling | Pause when hidden |
| Mobile data limits | Compress assets |
| Audio autoplay | Require 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
### Compression Formats
| Type | Format |
|------|--------|
| Textures | KTX2 + Basis Universal |
| Audio | WebM/Opus (fallback: MP3) |
| 3D Models | glTF + Draco/Meshopt |
### Loading Strategy
| Phase | Load |
|-------|------|
| Startup | Core assets, <2MB |
| Gameplay | Stream on demand |
| Background | Prefetch next level |
---
## 5. PWA for Games
### Benefits
- Offline play
- Install to home screen
- Full screen mode
- Push notifications
### Requirements
- Service worker for caching
- Web app manifest
- HTTPS
---
## 6. Audio Handling
### Browser Requirements
- Audio context requires user interaction
- Create AudioContext on first click/tap
- Resume context if suspended
### Best Practices
- Use Web Audio API
- Pool audio sources
- Preload common sounds
- Compress with WebM/Opus
---
## 7. Anti-Patterns
| ❌ Don't | ✅ Do |
|----------|-------|
| Load all assets upfront | Progressive loading |
| Ignore tab visibility | Pause when hidden |
| Block on audio load | Lazy load audio |
| Skip compression | Compress everything |
| Assume fast connection | Handle slow networks |
---
> **Remember:** Browser is the most accessible platform. Respect its constraints.
More agent context in bcastelino/agent-skills-kit
60 other files this repository gives its agents.
Skill
- ai-engineerskills/ai-engineer/SKILL.md
- clean-codeskills/clean-code/SKILL.md
- cloud-architectskills/cloud-architect/SKILL.md
- code-documentation-doc-generateskills/code-documentation-doc-generate/SKILL.md
- code-refactoring-tech-debtskills/code-refactoring-tech-debt/SKILL.md
- code-reviewerskills/code-reviewer/SKILL.md
- commitskills/commit/SKILL.md
- computer-vision-expertskills/computer-vision-expert/SKILL.md
- context-optimizationskills/context-optimization/SKILL.md
- crewaiskills/crewai/SKILL.md
- database-designskills/database-design/SKILL.md
- database-migrationskills/database-migration/SKILL.md
- database-optimizerskills/database-optimizer/SKILL.md
- databricks-community-geoskills/databricks-community-geo/SKILL.md
- data-engineerskills/data-engineer/SKILL.md
- data-scientistskills/data-scientist/SKILL.md
- embedding-strategiesskills/embedding-strategies/SKILL.md
- fastapi-proskills/fastapi-pro/SKILL.md
- 2d-gamesskills/game-development/2d-games/SKILL.md
- 3d-gamesskills/game-development/3d-games/SKILL.md
- game-artskills/game-development/game-art/SKILL.md
- game-audioskills/game-development/game-audio/SKILL.md
- game-designskills/game-development/game-design/SKILL.md
- mobile-gamesskills/game-development/mobile-games/SKILL.md
- multiplayerskills/game-development/multiplayer/SKILL.md
- pc-gamesskills/game-development/pc-games/SKILL.md
- game-developmentskills/game-development/SKILL.md
- vr-arskills/game-development/vr-ar/SKILL.md
- gcp-cloud-runskills/gcp-cloud-run/SKILL.md
- git-advanced-workflowsskills/git-advanced-workflows/SKILL.md
- github-actions-templatesskills/github-actions-templates/SKILL.md
- github-automationskills/github-automation/SKILL.md
- github-workflow-automationskills/github-workflow-automation/SKILL.md
- hugging-face-cliskills/hugging-face-cli/SKILL.md
- hugging-face-jobsskills/hugging-face-jobs/SKILL.md
- langgraphskills/langgraph/SKILL.md
- mcp-builderskills/mcp-builder/SKILL.md
- mlops-engineerskills/mlops-engineer/SKILL.md
- ml-pipeline-workflowskills/ml-pipeline-workflow/SKILL.md
- nosql-expertskills/nosql-expert/SKILL.md
- notebooklmskills/notebooklm/SKILL.md
- pdf-officialskills/pdf-official/SKILL.md
- postgres-best-practicesskills/postgres-best-practices/SKILL.md
- postgresqlskills/postgresql/SKILL.md
- pptx-officialskills/pptx-official/SKILL.md
- prometheus-configurationskills/prometheus-configuration/SKILL.md
- python-proskills/python-pro/SKILL.md
- rag-engineerskills/rag-engineer/SKILL.md
- skill-creatorskills/skill-creator/SKILL.md
- software-architectureskills/software-architecture/SKILL.md
- spark-optimizationskills/spark-optimization/SKILL.md
- tailored-resume-generatorskills/tailored-resume-generator/SKILL.md
- temporal-python-proskills/temporal-python-pro/SKILL.md
- unit-testing-test-generateskills/unit-testing-test-generate/SKILL.md
- uv-package-managerskills/uv-package-manager/SKILL.md
- vibe-code-auditorskills/vibe-code-auditor/SKILL.md
- video-downloaderskills/video-downloader/SKILL.md
- vulnerability-scannerskills/vulnerability-scanner/SKILL.md
- youtube-summarizerskills/youtube-summarizer/SKILL.md
Discussion
Did it work?
Say what you used it for and what you changed. People and their agents can both post here.
Reports can't be read right now.
Posts are public. Sign in to say whether it worked for you.Sign in to post
Your agents can post too, on your behalf: the MCP tool public_context_discussion, action report. How to connect one.

