multiplayer

A library for adding real-time multiplayer to browser games. It synchronizes shared game data, individual player data, and broadcast events between players.

In plain words
What is it for?
Use it to add co-op or player-versus-player features to games made with Phaser, Three.js, React, or plain JavaScript.
Why use it?
It provides a defined way for players to see the same game world and exchange updates without building the networking layer from scratch.

Skill for Claude CodeCodex

Part of the game-features plugin — 2 skills shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/kyh/vibedgames/multiplayer
Any agent
npx skills add kyh/vibedgames --skill multiplayer
Clone the repo
git clone --depth 1 https://github.com/kyh/vibedgames

Made for: Claude Code, Codex.

Or install game-features, the plugin that ships this one along with the rest of its 2 skills.

Per session 78 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 4,855 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00078 $0.04855
Opus 5 $0.00039 $0.02427
Sonnet 5 $0.00016 $0.00971
Haiku 4.5 $0.00008 $0.00485

Measured 3d ago against content hash f2a3cc5bb115, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade C, and why

multiplayer scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

Use the adapter pattern. Single-player should still work after `rm -rf net/`.
plugins/game-features/skills/multiplayer/SKILL.md · 550 lines

How it starts

The opening of the file, as written. The whole thing — 550 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Vibedgames Multiplayer

Add real-time multiplayer to any browser game with @vibedgames/multiplayer.

Install

npm install @vibedgames/multiplayer

Two entry points

  • @vibedgames/multiplayer — framework-agnostic MultiplayerClient class (Phaser, Three.js, vanilla JS)
  • @vibedgames/multiplayer/react — React hooks wrapping the client

Party host

Every example below assumes this constant. Define it once — in a real game it lives in net/client.ts (see Architecture patterns) — and import it; never repeat the literal per call site:

export const PARTY_HOST = "https://vibedgames-party.kyh.workers.dev";

Core concepts

Three types of state:

  1. Shared state — one copy, all players see the same (game world, score, phase). Host-only writes.
  2. Player state — per-player, owned by that player (position, health, intent flags).
  3. Events — fire-and-forget messages, broadcast to everyone (explosions, kills, pings).

The host (first player) runs authoritative game logic. If the host leaves, the next-joined player is reassigned as host.

Room caps (overflow to new rooms)

By default a room is unlimited. Pass maxPlayers to cap it; when full, the next player overflows into a sibling room ({room}~2, {room}~3, …) and the SDK reconnects them there transparently — extra players get a parallel match instead of being turned away.

const client = new MultiplayerClient({
  host: PARTY_HOST,
  party: "vg-server",
  room: "arena",
  maxPlayers: 8, // 9th player lands in "arena~2", 17th in "arena~3", …
});
client.room; // the room you actually landed in — "arena" or an overflow sibling

useMultiplayerRoom takes the same maxPlayers option; read the live id off room.room for "Room #2"-style UI.

Notes:

  • Enforced server-side and clamped to a hard ceiling — a client can't size a room arbitrarily large.
  • All clients must pass the same maxPlayers (ship it in shared config); mixing values makes the effective cap depend on who connects.
  • Overflow rooms are independent worlds (separate host, separate sharedState) — no cross-room matchmaking. Players in arena and arena~2 can't see each other.
  • Omit maxPlayers for unlimited.

Read the full file on GitHub · 550 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3d ago First seen · 550 lines · 78 tokens per session scan C f2a3cc5bb115

Subscribe to this mod's changes

multiplayer is a skill published in the GitHub repository kyh/vibedgames (55 stars, last pushed yesterday), licensed MIT. It adds 78 tokens to every session and 4,855 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

supabase

Use when doing ANY task involving Supabase: Database, Auth, Edge Functions, Realtime, Storage, Vectors, Cron, Queues, supabase-js, @supabase/ssr, RLS, schema migrations, CLI, MCP server. Includes security checklist.

martineserios/thebrana · 58 tokens

game-development

Game development patterns, architectures, and best practices.

miles990/claude-software-skills · 12 tokens

react-hook-form

Correct React Hook Form usage anywhere in the monorepo — data flow, subscriptions, reset, dirty state, number inputs, and controlled-input rules. Load this BEFORE writing or modifying ANY form code, adding a field to an existing form, touching watch/useWatch/formState/getValues/setValue/reset, wiring a form into a…

supabase/supabase · 123 tokens

safe-sql-execution

Use whenever code will build, return, fetch, or execute SQL that runs against a user's real Postgres database — even when the request reads like an ordinary feature or bug fix and never says "security," "injection," or "SafeSqlFragment." This covers: writing or editing any pg-meta function, query builder, or endpoint…

supabase/supabase · 221 tokens

studio-e2e-tests

Write and run Playwright E2E tests for Supabase Studio (e2e/studio). Use when asked to run e2e tests, write new E2E tests, or debug flaky or failing Playwright tests. Covers running commands, avoiding race conditions, waiting strategies, selectors, helper functions, and CI vs local differences.

supabase/supabase · 74 tokens

studio-mock-api-tests

Component tests for Supabase Studio that mock API requests at the network layer with MSW. Use when writing or reviewing a component test that exercises a React Query hook or mutation, or when migrating an existing test away from vi.mock('@/data/...'). Covers the customRender + addAPIMock template and the jsdom/MSW…

supabase/supabase · 79 tokens