game-architecture

Codify event-driven architecture and centralized state management for browser games.

307|37|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/OpusGameLabs/game-creator --skill game-architecture
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: game-architecture
Source: https://github.com/OpusGameLabs/game-creator/tree/main/skills/game-architecture
Command: npx skills add https://github.com/OpusGameLabs/game-creator --skill game-architecture

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill provides a distilled set of game-architecture patterns and best practices for browser games, helping teams design scalable, maintainable code bases instead of ad-hoc implementations.

Core Features & Use Cases

  • Event-Driven Communication: Modules communicate through a singleton EventBus, preventing tight coupling and enabling flexible, testable systems.
  • Centralized State: A single GameState singleton holds game data, with read/write governed by events and a clear data model.
  • Configuration Centralization: All tunable values live in a Constants file to avoid hardcoded numbers and simplify balancing.
  • Orchestrator Pattern: A Game.js-style orchestrator initializes systems, controls flow (menu, loading, gameplay, win/lose), and runs the main loop.
  • Code Organization: Clear layers (core/, systems/, gameplay/, level/, ui/) enforce separation of concerns and scalable growth.

Quick Start

Review the repository structure under core/, systems/, gameplay/, level/, and ui/ and apply EventBus, GameState, and Constants patterns to new modules.

Frequently Asked Questions about game-architecture

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I structure a scalable browser game architecture in Phaser or Three.js?

A scalable browser game architecture uses a shared directory structure (core/, systems/, gameplay/, level/, ui/) to separate concerns, paired with a Game.js orchestrator that initializes systems and controls flow. This enforces maintainable code growth instead of ad-hoc implementations.

What is the best way to decouple modules in browser game development?

Modules in browser game development decouple by communicating through a singleton EventBus. This prevents tight coupling between systems, enabling flexible and testable interactions without direct dependencies between gameplay, level, and ui layers.

How does centralized state management work for browser games?

Centralized state management for browser games uses a single GameState singleton to hold game data. Reads and writes are governed by events and a clear data model, ensuring data consistency and preventing scattered state across systems.

Where should I put game configuration and constants to avoid hardcoded values?

All tunable game configuration and constants belong in a centralized Constants file. This avoids hardcoded numbers scattered across systems, simplifying game balancing and making configuration adjustments easier to maintain.

Can I use this event-driven game architecture pattern with both Phaser and Three.js projects?

Yes, the event-driven game architecture pattern applies across both Phaser and Three.js projects. It uses an orchestrator pattern to control flow (menu, loading, gameplay, win/lose) and a shared core structure to support scalable systems.

Why does my browser game code become hard to maintain as it grows?

Browser game code becomes hard to maintain due to ad-hoc implementations lacking separation of concerns. Enforcing clear layers (core/, systems/, gameplay/, level/, ui/) and a single source of truth for constants and events solves this by providing a distilled set of architectural patterns.