What problem does it solve?
This Skill provides an end-to-end blueprint for implementing the validated real-time backend logic for a turn-based stacking board game, ensuring the server remains the single source of truth for game state.
Core Features & Use Cases
- Authoritative Game Engine: Defines immutable
GameState updates for MOVE and REORDER while enforcing turn order, stack rules (top-only), forward-only movement, and end conditions (finish line or max turns).
- Strict Server-Side Validation: Specifies a
validateAction() checklist with exact error codes and guardrails to prevent illegal moves and cheating from client input.
- Socket.io Multiplayer + AI Turn Handling: Establishes a socket event contract, room broadcast flow, and server-only heuristic AI move generation with a human-feeling delay.
Quick Start
Implement the backend by first creating src/game/types.ts and the pure core functions in src/game/logic.ts, then implement src/game/validator.ts to enforce the non-negotiable rules, and finally wire src/socket/handlers.ts to accept game_action events and broadcast state_update and game_over using the required event names and error codes.