Multiplayer systems, netcode, game servers, synchronization, and anti-cheat. Build scalable, responsive multiplayer experiences.
Provides authoritative server architecture, client prediction with reconciliation, and lag compensation patterns for building scalable multiplayer games. Use when implementing netcode, synchronizing player actions, or designing anti-cheat systems.
/plugin marketplace add pluginagentmarketplace/custom-plugin-game-developer/plugin install custom-plugin-game-developer@pluginagentmarketplace-game-developerThis skill inherits all available tools. When active, it can use any tool Claude has access to.
assets/networking_config.yamlreferences/NETWORKING_GUIDE.mdscripts/network_analyzer.pyCLIENT-SERVER (AUTHORITATIVE):
┌─────────────────────────────────────────────────────────────┐
│ DEDICATED SERVER │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ • Authoritative game state │ │
│ │ • Physics simulation │ │
│ │ • Hit validation │ │
│ │ • Anti-cheat checks │ │
│ └─────────────────────────────────────────────────────┘ │
│ ↑↓ ↑↓ ↑↓ ↑↓ │
│ [Client A] [Client B] [Client C] [Client D] │
│ └─ Prediction └─ Prediction └─ Prediction └─ Prediction│
└─────────────────────────────────────────────────────────────┘
// ✅ Production-Ready: Prediction + Reconciliation System
public class NetworkedMovement : NetworkBehaviour
{
private struct InputPayload
{
public uint Tick;
public uint Sequence;
public Vector2 MoveInput;
public bool Jump;
}
private Queue<InputPayload> _pendingInputs = new();
private CircularBuffer<PlayerState> _stateHistory;
private uint _inputSequence;
private void Update()
{
if (!IsOwner) return;
// Capture input
var input = new InputPayload
{
Tick = NetworkManager.ServerTime.Tick,
Sequence = _inputSequence++,
MoveInput = new Vector2(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical")),
Jump = Input.GetButtonDown("Jump")
};
// Predict locally (immediate response)
ApplyInput(input);
// Store for reconciliation
_pendingInputs.Enqueue(input);
_stateHistory.Add(GetCurrentState());
// Send to server
SendInputServerRpc(input);
}
[ClientRpc]
private void ReconcileClientRpc(uint ackedSequence, PlayerState serverState)
{
if (!IsOwner) return;
// Remove acknowledged inputs
while (_pendingInputs.Count > 0 && _pendingInputs.Peek().Sequence <= ackedSequence)
_pendingInputs.Dequeue();
// Check for prediction error
var predictedState = _stateHistory.Get(ackedSequence);
if (Vector3.Distance(predictedState.Position, serverState.Position) > 0.01f)
{
// Reconcile: reset to server state, replay pending inputs
SetState(serverState);
foreach (var input in _pendingInputs)
ApplyInput(input);
}
}
}
// ✅ Production-Ready: Server-Side Rewind
public class LagCompensation : NetworkBehaviour
{
private const int HISTORY_SIZE = 128;
private const float MAX_REWIND_MS = 200f;
private CircularBuffer<PositionSnapshot>[] _playerHistory;
[ServerRpc]
public void RequestHitValidationServerRpc(uint shooterClientId,
Vector3 shootOrigin, Vector3 shootDirection, uint targetClientId)
{
// Get shooter's RTT
float rtt = NetworkManager.ConnectedClients[shooterClientId].RTT;
float rewindTime = Mathf.Min(rtt / 2f + 50f, MAX_REWIND_MS);
// Get target's position at that time
var targetPastPosition = GetPositionAtTime(targetClientId,
Time.time - (rewindTime / 1000f));
// Perform hit check at rewound position
if (Physics.Raycast(shootOrigin, shootDirection, out var hit))
{
if (Vector3.Distance(hit.point, targetPastPosition) < 1f)
{
// Valid hit - apply damage
ApplyDamage(targetClientId, 25);
}
}
}
}
SCALABLE SERVER ARCHITECTURE:
┌─────────────────────────────────────────────────────────────┐
│ LOAD BALANCER (Global) │
│ ↓ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ MATCHMAKING SERVICE │ │
│ │ • Player queuing │ │
│ │ • Skill-based matching │ │
│ │ • Session creation │ │
│ └─────────────────────────────────────────────────────┘ │
│ ↓ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ GAME SERVERS (Auto-scaled) │ │
│ │ [US-East] [US-West] [EU] [Asia] │ │
│ │ Each region: 10-1000 instances │ │
│ └─────────────────────────────────────────────────────┘ │
│ ↓ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ DATABASE CLUSTER │ │
│ │ • Player profiles │ │
│ │ • Match history │ │
│ │ • Leaderboards │ │
│ └─────────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────────────┘
| Technique | Savings | Implementation |
|---|---|---|
| Delta Compression | 60-80% | Only send changed values |
| Quantization | 50-70% | Float → fixed-point |
| Bit Packing | 30-50% | Custom serialization |
| Interest Management | 70-90% | Only send relevant data |
| Priority Queue | Variable | Less important = less often |
ANTI-CHEAT LAYERS:
┌─────────────────────────────────────────────────────────────┐
│ LAYER 1: Server Authority │
│ → All game state validated on server │
│ → Never trust client │
├─────────────────────────────────────────────────────────────┤
│ LAYER 2: Sanity Checks │
│ → Movement speed limits │
│ → Action rate limits │
│ → Position validation │
├─────────────────────────────────────────────────────────────┤
│ LAYER 3: Statistical Detection │
│ → Inhuman accuracy patterns │
│ → Impossible reaction times │
│ → Abnormal session metrics │
├─────────────────────────────────────────────────────────────┤
│ LAYER 4: Client-Side (Optional) │
│ → Memory scanning (EAC, BattlEye) │
│ → Process monitoring │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ PROBLEM: Players rubber-banding / teleporting │
├─────────────────────────────────────────────────────────────┤
│ SOLUTIONS: │
│ → Increase interpolation buffer │
│ → Add jitter buffer for packets │
│ → Smooth corrections (lerp, not snap) │
│ → Check prediction code determinism │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ PROBLEM: Desyncs between clients │
├─────────────────────────────────────────────────────────────┤
│ SOLUTIONS: │
│ → Use fixed-point math │
│ → Sync random seeds │
│ → Periodic full-state resync │
│ → State hash comparison │
└─────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────┐
│ PROBLEM: High bandwidth usage │
├─────────────────────────────────────────────────────────────┤
│ SOLUTIONS: │
│ → Implement delta compression │
│ → Reduce tick rate for non-critical data │
│ → Use interest management │
│ → Quantize position/rotation values │
└─────────────────────────────────────────────────────────────┘
| Framework | Best For | Max Players | Learning Curve |
|---|---|---|---|
| Photon | Quick start | 16-32 | Easy |
| Mirror | Open source | 100+ | Medium |
| Netcode for GO | Unity official | 100+ | Medium |
| FishNet | Performance | 200+ | Medium |
| Custom | Full control | Unlimited | Hard |
Use this skill: When building multiplayer, designing servers, or implementing anti-cheat.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.