
🎮 Gaming · C4 Architecture · Pro
The backend for an online multiplayer game: player accounts, matchmaking, dedicated game servers, leaderboards and in-game purchases.
C4 Architecture diagrams are part of Pro. Anyone can view this one; generating and editing it needs Pro.
Drawing diagram…
Backend for an online multiplayer game: players use game clients on PC, console and mobile. Services: account and login service, player profile and inventory service, matchmaking service, a game server allocator that starts dedicated game servers on a fleet (Agones on Kubernetes), leaderboard service backed by Redis sorted sets, store service for in-game purchases with platform payment providers, and telemetry to an analytics pipeline.
C4Container
title Multiplayer Game Backend
Person(player, "Player", "PC, console, mobile")
System_Boundary(game, "Game Backend") {
Container(client, "Game Client", "Unity", "Gameplay and UI")
Container(auth, "Account Service", "Go", "Login and sessions")
Container(profile, "Profile and Inventory", "Go", "Levels, items")
Container(mm, "Matchmaking Service", "Go", "Skill-based matches")
Container(alloc, "Server Allocator", "Agones", "Starts game servers")
Container(gs, "Dedicated Game Servers", "C++", "Real-time match state")
Container(lb, "Leaderboard Service", "Go", "Rankings")
ContainerDb(redis, "Leaderboards", "Redis", "Sorted sets")
ContainerDb(db, "Player DB", "PostgreSQL", "Accounts and inventory")
}
System_Ext(store, "Platform Stores", "Steam, PlayStation, App Store")
Rel(player, client, "Plays")
Rel(client, auth, "Logs in")
Rel(client, mm, "Finds match")
Rel(mm, alloc, "Requests server")
Rel(alloc, gs, "Allocates")
Rel(client, gs, "Plays match", "UDP")
Rel(gs, lb, "Reports results")
Rel(lb, redis, "Updates")
Rel(profile, db, "Stores")
Rel(client, store, "Buys items")How a player gets into a match: joining the queue, skill-based matching, server allocation and connecting to the game server.
The states of an online match on a game server: lobby, loading, in progress, pauses, reconnects and results.
How match results turn into leaderboards and rankings: result events, anti-cheat checks, rating updates and cached leaderboards.
How an online game runs servers close to players worldwide: regional fleets, a global matchmaker, and central account and store services.
How an in-game purchase is completed safely: store purchase, receipt validation on the server, granting items and handling refunds.
Tables for an online game: players, characters, items, inventories, currencies, purchases and match history.