I am working on a unity mobile game. Which is like a multiplayer version of temple run. Because this game is meant for mobile there is a fluctuating latency generally in the range of 200ms - 500ms.
Since the path is predetermined and actions the user can perform are limited (jump,slide, use powerup etc) , the remote player keep running on the path until it receives the updated state from its local player.
This strategy generally works pretty well since I only need to send limited amount of data over the network but there is a specific case in which I am having issues.
In the game, players die on the specific positions (obstacles).
I want remote players to die on the same obstacle/position as local player but due to latency in sending message, the remote player crosses the obstacle by the time it receives the death message.
Is there a way to sync the players on the deaths.
One of the things I tried was moving the remote player back to the local players death position but not only does it look awkward visually but can also raise other syncing issues.
Is there some other better way to do this ?
200-500 ms is way to much.
You will never be able to get that working smoothly.
With a latency like that you have a couple choices. You could delay the simulation on the receiving client so that any late messages can be handled before the player sees them, this is generally only an option if and only if it’s alright for the client to view an older state of the actual other client’s game.
Your second option to abruptly make the change in location during death but this will shatter immersion.
It really depends on what you’re willing to sacrifice.