im making a tennis game and having a bit of trouble syncing physics on all clients
were handling the hitbox for the racket for each client separately on their client, calling a function to apply impulse to the ball with calculated vector, then we send that vector to the server, send the vector to all other clients to apply impulse on the same ball. But theres alot of delay and desync. We tried sending the starting pos of the ball on the first client to set it on all other clients before applying impulse, but it got kinda unsmooth
anyone got any better idea?
so, the client is telling the server what velocity to apply to the ball, at which point the server fires all other clients, telling them to replicate this velocity?
assuming this is how you handle ball physics, you could put all of this in a heartbeat function run on the server, which would probably be a lot more secure and less “tangled up”
Hey,
Thanks for replying.
I tried putting it on the server and it would be really choppy when applying impulse as if it was lagging.
to counter this, i tried setting network owner to the player who spawned the ball but that provided another problem: It would be really smooth for that one player, but I handle racket hit detections on every client separately, so for all other clients they would have to swing really early when the balls not even gotten to them yet.
i completely forgot about that (whoops, sorry)
i found a post from a quick google search, hopefully it will help you