Validating Client-Side Prediction with MultiplayerSynchronizer

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 MultiplayerSynchronizers. 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?

Nothing exists in tha api.

You will be extrapolating on the client side so you need to only apply server state if the client sync error gets to far off.

There needs to be some time information synced with each packet, and this time needs to be accurate between the client and server.

And you will need to buffer sync states so you can keep track of input acknowledged by the server.

You should checkout the NetFox implementation for inspiration although i think they gave up on propper physics syncing which is what im working on for own project. There are some good links for research in there as well.

1 Like

Ahh, I see, thanks for the info! Looking at the Netfox codebase (which is impressively well-commented, wow), I can see how they’re basically writing their own version of the sync nodes and similar tools to get the kinds of functionality I’ve been thinking about, which makes sense.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.