How to deal with severe latency

My P2P game works fine when running with “average” network emulation, but if I crank up the latency to beyond bad at 200/500 and 10% packet loss wierd stuff starts happening. Lots of invalid references and so on breaking the game.

How do you deal with lag getting out of hand? How much lag should be taken into consideration when writing the code for your game? At what point does a player get disconnected from the game and is it acceptable to disconnect someone intentionally if they lag too much?

I am no expert by any means, but I will chime in on the questions I am comfortable answering.

You need to set a default value you feel is acceptable and work around it. You will not be able to cater to every network speed and connection.

It’s always acceptable to disconnect a player from a game when they are causing issues for other players. It is however and will always be frustrated for that particular player. Games like Counter Strike and Team Fortress have been doing it for years.

For the critical information like health and player location, you need to make sure it is reliable. This can be set per custom event.

2 Likes

A replicated variable is when it comes to bad connections actually much more reliable than a “reliable” RPC.

If the player with issues is missing a lot of reliable events the player will get dropped and if the player rejoin then the reliable RPC will never be received and you have a player that is out of sync.

Reliable RPC’s also have more overhead so if you use them a lot it will just give you more issues down the road.

Consider a replicated variable the safe option even for health and player location.