Best way to implement client prediction while keeping things consistent?

hello, currently creating a party game that involves a ball but im simplifying it by avoiding physics and its working the way I want the gameplay to play out but there is an issue, delay.

Basically my current setup right now is when the player hits the ball, a remote event is then sent, and when the server receives it the clients do the movement, and this works perfectly but the issue is I want the feedback for the player to be instant though while still having things be consistent across all the clients

Heres just a bit of visual

1 Like

You could have the client continue to simulate movement without waiting for the server to fire back to it

1 Like

Oh goodness, I’ve been looking for a four square game for a very long time. Good luck!

Anyways, The server should not control any animating. Just have the server send a message to every other client besides the main player. The animation plays instantly for the main client, but it might be a little delayed for the others.

1 Like

So basically I’ve done client prediction by simply just having the client that hit the ball see it instantly and then I send a remote to the server informing it about the hit and then all the clients do the exact same hit with the same parameters at the time of the hit,

I also did something a bit different to compensate for lag which is since the ball uses animations I can use workspace:GetServerTimeNow() and account for the latency and have the other clients start the animation smoothly at whichever frame it should based on how much latency there is

I think its working SUPER good for now but I’ve tested most cases and it seems to be holding up pretty well, it does help that the game is pretty deterministic with the animations despite them being able to be scaled by the power bar!

@Chiseled_Cheese Thank you for your suggestion!

1 Like

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