How should I handle network latency for a multiplayer action game?

I’ve looked into this topic over the past few months, both on the developer hub and outside-- it’s still a difficult concept for me to fully wrap my head around, so apologies if this seems redundant or obvious. I still can’t decide what the best way to tackle network latency in multiplayer action games would be, so I figured I would ask here. If there’s any comprehensive tutorial about this topic as it pertains to Roblox, please link it in the thread!

I’ll be using 2 examples for this: Imagine a player can use a projectile fireball attack and a melee lunge attack. Hit detection is done on the client for unimportant effects (like hit particle effects and sounds). Hit detection and hit validation are done on the server for important effects (like a player taking damage and dying). Should important server-side effects (player taking damage/dying) be simulated on the client and corrected from the server afterwards, or should there just be a delay as the server sends out the accurate information to clients?

The aforementioned projectile fireball attack has a 0.3 second buildup delay between the input request and launching the fireball. The player can still move around during this buildup. The projectile path is dependent on where the player is standing and where they are aiming with their mouse at the time of the fireball launching. Network latency means that the projectile path cannot be calculated until the data for the path (mouse aiming) is received from the player, which means the server’s projectile path would need to be a little bit behind the client’s projectile path. The fireball on the server’s projectile path can start a little bit farther down the path to compensate for this. Is this the best way to go about doing this?

The melee lunge attack is instant and launches the player forward with their sword aimed straight out. Everyone that the sword touches during this lunge period is hit. However, due to the fast nature of the attack, wouldn’t this be very inconsistent in terms of who the client hits and who is actually hit on the server? Would it be possible for this attack to be replicated accurately (and if so, how)?

Is there a way to address these issues without changing the attacks themselves? If not, what could I change about the attacks without compromising their intended actions too much? Are there any other nuances I should be aware of when dealing with network latency in action games? What about exploiters and players with high latency? Again, a comprehensive tutorial on all this as it pertains to Roblox would probably help my understanding the best, if anyone happens to know a good one.

1 Like