Skip to main content

Multiplayer

One server owns the match. Players' games send orders and cast requests; the server decides what happens and replicates the result. To make the game feel instant all the same, a player's own game predicts its champion's movement, the start of its casts and the start of its basic attacks. The server can be a dedicated server or a listen server, where one player hosts and plays; the rules are the same.

Who decidesWhat the player's own game does meanwhile
MovementThe server replays every move with the champion's real speed and collisionMoves at once; corrected when it disagrees
Starting a castThe server checks rank, cooldown, mana, crowd control, target and range on its own stateStarts the cast at once: cost, cooldown, the cast time, a skillshot's projectile
A dash, a blinkThe server makes the same move from where it has the championMoves at once
A basic attackThe server checks the target, the range and the time since the last attackStarts the wind-up at once
Hits, damage, heals, crowd control, healthThe server aloneNothing. It sees them when they replicate, and only for the units its team sees
Ranks, levels, XP, gold, death, respawnThe server aloneNothing

Movement​

The player's game finds the path and moves on the frame of the click. The server checks each move. When they disagree, the server sends a correction, and the game replays the moves the server has not seen yet. A correction under 50 cm is blended in over 0.15 s; a larger one snaps. A game cannot move faster by changing its own numbers: the server moves the champion at the speed the server has.

Move speed changes are the server's, as every effect is: a slow or a haste reaches the affected player's game a moment after it lands, and the server corrects the difference by a few centimeters, which the blend hides.

Blinks travel with the move they are made in, so client and server never disagree about when the champion jumped. The server takes the client's landing point if it is within the Blink Agreement Distance of its own. Dashes are the engine's root motion, which both sides apply; if the dash's start arrives late, the server holds off its corrections for up to the Dash Wait Time and catches up to where the client is along it.

Property (on the champion's movement component, MobaChampionMovementComponent)Default
Smooth Correction Max Distance50 cm
Smooth Correction Time0.15 s
Blink Agreement Distance100 cm
Blink Wait Time, Dash Wait Time0.4 s, 0.4 s

Casts​

A cast request carries the point the player aimed at and, for an ability cast on a unit, that unit. The server checks both against its own state. For a skillshot it uses only the direction: the projectile starts where the server has the caster and flies the definition's Range. A cast on a unit or a point beyond the ability's range is refused.

  • Confirmed: the server launches the real projectile. When it reaches the caster's game it replaces the cosmetic one, starting where that one is and giving up its lead over 0.25 s (Handover Blend Time, on the projectile class), so the player sees no jump.
  • Rejected, for example because the caster was silenced a moment before: the cosmetic projectile goes, and the mana and the cooldown come back, one round trip later.

Projectiles do not replicate their movement. The server sends the launch once, and every game draws the flight from it.

Wait For Server​

When the server refuses a predicted cast, the player's game has to take back what it showed. For an ability where that would be ugly, such as an ultimate with a long animation, tick Wait For Server in its Ability Definition. The caster's game then shows nothing until the server's confirmation arrives, a round trip later, and runs its side of the cast then, with a cast time shortened by the half round trip the server is ahead. A refused cast simply never shows. A dash or a blink that waits for the server moves a round trip after the key press, which a player feels; the editor warns about that combination. In an ability of your own, Is Predicted Cast tells a predicted cast from one that waited.

A charged ability sends two messages: the press starts the cast, and the release carries the aim and how long the key was held. The server never takes a charge longer than it saw itself.

What a team does not see​

With a Fog Of War Volume in the map, the server sends a team only what it sees: an enemy hidden in the fog or the brush does not exist on that team's games (see Fog of war and vision).

  • A champion's health, mana and effects live on its player state, which every player has, so UMobaHiddenStatsSubsystem keeps them back too: they go to the champion's owner, its team, and the other team only while that team sees the champion. When the champion comes into sight, its current health and effects arrive with it. The setting Moba.Net.StatsFollowFog turns this off; it is read when a world starts.
  • Gameplay Cues of a champion travel through the champion, so only the players whose team sees it get them; see Effects and animation.
  • Gold, the summoner spells' cooldowns and the gold earned on the scoreboard go to the player, their allies and replays, never to the other team (UMobaTeamPrivateState on the player state). Put anything else only a team may know into the same object, or into an object of your own in the team's net group (MobaNetGroups::TeamBlue, TeamRed).
  • On a client, an enemy champion's tag events (RegisterGameplayTagEvent) stop firing once it has been hidden and come back, although its tags are right. Read an enemy's tags when you need them rather than by tag events. Your own team's champions are never hidden from you.

What replicates how​

Minions and monsters replicate 10 times a second, as a compact position, a target and health, and are interpolated about 100 ms behind the server. Projectiles replicate once as a launch. Structures replicate their state. Tuning the replication priorities and rates at full 5v5 load is part of 1.1.

Reconnect​

A player who drops out of a running match can come back and take back their champion with everything intact.

  • While they are away, their champion stays in the match, idle and killable; nothing is sold or removed. Their team still sees through it, passive gold and XP still come in, and a dead champion respawns. The surrender vote counts them as disconnected.
  • Coming back, the server matches the same unique net id, or the rejoin key it gave the player when they joined (AMobaPlayerState::GetRejoinKey, sent only to that player). The player gets back their player state: champion, level, gold, items, ranks, cooldowns (which kept running) and score. Another account cannot take the place. A player whose game crashed may come back before the server has noticed: the new connection takes over from the old one.
  • On the player's side, the front end notes the match while the player is in it, in their settings file (section PioneerMoba.Rejoin of GameUserSettings.ini), so a game that crashed offers it when it starts again. The main menu then shows a Match in progress banner with Reconnect and Abandon.
  • Before the match begins, while players load, a player who leaves frees their seat: reconnect applies only to running matches.

Project Settings > Pioneer MOBA Framework > Networking: Keep Champion On Disconnect (on), Reconnect Timeout (0: until the match ends) and Reconnect Load Timeout (120 s: how long the way back may take before the player is back on the menu, with Reconnect still offered).

A listen server​

The same match runs as a listen server, where the host plays too. The host is the server, so its own champion needs no prediction: its orders and casts take effect at once. Every other player predicts as on a dedicated server. A host runs the match at its own frame rate; the 30 ticks a second of NetServerMaxTickRate apply to a dedicated server. Practice and custom games hosted from the main menu are listen servers.

Settings the plugin makes​

SettingValueWhy
net.Iris.UseIrisReplication1The framework replicates with Iris
net.SubObjects.DefaultUseSubObjectReplicationList1Iris needs it
bAllowClientSideNavigationTrueThe player's game finds its own path, so movement starts at once

The plugin's config is applied after your project's, so these win over your project's DefaultEngine.ini. To change one, edit it in a copy of the plugin in your project; see Change the plugin's config. Iris alone can be switched off for one run with -UseIrisReplication=0 on the command line.

A dedicated server ticks 30 times a second, the engine's default NetServerMaxTickRate, and the framework is built and tested at that rate. Your project's DefaultEngine.ini can change it.

Tested this way​

The framework is tested on a dedicated server and on a listen server with two or more clients at 100 to 150 ms of latency and 1% packet loss: the champion moves one frame after the order, client and server agree within 5 cm after a 20 s walk, a client walking at twice its speed gains nothing, a rejected cast leaves nothing behind, a hidden champion's cues, health and crowd control never reach the other team, a whole match is won by a core kill, and a dropped player reconnects to the same champion.