The 52nd MPAI General Assembly (MPAI-52) has approved Server-based Predictive Multiplayer Gaming (MPAI-SPG) – Mitigation of Data Loss effects (SPG-MDL) V1.0. It is a Technical Report that provides a methodology to predict the game state of an online gaming server when some controller data is lost. The Prediction is obtained by applying Machine Learning algorithms based on historical data of the online game.
An online Multiplayer Game is based on a server. When this maintains consistency among all clients’ game instances it is called authoritative. It updates and broadcasts the game state using the controller data of all the clients. This function is harmed when controller data are not correctly received or are maliciously modified.
There are several techniques currently used to cure this situation. In Client Prediction, client game state is updated locally using predicted or interpolated data while waiting for the server data; in Time Delay, the server buffers the game state updates to synchronise all clients; and in Time Warp the server rolls back the game state to when controller data was sent by a client and acts as if the action was taken then, reconciling this new game state with the current game state.
These three methods have shortcomings. Client Prediction causes perceptible delay, Time Delay affects responsiveness, and Time Warp disadvantages other players because the new game state likely differs from the previous one.
Figure 1 depicts the arrangement proposed by SPG-MDL. The right-hand side represents the online game server with the Game State Engine tasked to produce the game state using all clients’ controller data and specialised engines. The Engines of the figure are:
- Behaviour Engine, orchestrating actions from players and non-player entities.
- Rules Engine, ensuring adherence to game mechanics.
- Physics Engine, responsible for physical interactions within the game environment.
Figure 1 – Server Prediction
Whenever a client’s controller data is lost, the server requests the SPG-MDL module (the left-hand side of Figure 1) to compute the next game state. In this way, even if a client is experiencing network latency, the other clients maintain a continuous playing environment. The more accurate the predictions, the less noticeable the effect of the synchronisation process on the lagging client when the network resumes normal operations. A latency-affected client will still receive the results of its actions with a delay, but the server will send the new game state before receiving the action from the client, effectively halving the wait time. Of course, it is possible to further mitigate the effects of this problem by implementing additional client-side techniques, for example Client Prediction.
When some controller data is lost, the process begins with the last correct game state being fed into the SPG-MDL’s Game State Demultiplexer, which deconstructs it into discrete Game Messages* ( ). To differentiate the Game Messages inside the “twin” game server from the ones inside the game server, the ‘*’ symbol is attached to the SPG-MDL Game Messages. Each Game Message* is then processed by its respective Engine AI, leveraging a Neural Network Model to produce a predicted Game Message* ( ). These predictions are assembled by the Predicted Game State Multiplexer into the predicted Game State ( ), which is then sent back to the game server for the next iteration of Game State computation.
While the SPG-MDL module operates, the server independently computes its updated Game State (GSt+1) using the available Client Data. The server utilises the predicted Game State as follows. If any Client Data is missing, the server uses the predicted game state to compensate for the missing data shortfall from one or more clients. Note that the online game server architecture is a reference model and that the three engines are not a requirement for a specific game applying the MPAI-SPG methodology. For example, some games may not have a Physics Engine because physical-based behaviour is not required.
SPG-MDL provides a 10-step procedure to develop an SPG-MDL that is applicable to any authoritative game server.
The first 4 steps are required to outline the game setup to enable informed decisions for the implementation of SPG.
- Select the game.
- Define the Entities (to identify NN Model parameters):
- Environment
- Human-controlled players (HPC) and Non-player characters (NPC)
- Define the Game State and relevant Entities.
- Design the training dataset.
- Collect the training dataset.
- Train prediction NN Models defining viable architectures and training parameters and comparing the training results of different architectures.
- Implement SPG-MDL.
- Evaluate SPG-MDL to select the model yielding the best predictions.
- Implement modules which simulate the disturbances.
- Evaluate the SPG-MDL-enabled game experience with human players.
For each of the ten steps, the Technical Report provides:
- High-level guidelines to outline the actions required.
- An example of how the guidelines are implemented using a car racing game (Figure 2).
Figure 2 – Modular tiles and an example of a racetrack
The game was developed using the Unity game engine, and the networking features implemented through the open-source game networking library Mirror.
The following components are provided:
- The car racing game.
- Four different categories of Agent Players trained using Unity’s ML-Agents library.
- The dataset used for training generated by simulating game sessions played by the Agent Players.
- Jupyter Notebooks for training experiments and results.
- The trained models used by the AI-Behaviour Engine.
The software is available online. Please contact the MPAI secretariat to access the repository. Details on how to use the material are provided in the repository’s README page.