---
name: multiplayer-networking
description: Use when designing or implementing online multiplayer: authority models, replication, prediction, lag compensation, matchmaking, sessions and network testing. Plans for latency, cheating and failure from the start.
---

# Multiplayer networking

Draft from the Game studio skills library by THE DREAMING JESTER. Adapt it to your game, team and engine.

## Goal

Make multiplayer feel responsive and fair under real network conditions, and hard to cheat.

## Before you start

- Decide the authority model: dedicated server, listen server, or peer-to-peer, and why.
- Know the player count, session length, target regions and expected latency.

## Process

1. Classify state: what the server owns, what clients predict, and what is purely cosmetic.
2. Replicate only what clients need, at the rate they need it. Budget bandwidth per player.
3. Use client-side prediction and reconciliation for the local player's movement and actions.
4. Use interpolation for remote entities, and lag compensation where hit detection depends on timing.
5. Validate every client request on the server. Never trust client-reported results.
6. Handle joins, leaves, reconnects, host migration and session end explicitly.
7. Test with simulated latency, jitter and packet loss from the first prototype, not only on a local network.
8. Log network metrics: round-trip time, packet loss, bandwidth and desyncs.

## Quality bar

- The game is playable at the target maximum latency.
- No client can grant itself items, damage or position the server would reject.
- Disconnects and reconnects do not corrupt game state.

## Output

An authority and replication plan, the implementation, network test results and metrics dashboards.

## Avoid

- Adding networking to a single-player architecture late.
- Testing only on a local network.
