Game Networking Tutorial: Core Concepts Every Developer Should Know

Tolga profile photo
Tolga
September 18, 2026
Game Networking Tutorial: Core Concepts Every Developer Should Know featured image

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.

  1. The player acts, for example steering left in a racing game.
  2. The client sends that input to the server as a small message.
  3. The server applies the input to the authoritative world, moving your car and checking for collisions.
  4. The server broadcasts the updated state to every player in the match.
  5. Each client renders the new positions, so every racer sees the same track.
Input-to-server-to-broadcast loop across players in a match
Input-to-server-to-broadcast loop across players in a match

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.

ModelAuthorityLatencyAnti-cheatWhen to use
AuthoritativeServer owns and validates stateSlightly higher, the server is in the pathStrong, the server rejects bad inputCompetitive, ranked, or shared-world games
RelayedClients trust each otherLower, the server forwards without simulatingWeak, clients are trustedCo-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.

  1. The client applies the input locally, so your character starts running the instant you press forward.
  2. The client sends the input to the server and keeps its own copy.
  3. The server processes the input and returns the authoritative position.
  4. The client compares its guess to the server result and reconciles any difference.
  5. 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.

ApproachTime to shipOps burdenCustomizationLock-inCost
Build in-houseLong, many monthsHigh, you run everythingTotalNone, you own the codeEngineering salaries over months
Open-source self-hostMedium, weeks to a couple of monthsMedium, you choose what to runHigh, extend on the serverLow, the core is open sourceInfrastructure only
Managed backend-as-a-serviceShort, days to weeksLow, the provider runs itScoped to the APIVaries by vendorUsage-based
Engine-tied cloudShort, days to weeksLow, bundled with the engineLimited to that ecosystemHigh, harder to leaveUsage-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?

An authoritative game server is the machine that holds the real game state and validates every player action before it counts. Clients send inputs, and the server decides the outcome and broadcasts it. This is what stops most cheating, because a client can’t force a result the server didn’t approve.

What is game networking in simple terms?

Picture a referee holding the real scoreboard while players call out their moves. The players send what they want to do, the referee applies the rules and updates the score, then tells everyone the new state. The referee is the server, the messages are the network traffic, and the shared score is the game state.

Is peer-to-peer or client-server better for competitive games?

Client-server with an authoritative server is better for competitive games. The server owns the state and rejects invalid input, so a fast client can’t cheat the result. Peer-to-peer keeps overhead low and suits casual or co-op play where trust between players is fine.

Can Nakama run both authoritative and relayed multiplayer?

Yes. Nakama ships both models, so you pick relayed for low-overhead trusted matches and authoritative when the server must own the state. You can even run different modes for different features in the same game, all on infrastructure you control.

Do I have to write netcode from scratch with Nakama?

No. Nakama handles the realtime transport, matchmaking, and match state for you. You add your rules as server code in Go, TypeScript, or Lua. That keeps your team focused on gameplay instead of rebuilding networking plumbing.

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