Messaging & realtime · Intermediate

Multiplayer game backend

Matchmaking and fleet allocation over HTTP, authoritative game servers over UDP.

Every part, and why it is there

Game clients

Run the game locally and predict their own movement so controls feel instant, while the server decides what really happened.

API gateway

Front door for everything outside a match: login, store, friends, queueing for a game. Plain HTTPS, so ordinary web tooling applies.

Auth service

Logs players in and issues a signed token the game server can verify without calling back. Cheaters start by forging identity, so this is the first gate.

Accounts & profiles

Accounts, inventory, ratings and match history. Purchases and items need real transactions, so a relational database fits.

Matchmaking

Groups waiting players into fair matches by skill, region and party size. It widens the acceptable skill range the longer someone waits, trading fairness for queue time.

Matchmaking pool

Waiting players in sorted sets keyed by rating and region, so “find 9 others near 1500 in EU-West” is a quick range query.

Fleet allocator

Once a match is formed, grabs a ready game server in the right region and hands its address and a join ticket to the players.

Game server fleet registry

Which game servers are warm, busy or draining. Keeping a buffer of idle servers means matches start in seconds instead of waiting for a machine to boot.

Profile & leaderboard API

Serves profiles, stats and rankings to menus and websites. Read-heavy and cache-friendly.

Leaderboards

Sorted sets make “top 100” and “my rank out of 10 million” cheap. Doing that in SQL on every menu view would be slow.

UDP entry

Players connect straight to their match server over UDP. In-game traffic is many small packets per second where the newest state matters and old packets are worthless.

Dedicated game servers

One process per match runs the simulation at a fixed tick rate (e.g. 30–60 per second), applies player inputs and sends back the authoritative world state. Because the server decides, a hacked client cannot teleport.

Match results

At the end of a match the server publishes the outcome and stats. Rating updates and rewards happen after, so a slow database never freezes a live match.

Rating & stats workers

Update skill ratings (Elo, Glicko, TrueSkill-style), match history and leaderboards from match results.

Asked in interviews at

  • openai
  • meta
  • upstart
  • roblox
  • google

Concepts used here

  • WebSockets: Turn one HTTP request into a pipe that stays open, so the server can push a chat message the moment it arrives. Then pay for it: memory per user, heartbeats, reconnects and pub/sub.

Learn more

All system design examples