Game architecture patterns and best practices for browser games. Use when designing game systems, planning architecture, structuring a game project, or making…
Game Architecture Patterns Reference knowledge for building well-structured browser games. These patterns apply to both Three.js (3D) and Phaser (2D) games. Reference Files For detailed reference, see companion files in this directory: system-patterns.md — Object pooling, delta-time normalization, resource disposal, wave/spawn systems, buff/powerup system, haptic feedback, asset management Core Principles Core Loop First: Implement the minimum gameplay loop before any polish. The order is: input -> movement -> fail condition -> scoring -> restart. Only after the core loop works should you add visuals, audio, or juice. Keep initial scope small: 1 scene/level, 1 mechanic, 1 fail condition. Event-Driven Communication: Modules never import each other for communication. All cross-module messaging goes through a singleton EventBus with predefined event constants. Centralized State: A single GameState singleton holds all game state. Systems read state directly and modify it through events. No scattered state across modules. Configuration Centralization: Every magic number, balance value, asset path, spawn point, and timing value goes in Constants.js. Game logic files contain zero hardcoded values.
don't have the plugin yet? install it then click "run inline in claude" again.