The Mitigation of Data Loss Effects project
The Technical Report Server-based Predictive Multiplayer Gaming (MPAI-SPG) – Mitigation of Data Loss Effects (SPG-MDL) V1.0 describes how a game server can use Machine Learning to predict the Game State when data from some players is late or missing.
In an online Authoritative Multiplayer Game, each player’s client sends Control Data to a server. The server updates the Game State with the data from all clients and broadcasts it back to them. When a client’s data arrives late or not at all, because of Latency or packet loss, the Game State no longer describes a correct and consistent situation. The usual remedies each have a drawback:
- Client Prediction causes perceptible delay.
- Time Delay reduces responsiveness.
- Time Warp disadvantages the other players.
SPG-MDL moves prediction to the server, so that all clients receive the same, continuous Game State.
The Reference Architecture
SPG-MDL operates alongside an authoritative server. That server computes a new Game State at every time step from the Control Data of all players. Its Game State is made of Game Messages produced by three engines:
- Behaviour Engine, orchestrating the actions of players and non-player entities.
- Rules Engine, ensuring adherence to the game mechanics.
- Physics Engine, handling physical interactions in the game environment.
SPG-MDL is a “twin” of the Game Server, an AI Workflow of five AI Modules (AIMs):
- Game State Demultiplexer, which breaks the Game State into its Game Messages.
- AI-Behaviour Engine, which predicts the output of the Behaviour Engine.
- AI-Rules Engine, which predicts the output of the Rules Engine.
- AI-Physics Engine, which predicts the output of the Physics Engine.
- Predicted Game State Multiplexer, which assembles the predictions into the predicted Game State.
Each AI Engine is a trained Neural Network model. The three engines are a reference model, not a requirement: a game without physically based behaviour need not have a Physics Engine.
Main Functions of SPG-MDL
SPG-MDL enables the following functions:
- Prediction – Forecasts the next Game State from the current Game State and players’ Control Data.
- Compensation – Supplies the predicted Game State when Control Data from one or more clients is missing.
- Validation – Lets the server use the prediction when its own computed Game State differs too much from it.
- Continuity – Makes a lagging player appear to the other players to play continuously.
- Delay Reduction – Sends the new Game State before the lagging client’s action arrives, which the Report says effectively halves that client’s waiting time.
Using the prediction to detect cheating, by comparing it with the server’s Game State, is possible but not considered in V1.0.
Operation Model
At every time step:
- The server feeds the current Game State to the Game State Demultiplexer.
- The Demultiplexer splits it into Game Messages, one for each AI Engine.
- Each AI Engine predicts its Game Message for the next time step.
- The Predicted Game State Multiplexer assembles the predictions into the predicted Game State.
- The predicted Game State is returned to the server.
- The server computes its own Game State from the Control Data it received. If any Control Data is missing, it uses the prediction instead.
The computed and predicted Game States have the same format, so the server can use either without conversion. Because SPG-MDL runs only on the server, clients remain free to add techniques of their own, such as Client Prediction.
Powered by the MPAI AI Framework
SPG-MDL is specified as an AI Workflow of AI Modules, executable in the MPAI AI Framework (MPAI-AIF), which provides:
- A modular and interoperable execution environment for AIMs.
- Configuration and orchestration of AIMs in an AI Workflow.
- Platform-independent implementation.
Each AI Engine can therefore be trained, improved or replaced independently of the others.
Reference Software
The Reference Software is released under the BSD-3-Clause licence. It is a working implementation of SPG-MDL, not a ready-to-use product. It includes:
- A car racing game developed with the Unity engine and the Mirror networking library.
- Four categories of Agent Players trained with Unity’s ML-Agents library.
- The training dataset, generated by simulating game sessions played by the Agent Players.
- Jupyter notebooks with training experiments and results.
- The trained models used by the AI-Behaviour Engine.
It is available, after registration, at https://experts.mpai.community/software/mpai-spg/car-racing-game/.
Open and Flexible Design
SPG-MDL follows key design principles:
- Server-side only. No change to the clients is required.
- A twin of the game’s own engines. The prediction mirrors the structure of the Game State.
- Engine-independent. Games use only the AI Engines their architecture needs.
- The server keeps authority. The prediction is used only when data is missing or the computed state is implausible.
Benefits
SPG-MDL will support:
- Game developers to keep multiplayer games consistent under poor network conditions.
- Game operators to offer a smooth experience to players with different connection qualities.
- Players to enjoy responsive and fair gameplay even when some participants lag.
- Researchers to explore Machine Learning for Latency mitigation, an area only recently investigated.
A New Paradigm for Multiplayer Gaming
SPG-MDL promotes a shift from client-side workarounds for Latency to:
- Prediction performed once, on the server, for all players.
- Game States that stay continuous and shared when data is lost.
- Machine Learning models trained on the game’s own behaviour.
- A basis for detecting cheating by comparing predicted and reported play.
Conclusion
SPG-MDL V1.0 describes a server-based predictive approach to multiplayer gaming that:
- Predicts the Game State with Neural Networks twinned to the game’s engines.
- Compensates for missing or late Control Data.
- Keeps gameplay continuous, responsive and fair for all players.
- Is demonstrated by open Reference Software.
The Report opens the way to multiplayer games that remain consistent whatever the network conditions.