From dt-brigid
MMO action relay architecture — client intent, server validation, broadcast patterns, thread-safe queues, combat networking
npx claudepluginhub dreamteam-hq/brigid --plugin dt-brigidThis skill uses the workspace's default tool permissions.
Reference material for building server-authoritative MMO netcode using an action relay model.
Searches, retrieves, and installs Agent Skills from prompts.chat registry using MCP tools like search_skills and get_skill. Activates for finding skills, browsing catalogs, or extending Claude.
Searches prompts.chat for AI prompt templates by keyword or category, retrieves by ID with variable handling, and improves prompts via AI. Use for discovering or enhancing prompts.
Checks Next.js compilation errors using a running Turbopack dev server after code edits. Fixes actionable issues before reporting complete. Replaces `next build`.
Reference material for building server-authoritative MMO netcode using an action relay model.
Clients send intent (what the player pressed), not state (where the player is). The server validates, stamps, and relays actions to other clients. This is fundamentally different from position streaming.
Why action relay over state streaming:
Every inbound action passes through a validation chain before broadcast:
CharacterId, authoritative position, server tick/timestamp.Reject early, reject cheap. Position plausibility checks use squared distance to avoid sqrt.
Today: broadcast to all ConnectedUsers. Simple, correct, scales to ~50-100 players.
Future — Area of Interest (AoI):
Use Channel<T> (System.Threading.Channels) for lock-free producer/consumer flow:
BackgroundService instances write server-generated events (spawns, timers, environmental effects).BoundedChannel with BoundedChannelFullMode.DropOldest to prevent a slow consumer from causing backpressure that stalls producers or exhausts memory.Producer A ──┐
Producer B ──┤──► BoundedChannel<GameAction> ──► Hub Dispatch Loop
Producer C ──┘
DamageEvent to all relevant clients.Client-side prediction exception: the attacking client plays the attack animation immediately on input for responsiveness. If the server denies, the client cancels/rolls back the animation. This is cosmetic-only — no local HP modification ever occurs without server confirmation.
Pure action relay drifts over time due to floating-point divergence, lost packets, or timing differences. Periodic reconciliation corrects this.
Reconciliation packets are larger than action packets but infrequent. Budget for ~50-100 bytes per snapshot per player.