Godot Version
4.4.1 Stable
Question
I’m learning the basics of networked multiplayer and trying to implement a server-authoritative model with client-side prediction. Using the ENetMultiplayerPeer
, I’ve got a very simple scene that has some nodes the clients can move by sending their input to the server and then positioning the node on the client using the position calculated on the server, all with MultiplayerSynchronizer
s. This part is working great.
Now I’m trying to build out the client-side prediction in which I’d check the position returned by the server against a prior position on the client, but I’m having trouble understanding how exactly this would work. I understand the general concepts of retaining old positions/inputs on the client and checking them against what’s synced from the server, but I don’t understand how I should be handling the difference in positions due to the time it takes for the sync to come back from the server, or even when a new synced position is received from the server or how to determine what the lag between the client submitting input then receiving a valid position from the server is. Is there a signal or some other indicator I’m missing that already exists in the MultiplayerAPI
that I should be using?