Multiplayer Backend Architecture Patterns: Peer‑to‑Peer, Dedicated Servers, Hybrid
Building a multiplayer game involves choosing an architecture pattern that determines how players connect, where game logic runs, and how persistent state is managed. Each pattern implies different requirements for your backend services. This article covers four common patterns and explains which backend features (auth, persistence, server registry, live config) each pattern needs.
Architecture dictates backend needs: A peer‑to‑peer game needs player authentication and matchmaking; a dedicated‑server game adds server registry and live config delivery; an authoritative simulation backend may handle game logic directly.
1. Peer‑to‑Peer (P2P) with Host Migration
One player acts as the host; others connect directly to that host’s game instance. The host’s machine runs the authoritative simulation. If the host leaves, another player becomes host (host migration).
Backend Requirements
- Player authentication: Verify players before they join a session.
- Matchmaking & room management: Help players find each other, create/join rooms, and exchange connection details (NAT punch‑through).
- Persistent progression: Store player profiles, inventory, and stats after the session ends.
- Live config: Deliver balance tweaks and feature flags to clients.
Example Stack
Networking: Photon Realtime, Unity Netcode P2P. Backend: PlayFab (matchmaking, auth, cloud save) or Supercraft GSB (auth, progression, config). No server registry needed because there are no dedicated servers.
2. Dedicated Game Servers (Authoritative)
Your studio runs dedicated game servers (in the cloud or via a hosting provider). These servers run the authoritative simulation; clients send inputs and receive state updates. This is the standard for competitive, high‑stakes, or large‑scale multiplayer games.
Backend Requirements
- Player authentication: Players must authenticate before connecting to a server.
- Server registry & discovery: Servers need to register themselves, send heartbeats, and be discoverable by players (server browser).
- Live config delivery: Servers need to receive configuration updates (drop rates, map rotations) without restarting.
- Persistent player data: Servers read/write player progression, inventory, and economy state.
- Matchmaking (optional): Automatically assign players to servers based on skill, ping, etc.
Example Stack
Networking: Unity Netcode for GameObjects, Unreal Dedicated Server, Photon Fusion (server‑side). Backend: Supercraft GSB (server registry, auth, config, progression) + PlayFab (if you need advanced LiveOps). Alternatively, Nakama + custom server registry.
3. Authoritative Simulation Backend (Serverless Logic)
The game logic runs inside the backend itself, not in separate game servers. Clients send actions to the backend, which processes them and returns results. Common for turn‑based, strategy, or economy‑focused games where low latency is less critical.
Backend Requirements
- Game logic execution environment: Backend must run custom code (C#, JavaScript, etc.) in response to player actions.
- Player authentication & state management: As usual.
- Real‑time updates: Push state changes to connected clients via WebSockets or long polling.
- LiveOps tooling: Since game logic is in the backend, config changes can directly affect behavior.
Example Stack
Networking: Backend‑driven (REST/WebSockets). Backend: Metaplay (shared C# logic), Nakama with JavaScript/Lua extensions, or custom backend on Azure Functions/AWS Lambda.
4. Hybrid: Dedicated Servers + Backend Services
Most modern AAA games use a hybrid: dedicated servers handle real‑time simulation, while a separate backend service manages player data, economy, LiveOps, and social features. The two systems communicate via APIs.
Backend Requirements
- All of the dedicated‑server requirements (auth, registry, config, persistence).
- High‑throughput APIs: Game servers will call the backend frequently (e.g., reward grants, stat updates).
- Event pipeline: Capture in‑game events for analytics and LiveOps segmentation.
- Economy & inventory: Server‑authoritative transactions must be atomic and cheat‑proof.
Example Stack
Networking: Custom engine or Photon Fusion server‑side. Backend: PlayFab (full LiveOps) + custom server registry, or Supercraft GSB (unified backend for both player and server services).
Mapping Backend Services to Patterns
| Backend Service | Best For Pattern | Why |
|---|---|---|
| Supercraft GSB | Dedicated Servers, Hybrid | Built‑in server registry, live config delivery to servers, and player‑service APIs. |
| PlayFab | P2P, Hybrid | Strong matchmaking, player data, LiveOps; less focus on server registry. |
| Metaplay | Authoritative Simulation Backend | Game logic runs in backend; seamless LiveOps integration. |
| Nakama | P2P, Authoritative Simulation, Hybrid | Provides real‑time multiplayer, storage, and extensions; server registry needs custom work. |
| Beamable | P2P, Hybrid (economy layer) | Focus on economy and content; pair with separate networking solution. |
Choosing Your Pattern
Game Genre Considerations
- FPS, Battle Royale, Racing: Dedicated servers (pattern 2 or 4) for fairness and anti‑cheat.
- Turn‑based, Card Games, Strategy: Authoritative simulation backend (pattern 3) simplifies logic and scaling.
- Social, Casual, Party Games: P2P (pattern 1) reduces hosting costs; use relay servers for NAT traversal.
- MMO, Persistent World: Hybrid (pattern 4) with dedicated servers for zones/instances and a central backend for global state.
Team Size & Expertise
Small teams should lean on managed backends that match their chosen pattern (e.g., Supercraft GSB for dedicated servers, PlayFab for P2P). Large studios with infrastructure expertise can build custom hybrids.
Start simple: If you’re unsure, begin with a managed backend that supports multiple patterns (like PlayFab or Nakama) and refactor as you learn. Changing architecture later is costly, but picking a flexible backend can reduce that cost.
Related in This Hub
- Server Browser & Master Server Design
- Photon Real‑Time Networking vs Backend Services
- Multiplayer Game Backend Architecture
- Game Server Backend hub
Deep dive into each pattern with the backend documentation: Supercraft GSB, PlayFab, Metaplay, Nakama.