Devlogs

Back to devlogs

Lag Happens

A large part of the development effort for Overrunners is spent on multiplayer replication. For anyone who is unfamiliar with this, it is how multiplayer games synchronise what happens on the server with what players see in their game, and ensures players see other players doing things like firing a weapon, jumping, opening a door etc.

To keep all players in sync, we could just replicate everything from the server. Say a player scrolls through their inventory to equip different weapons - other players will also want to see which weapon that player has equipped. So that player could call a function on the server, which then replicates which weapon they have equipped to everyone. That would seem straightforward (if you are familiar with replication), but what happens if that player has a slow connection to the server? They will experience a delay between switching weapons. This would feel even worse if they were trying to fire a gun and waiting for the server to respond.

To mitigate this delay, where possible, actions are performed client-side (local to the player that performs them) before they are sent to the server to replicate to other players. This gives the players a more responsive feeling experience even with network lag. Of course, they will still have to wait for the server to do things like verify that they did shoot the thing they were aiming at, but that has to run on the server to avoid cheating! Animations like the gun firing, and impact effects, can still play straight away for the player.

Attention is being placed on ensuring that the game doesn’t just work, but that it also works as smoothly as possible, particlarly when there is network lag.