Basics of Game Networking

Nov, 2018

- By Game Art & Design Department of ICAT Design and Media College

We all would accept that playing with someone is real fun, be it physical games or video games. Video games that let multiple players to play the same game at the same time, on the same computer using split-screen or different computers connected through the internet game server or LAN, is called as Multiplayer games. Such Multiplayer games that connect gamers across the internet or LAN works based on game networking, which is an essential for every Game Developer to understand.
Let’s understand the basics of game networking here.



What is Game Networking?

Game networking is one of the categories of computer networking that details with state synchronization, entity interpolation, input prediction and lag compensation for multiplayer games.

State Synchronization

In state synchronization, network packets/communication between the server and the clients is optimized. The idea is to send both input (from the players) and state of the game running on both ends (of the network - server & clients) in an approximate and lossy synchronization (of values such as integers, floats, strings, and Booleans) strategy. This strategy gets an advantage of selecting the most important object which needs to send in updates for each packet (data packet). This process takes a large amount of time in extrapolation (decoding the message) but it is an easy and efficient process.

Entity Interpolation

Generally, almost every multiplayer game has entity interpolation in their networking model to hide the lags and jitters. Lags and jitters occur when updates are sent less frequently (per second) or due to packet drops, which increases more if UDP is used in the model. Interpolation helps in smoothing the transformations as well as brings them closer to the original movements.

Input Prediction

Input prediction creates a smoother player movement even before the server responds to client’s inputs. It uses players’ previous state plus player input to draw next predicted state (created using delta algorithm, which is previous position plus next expected position). And once when it receives an update from the server, it adjusts the current player state and deletes the old data. This process is repeated between every update to produce seamless game-play experience.

Two Stages of Game Networking

Game networking is created in two stages: In-Game Networking and Backend Infrastructure.

In-Game Networking 

Deals with choosing the right game server architecture like Peer-to-Peer or Client-Server, choosing a model to maintain game assets and network traffic, selecting the bandwidth and latency requirements, and picking network protocols (TCP/UDP, UDP is widely used in gaming).

Backend Infrastructure

Deals with creating a lobby, buddy list, clans and tournaments; and with authenticating, key checking and accounting.



Important Concepts of Game Networking



Latency is round trip average time that is taken by a workstation to send the data packets to the server (for games it is a game server) and receive back the data packets from the server. The higher the latency, the slower is the game — the clients will not be able to enjoy the gameplay at the fullest.

Dedicated Server 

A dedicated server is a dedicated workstation that has a copy of the game and runs the game as just a server.

Host Server

In host server, there is no dedicated workstation/computer to run the game. One of the clients (host-client) will also play the role of a server, by creating an instance of the game to which other players can connect.

Host Migration

In the client-server model, a centralized server has authority over the game. If the server goes down or fails, the gameplay is interrupted. To avoid this, we can create a host migration through which a copy of the game shall be maintained on all clients, which will be used to transfer the game to the host upon current server disconnection.

Dead Reckoning

Game server predicts the next move based on the last move.


When clients correct by warping the inconsistent predictions from the game server, it is called roll-back.



Communication Model in Game Networking

Open System Interconnection Model (OSI)

OSI model is developed by the International Organization of Standardization for standardizing communication system in 1978. This model laid standardization on how one system shall communicate with other. It has seven different layers and each layer is designated to work on a part of a communication model.



Seven Layers of the OSI Model

1. Application Layer (Layer 7)
The application layer is at the top of the OSI model. This layer creates data that can be transmitted over the network. The layer acts as a window to access the network.
2. Presentation Layer (Layer 6)
Presentation layer works with data representation and encryption. It translates messages to a network-standard transmission format on sender’s end and then back to native format on the receiver’s end. It also encrypts the message before sending the message to the host.
3. Session Layer (Layer 5)
Session layer deals with creating, maintaining and terminating a session between the nodes. It is also responsible for Synchronizing and Dialog control.
4. Transport Layer (Layer 4)
Transport layer breaks the data into small units called segments, which are used in end-to-end data transmission over the networks.
5. Network Layer (Layer 3)
Network layer deals with sending data from one node to another node over different networks. It is also responsible for finding the shortest path for delivering the network message. This is that major layer that we will be working with for Game Networking.
6. Data Link Layer (Layer 2)
 Data Link layer is responsible for error checking and sorting the messages.
7. Physical Layer (Layer 1)
Physical layer’s functionality is to deal with Signal, Binary Transmission and Transmission mode.

OSI model can be viewed in two stages: Application (Application, Presentation & Session); Data Transport (Transport Network, Data Link & Physical)



Network Layer – Key in Game Networking

The Network layer is the third layer of OSI (Open System Interconnection) model that is responsible for transmitting data packets from a computer/node to another computer/node. It provides data routing and switching for creating paths for network communication.

Responsibilities of Network Layer

  • Establishing a logical connection between nodes
  • Data forwarding
  • Routing
  • Delivering error report


Game Server Models

There are few game server models that are widely popular in Game Networking.

Peer-to-Peer (P2P)

In Peer-to-Peer, the players are connected directly to each other without a centralized system. So in P2P, each player shares the information about their game status with every player in the game. In this, each connection is a peer/node, and each peer has equal authority on the game.
With the evolution of the Client-Server model, this model is no longer as popular as it used to be in multiplayer gaming.


  • It does not need a dedicated server; but has an individual workstation/computer that is used in data transfer (game status).
  • As there is no server dependency, even if one or two peers/players disconnects from the game other gamers can continue the game uninterruptedly.
  • Information is more reliable, giving less space for cheating in the game.
  • Latency is reduced.


  • The gameplay is completely deterministic. That means a player might get an advantage over the other player by just taking a different path.
  • There is no server to verify the incoming data from other players, like any change in the current state.
  • Players can cheat easily and this model is not scalable.



In Client-Server model, players (clients) are connected over a centralized server. This server has complete authority over the gameplay. The centralized server through which players are connected is called a game server. The game server is completely responsible for keeping track of every client’s game status and distributing the information to all the other players; that is, all client communication happens through the game server.
For example: When a client updates the server about his position, health, ammo count etc., this information is updated on the other clients’ systems by the game server.


  • Incoming data is more reliable, because of game server authentication.
  • With a dedicated server, a cheat-proof game can be created.
  • Scalable projects can be created.
  • A dedicated server is not required in client-server-client-host.


  • Latency rate is higher.
  • Server maintenance can be very expensive.
  • Need to handle server bottlenecks like server overloading or unable to keep up the pace.


Different Services for Unity Networking

Following are the network services commercially available and popular among unity network developers.


UNET is the standard built-in unity networking service, which is the easiest to use. This model is a client-server architecture that provides a wide range of options. Developer here has an option to use High-Level API; that is, developers no more have to worry about implementing the networking at the lowest level. They can build network infrastructure for advanced multiplayer gaming, which is called low-level API.

High-Level API (HLAPI)

High-Level API is stacked at the top of the UNET. It is powerful enough to handle all areas of network gaming, such as creating network manager, hosting a game (client-server architecture) and creating a player character for individual clients. It can also store a list of all the span able objects, starting position, etc. HLAPI also covers the Low-Level API, such as sending and receiving network messages, data syndication, making remote calls, etc.

Low-Level API (LLAPI)

LLAPI lets developers create a network model from scratch for advance game networking. LLAPI is at the lowest level in the UNET networking layer and that is why it is called Low-Level API. The LLAPI is built on top of the UDP, which contains a network and a transport layer. A network layer works on creating connections between peers/nodes, handles packet delivering and control the flow. A transport layer handles messages from different communication channels. It also lets the developer work on bandwidth by using QOS.


Quality of Service (QoS)

Quality of Service is an advanced network configuration for network bandwidth (data/packet transmission channel). Following are the services that UNET provides:

• Unreliable: There is no guarantee in message delivery (some messages may get dropped) or in the order of delivery.
• UnreliableFragmented: There is no guarantee in message delivery or in the order of delivery. But it allows to breakdown the messages into smaller fragments before they are sent over the network and assembles back before reaching the receiving end.
• UnreliableSequenced: There is no guarantee in message delivery but it guarantees order of delivery.
• Reliable: There is guarantee (or disconnection) in message delivery but not in message ordering. This type takes more time because of added heads in the front of the messages (which check delivery). The undelivered messages are sent back based on round-trip time.
• ReliableFragmented: This works just like UnreliableFragmented but it also has message delivery guarantee (or disconnection).
• ReliableSequenced: ReliableSequenced works just like UnreliableSequenced but it also has message delivery guarantee (or disconnection).
• StateUpdate: To send or receive only the youngest message in the queue of data messages.
• AllCostDelivery: This is similar to Reliable — it will automatically resend the undelivered messages after a configured time period.



Advantages of UNET

  • UNET is the fastest and easiest approach to develop a multiplayer network system.
  • With UNET, we can create a complete authoritative server model.


Disadvantages of UNET

  • Projects are non-scalable and performance is less when compared to other available servers in the market.
  • Unity has recently announced deprecating the UNET (HLAPI & LLAPI) starting from 2018.4(LTS) version and ending the complete support from 2020, because it doesn’t meet the current multiplayer game networking requirements. But, it is going to replace UNET by a better network layer which may give solutions to the problems unanswered by UNET.



Currently, Photon provides four different services: PUN, BOLT, Quantum and Realtime. Depending on the project and services required, we can pick the appropriate service.




PUN stands for Photon Unity Networking, which is a clone of Unity Networking API and yet more reliable and powerful than UNET. PUN can handle serialization of game objects and remote procedure calls (RPC). It provides control over sending and receiving network messages with a flexible relay communication model. PUN can have a real dedicated server and a master client (master client is a host migration concept) that has some extra functionalities over other clients and act as pseudo-authoritative.The advantage of having a PUN is, if a master client gets disconnected from the game, any other available client is converted to be the master client, unless there are no more clients available in the game. Thus, the gameplay is uninterrupted to the last player in the game.




BOLT uses a client-server architecture where one of the clients must act as a server (dedicated host/server). BOLT is a higher level API that allows the developers to create their networkable game state called Bolt Assets, which are associated with game prefabs.
BOLT has many features that can give the developer a wide range of options. Such features include the following.

  • Provides three delivery models (Unreliable, UnreliableSynced and Reliable)
  • Provides a built-in support for input and player controller state synchronization
  • Supports both dedicated and listen server
  • Lag compensation
  • Supports loading synchronized maps
  • Houses a relay system



Quantum uses client-server architecture. In this, the clients simulate everything on their own workstations and sends only inputs. Thus there is a good chance that the slowest client (with awful latency) can set the experience for everyone else in the game — this is called Lockstep. But it can be solved by a simple logic of injecting null traffic in between the updates to evaluate the slowest client to update (status) to invalid.

  • Low latency
  • Super low bandwidth
  • Relay system implementation is much easier


  • There can be a small amount (negligible amount) of lag because clients are waiting for inputs
  • Tricky to implement the deterministic model



Smartfox is a good solution for gaming network but it is not that powerful as other services available in the market. It is very expensive when compared to the other competitors.


Unity vs. Photon



  • It has an advanced relay system (which is a lightweight dedicated server with high efficiency).
  • The projects are scalable.
  • It offers better performance and security (user login/authentication/session) than Unity network.



  • Unity simulates physics, variables and animation which can be expensive on the server.
  • Projects are not scalable.
  • Unity Relay system creates more lag than photon.
  • Though Unity has announced better networking solution on 2018.4, developers have to wait to test and experience the changes.


Game networking is about sending and optimizing (that is what needs to be updated from player or server side) network packets, making a centralized authority to avoid cheating and hosting a game. Choosing a right network model can be complicated if you are not aware of the network basics. Though game networking discussed in the blog post is in relation to Unity 3D, the game networking concepts remain the same regardless of the game engine.

Image Courtesy: