starwards-colyseus

Synchronize Starwards multiplayer room state with Colyseus and @gameField decorators.

42|2|Updated Mar 17, 2019
One-click install
npx skills add https://github.com/starwards/starwards --skill starwards-colyseus
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: starwards-colyseus
Source: https://github.com/starwards/starwards/tree/main/.claude/skills/starwards-colyseus
Command: npx skills add https://github.com/starwards/starwards --skill starwards-colyseus

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires colyseus.

What problem does it solve?

Developing real-time multiplayer features can be challenging, often leading to desynchronization bugs and performance issues. This skill provides a deep dive into Colyseus patterns for Starwards, ensuring robust state synchronization and efficient multiplayer interactions.

Core Features & Use Cases

  • @gameField Decorator Mastery: Guides correct usage of decorators for automatic state synchronization, including type handling and common pitfalls.
  • State Sync Patterns: Explains server-authoritative state management, client command handling, and testing multiplayer scenarios with harnesses.
  • Use Case: When implementing a new multiplayer ship system, use this skill to correctly define its state with @gameField, handle client commands, and test for reliable synchronization across all players.

Quick Start

"I'm adding a new multiplayer system. How do I ensure its state syncs correctly with Colyseus?"

Frequently Asked Questions about starwards-colyseus

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

FAQPage Schema
How do I synchronize multiplayer state in real-time with Colyseus?

Real-time state synchronization with Colyseus uses server-authoritative architecture where the server maintains a single source of truth. Define your state schema with `@gameField` decorators, and Colyseus automatically broadcasts changes to all connected clients, eliminating manual sync logic and desynchronization bugs.

What is the `@gameField` decorator and how do I use it correctly?

The `@gameField` decorator marks properties for automatic state synchronization in Colyseus rooms. Apply it to typed schema fields to enable selective synchronization; Colyseus handles type checking and client updates. Correct usage prevents common pitfalls like untracked mutations and type mismatches.

How do I structure multiplayer rooms with server-authoritative state?

Organize rooms hierarchically—AdminRoom, SpaceRoom, ShipRoom—each with typed schemas and `@gameField` decorators. Clients send commands as JSON Pointer objects; the server validates and applies them, maintaining a single source of truth. This ensures predictable, high-performance multiplayer behavior across all players.

Can I use Colyseus for WebSocket-based multiplayer without desynchronization?

Yes. Colyseus eliminates desynchronization by centralizing state on the server and automatically syncing typed schema changes to clients over WebSocket. The framework handles conflict resolution and command flow, reducing the burden of manual state management in multiplayer systems.

How do I test multiplayer state synchronization across clients?

Use test harnesses to simulate server-authoritative state changes and client commands. Define your schema with `@gameField`, send typed Commands from test clients, and verify state propagation. This validates synchronization behavior before deployment without manual client testing.

What's the difference between client commands and server state in Colyseus?

Clients send typed Commands as requests; the server receives them, validates, and updates its authoritative state schema. Only the server's state changes are broadcast via `@gameField` decorators. This separation prevents client-side mutations from corrupting shared state.