Game Engines & Real-time Multiplayer

Why real-time multiplayer games should let the server decide: how we built our MMORPG server

Server-authoritative results, client prediction, shared combat formulas and 30-second reconnects in our in-house 2.5D mobile MMORPG — and the tests that guard every rule.

·3 min read

The two most common problems in multiplayer games are cheating and desync. Damage hacks, speed hacks and wall-walking all come down to one thing: the client decides the outcome. Two players seeing different results of the same fight comes from each side doing its own maths.

Our answer is simple: the server calculates every result; the client only says what the player wants to do and plays back what happened. Here is how that works in our in-house 2.5D mobile MMORPG.

The client only sends intent

When a player presses a direction or casts a skill, the client doesn’t send “I moved here” or “I dealt this much damage”. It sends:

  • Move intents — which direction to go, each one numbered in sequence.
  • Skill requests — which skill to use on whom.

The server runs the whole world on a fixed tick: movement, casting, hits, damage, buffs being applied and expiring, monster aggro and pursuit. It then sends the results to the players who can see them. The client plays back what it receives and has no say in the outcome.

For responsiveness: client prediction, server correction

If every step waited for the server, the game would feel sluggish on any slow connection. So the client predicts its own movement locally and corrects it when the server’s result arrives.

A few details make or break how it feels:

  • For haste, slows and stuns, the server sends the current move speed and status along with everything else, and the client predicts with those values — so it isn’t constantly snapped back.
  • For dashes and blinks, the server sends the new position at the moment the skill resolves, and the client jumps there immediately rather than treating it as an error.
  • While stunned, the client simply stops sending movement and greys out skill buttons, so players aren’t left making moves that will be rejected anyway.

Write each formula once

If the damage formula exists once on the client and once on the server, they will drift apart sooner or later: the screen shows 120, the server takes 118.

We put protocol code, combat formulas and configuration models in one library shared by client and server, so both use the same formula. The network protocol has a single source — one .proto definition plus a message-ID table — from which both sides’ code is generated. Game values are exported from design spreadsheets as versioned configuration snapshots, so balancing doesn’t require code changes.

A dropped connection isn’t a disconnect

Mobile networks are unreliable by nature. Our rules:

  • When a connection drops unexpectedly, the character stays in the world for 30 seconds, standing in place. Health, buffs and the downed timer keep running, and monsters can still attack it — so dropping the connection can’t be used to escape a fight.
  • Coming back with the same character within 30 seconds returns the same entity — same position, facing, health, buffs and downed state — and the server resends a full snapshot.
  • The client retries immediately, then every 2 seconds for up to 25 seconds, always inside the server’s 30-second window.
  • If the same character logs in elsewhere, the old connection simply gives way; there are never two copies.

Tests that guard every rule

With many combat rules, changing one can easily break another. Our approach:

  • Every rule has a test — buff stacking and expiry, the order shields absorb damage, stuns interrupting casts, back-attack bonuses, going down and being revived…
  • Deliberately break a rule and confirm the test fails. A test that can’t catch a bug isn’t a test.
  • Automated smoke tests — a script drops the connection on purpose and checks the character comes back within 15 seconds as the same entity, in place (within 30 cm).
  • Two-player tests — two clients connect to the same server and actually play through “one player goes down, the other revives them”.

The same principle in every game

It isn’t just the MMORPG. Mahjong, Big Two and Dou Dizhu in the MacePlay game lobby work the same way: shuffling, dealing, checking whether a play is legal and deciding the winner all happen on the server and are logged; the client only handles visuals and sound. Results can be audited, and tampering with the client doesn’t help.

Our games ship on iOS, Android, Windows, H5 and LINE.

For heroes, monsters and the world, see Game Engines & Real-time Multiplayer.