Hello!
I want to make an online game using libGDX and kryonet. For the last two days I have been studying all sorts of concepts for creating online games. Server reconcillation, Interpolation between two states on the client side are understandable to me now. But there are two things that I don’t understand to the end.
The first is the lag condensation. To quote Gabriel Gambett https://www.gabrielgambetta.com/lag-compensation.html:
-
When you shoot, client sends this event to the server with full information: the exact timestamp of your shot, and the exact aim of the weapon.
-
Here’s the crucial step. Since the server gets all the input with timestamps, it can authoritatively reconstruct the world at any instant in the past. In particular, it can reconstruct the world exactly as it looked like to any client at any point in time.
-
This means the server can know exactly what was on your weapon’s sights the instant you shot. It was the past position of your enemy’s head, but the server knows it was the position of his head in your present.
-
The server processes the shot at that point in time, and updates the clients.
Ok, basically everything is clear. But this moment: "Since the server gets all the input with timestamps, it can authoritatively reconstruct the world at any instant in the past. In particular, it can reconstruct the world exactly as it looked like to any client at any point in time.". I do not understand how to implement this. Clients send timestamps to our server along with events. But after all, clients clocks are not synchronized. How can I understand from a given timestamp what state I should roll back the world to? I can only roll back that particular client, right?
Ok, my second question is how to implement animation over the network? My game will use regular sprite animation (Animation class from libGDX). It is clear that it is impossible to synchronize it between two clients. But how do I interpolate the animation of another client? What data should be transmitted over the network for this?
Thanks.