Developer diary

Dev Diary #2: Keeping Multiplayer Worlds in Sync

How player orders, shared rules, and short state summaries help multiplayer computers keep the same game world.

Contents
Two computers display the same strategy map; one has drifted borders, with a thin crack of light between them.

In brief: In MKA Engine's multiplayer model, each participant's computer calculates the world locally; player orders and short state summaries are shared over the network. The same starting game and orders should produce the same result. Computers can compare those summaries to detect when their worlds have diverged.

How can computers keep one game in sync?

A strategy game's world changes constantly: players issue orders, rules update resources, and events produce new outcomes. We wanted a consistent way to coordinate play without sending every change in the entire world to every computer. That requires each participant to calculate the same world using the same rules.

Share player orders, calculate the world locally

How orders move through lockstep

This approach is called lockstep multiplayer. Each computer starts from the same game state and receives the players' orders. A game step advances when the orders needed for that step have arrived from every active participant; each computer then applies the same rules.

Four surrounding screens show the same map around a central coordinating device; envelopes represent shared player orders.

The main information sent over the network is the players' decisions. Because each participant calculates its own world, the entire game state does not need to be sent repeatedly. This design depends on numbers and chance following the same rules.

Detecting divergence

At selected intervals, calculations are represented by short summaries of the world and compared between participants. A summary is a compact comparison of the game state, not the full world itself. If one summary differs, the engine reports the game step where the difference was found.

Two short world summaries made from map fragments are compared under a magnifying glass; one differing piece is highlighted in orange.

That comparison shows that the worlds are no longer the same; it does not, by itself, explain why. Consistent calculation and detecting a difference are two complementary steps.

What do state summaries reveal?

Lockstep makes it possible for each computer to calculate the world locally while participants share their decisions. They can compare short summaries at selected steps. This article does not present measurements of network traffic, latency, or speed against another multiplayer approach.

Why share decisions instead of the whole world?

In a strategy game, having each participant calculate its own world means sharing decisions instead of continually sending the whole state over the network. This keeps the common game rules and player orders aligned.

Network delays and diagnosis limits

A game step needs orders from the active participants before it can advance; a slow connection can delay the group. A difference in the state summary detects divergence, but does not by itself identify its cause or repair the world.

Organizing game data in memory

The next diary explains how we organize large amounts of game information in memory for calculations. After that, we look at the order of work in a game step.

Is the entire world sent to every computer?

No. In this model, participants share player orders and short state summaries for comparison; each computer runs the simulation itself.

What does a different world summary show?

The game states calculated by participants have diverged. The summary reports the step where a difference appears, but does not explain its cause on its own.

Does this approach remove connection problems?

No. A step waits for the active participants' orders; a slow connection can affect the group's pace.

Sources and related docs

You may also like

  • How is a strategy game's world map made?

    For MKA Engine we built a 27,357-location world map of 1337 from real data: how terrain, rivers, straits, population and location borders were made.

  • The road to a game engine

    How we started MKA Engine: reading four games, treating determinism as law, moving phase by phase with measurements, and where we are now.