Game Networking Tutorial: Core Concepts Every Developer Should Know


The fundamentals behind every multiplayer match, and how to put them to work with realtime networking.
How does game networking work?
Game networking is the exchange of player input and game state between connected devices, fast enough that the match feels live. This game networking tutorial covers that loop, then the models and latency tricks it depends on. A client sends what the player did. The server updates the shared world. Every client then receives the new state and draws it. That loop repeats many times per second. The server sends its state as regular snapshots, and the rate you pick trades bandwidth against how smooth the game feels, roughly 10 to 20 Hz for casual and turn-based games, 30 to 60 Hz for competitive action.
Underneath, realtime games keep a persistent two-way connection open so either side can send data at any moment, which is what the WebSocket protocol was built for. Polling the server for updates is too slow for a live match. That connection usually rides TCP. TCP guarantees delivery and order, but a lost packet holds up every packet behind it. That head-of-line blocking is a tax on fast action. UDP drops the delivery guarantee so the newest state can arrive without waiting on a retransmission, which is why many shooters send snapshots that way. When only the latest position matters, waiting on a retransmission is worse than dropping the stale packet. TCP will not make that trade. UDP will, and that is why a live match has to pick a transport on purpose. Nakama’s socket interface runs on WebSockets and rUDP, so you pick the transport that matches the match.
- The player acts, for example steering left in a racing game.
- The client sends that input to the server as a small message.
- The server applies the input to the authoritative world, moving your car and checking for collisions.
- The server broadcasts the updated state to every player in the match.
- Each client renders the new positions, so every racer sees the same track.

Client-server vs peer-to-peer games: which model fits yours?
Use client-server when you need control and fair play, and peer-to-peer when you want the lowest overhead for a small, trusted match. In client-server, one server holds the real state and every client talks to it. In peer-to-peer, players connect to each other, and one of them usually acts as host. If that host drops, the match has to migrate to a new host or end. That is why peer-to-peer works best for short, trusted sessions where a dropout is cheap.
We support both authoritative and relayed models in Nakama, and both are client-server rather than peer-to-peer. Relayed vs authoritative multiplayer is the choice inside client-server. Relayed multiplayer, also called client-authoritative, forwards messages between clients without inspecting them. It fits games where cheating is a non-factor, like a co-op or a small social match. Authoritative multiplayer runs your game loop on the server, validates each input, and broadcasts state, which is the model competitive games need.
| Model | Authority | Latency | Anti-cheat | When to use |
|---|---|---|---|---|
| Authoritative | Server owns and validates state | Slightly higher, the server is in the path | Strong, the server rejects bad input | Competitive, ranked, or shared-world games |
| Relayed | Clients trust each other | Lower, the server forwards without simulating | Weak, clients are trusted | Co-op, casual, or small social matches |
Even in a client-server setup, sending only inputs to an authoritative server and rendering the state it returns is the classic way to keep clients honest.
How do you reduce latency in a multiplayer game?
You can’t remove network latency, so you hide it. Latency is the time a packet takes to travel between two machines, often measured as round-trip time. On the open internet that delay runs from tens to hundreds of milliseconds, enough to make a fast game feel broken if the client just waits.
Two techniques fix the feel. Client-side prediction lets the client apply the player’s own input right away instead of waiting for the server. Server reconciliation then corrects the client once the authoritative result arrives, so the player stays responsive without drifting out of sync. The gap between guess and truth is usually one snapshot interval, so the correction is invisible unless the network stutters. A low latency game server still can’t delete the delay; it can only hide it with prediction and interpolation.
- The client applies the input locally, so your character starts running the instant you press forward.
- The client sends the input to the server and keeps its own copy.
- The server processes the input and returns the authoritative position.
- The client compares its guess to the server result and reconciles any difference.
- Other players’ movement is smoothed with interpolation, so it still looks natural.
Should you build your own networking or use a game backend?
Build from scratch when networking is your core innovation, and use a backend when you’d rather ship the game. Writing your own serialization, transport, and sync loop is real engineering work that keeps demanding attention after launch. There are three common paths. Open-source self-host gives you full control and no license lock-in, with ops on you. A managed game backend-as-a-service runs the servers for you and trades some control for speed. An engine-tied cloud bundles networking into one vendor’s ecosystem, which is convenient but harder to leave. This multiplayer game development guide is clear: don’t rebuild transport, matchmaking, and state sync unless networking is the product.
| Approach | Time to ship | Ops burden | Customization | Lock-in | Cost |
|---|---|---|---|---|---|
| Build in-house | Long, many months | High, you run everything | Total | None, you own the code | Engineering salaries over months |
| Open-source self-host | Medium, weeks to a couple of months | Medium, you choose what to run | High, extend on the server | Low, the core is open source | Infrastructure only |
| Managed backend-as-a-service | Short, days to weeks | Low, the provider runs it | Scoped to the API | Varies by vendor | Usage-based |
| Engine-tied cloud | Short, days to weeks | Low, bundled with the engine | Limited to that ecosystem | High, harder to leave | Usage-based, plus switching cost |
How Nakama handles realtime networking
We built Nakama as an open source multiplayer game backend, so realtime networking is handled for you and you still own your stack. You run authoritative and relayed multiplayer, matchmaking, and match listing on your own infrastructure. Set a custom tick rate from 1 to 60 Hz to pace your authoritative match loop. Write your server logic in Go, TypeScript, or Lua. Official client libraries cover Unity, Unreal, and Godot, among other engines.
You get real proof behind it. Nakama has been in active development since 2015, serves more than a trillion requests per month, and has been tested to 2 million concurrent users. From indie studios to publishers and larger studio orgs, the same core scales up without a rewrite.
For a hands-on game backend tutorial, our build guide walks through a full competitive multiplayer game with an authoritative match handler. Heroic Cloud is the managed path for larger studios, publishers, and enterprise teams that outgrow self-hosting. It gives them an enterprise game backend with production ops, multi-region deployment, and SOC 2 Type II compliance. They scale on the same stack with no rewrite.
Get the fundamentals right first, then let Nakama handle the realtime networking so you can focus on the game. Start building on Nakama, our open source game server.
FAQ
What is an authoritative game server?
What is game networking in simple terms?
Is peer-to-peer or client-server better for competitive games?
Can Nakama run both authoritative and relayed multiplayer?
Do I have to write netcode from scratch with Nakama?
Enterprise game backends
See how studios ship multiplayer at scale without rebuilding infrastructure.
Walk through Nakama and Heroic Cloud: org-level access control and managed ops without rewriting your stack. Book a demo to see it in action.
- SOC 2 Type II certified
- Proven at 2M concurrent users
- Dedicated capacity, no CCU limits
