Network Model of Fighters

05.03.16    gamedev    network    fighters

My combat game (prototype) Fighters works over a network connection. I want to present some insights into its networking model. The main idea is the synchronized connection to a central server.


The central node of the network is the server. In the network model of fighters it has two main purposes: serve the startup data and forward client messages. The server program does not know any details about the game. No part of the game logic is implemented in the server.

At startup the server reads the configuration file and generates additional startup data (e.g. the seed for the random number generator). This data is shared with any incoming client connection. This way all clients start in the same state. When enough clients have connected, the server initiates the actual game and moves on to its second purpose.

During the game all messages from the clients go to the server. It is the only component which knows every participant. The server just forwards every message it receives to every other client without any further inspection.


At startup the client connects to a server receiving all the needed startup data. Because every client receives the same startup data all clients start synchronized.

Once the game starts the client goes into a deterministic game loop. Any outcome is perfectly defined by the input. Because all messages are shared between all clients transparently the clients stay synchronized.

But how is player interaction implemented? Well, every client checks the input state of the local player at every game iteration. This state is fit into a narrow set of discrete possibilities (move left/right, jump etc.). This state is shared with the other clients (through the server). Only once every client knows about the input state of every other client the game moves forward one iteration.


This model fits the game quite well. A potential maliciously modified client cannot fundamentally break the rules of the game because its interaction with other clients is restricted to legal input messages. In this model it is not possible to convince other clients that the player just randomly teleported or has infinite ammunition.

But this model has warts. Every client has perfect information about any aspect of the game. This is not so much a problem for Fighters but a potential strategy game with intelligence aspect might easily be hacked to reveal more information.

Furthermore there is no authoritative game state. If under some circumstances the clients desynchronize the objective outcome of the game is undefined and the game cannot be recovered.

A real practical hurdle is the fact that this synchronous model implies that all clients iterate at the same time. The whole game is slowed down for the slowest client/connection.

But still this model is good enough a game like Fighters; particularly in this prototype incarnation.