game-patterns
Installation
SKILL.md
Game Programming Patterns
Engine-agnostic pattern reference for game systems. Synthesized from Nystrom's Game Programming Patterns (gameprogrammingpatterns.com).
Relationship to engine skills: This skill provides the why and when. Your engine skill (e.g., godot, love2d, odin-gamedev) provides the idiomatic how. When both fire, the engine skill takes precedence on implementation details — use this skill to understand which pattern to reach for, then let the engine skill guide the concrete code.
Pattern Selection by Problem
"I need to decouple things"
| Problem | Pattern | Choose when... |
|---|---|---|
| Entity behavior spans multiple domains (physics, rendering, AI) | Component — split into isolated domain objects | You're structuring an entity, not connecting systems |
| Need composable entities with emergent interactions AND 100+ entity types in data files, or confirmed cache-miss bottleneck in entity loops | ECS Architecture — entities as IDs, components as data, systems as behavior | You need data-driven content scale AND no engine component model, OR profiled cache pressure — not just organization |
| One system reacts to events in another, response needed immediately | Observer — subject notifies listeners synchronously | Few listeners, no performance concern in the handler |
| Systems communicate asynchronously, or events need batching/dedup | Event Queue — buffer events; consumers pull when ready | Observer is too synchronous, or you need cross-thread safety |
| A subsystem needs a global access point with swappable implementations | Service Locator — register/retrieve through a central registry | You need global access AND testability (mock services) |