Best way for smooth client physics replication physics & hitboxes?

so i have a game that requires smooth physics and accurate hitboxes, since roblox’s server physics lags a little at the start and very “choppy” ive decided to make my own replication system, i tried two things:
first, running another ball on the client, this fixed the choppy movement part by taking the server ball’s cframe and velocity, however since client physics behave different to server physics, this is not viable. example:


(the half transparent is the server ball, the fully visible is the client replicate, both has network ownership set to the player but normally it will be set to the server)
ive tried teleporting the ball if it gets too far, but that would cause teleports “randomly” and can disrupt the gameplay significantly

second method: tweening, i have tried tweening the client ball to the server ball, it doesnt work for two reasons: first of all, the clioent ball is tweening to the server ball, which means whever the server ball teleports or “skips frames”, the client ball will have to accelerate to accomdate, which will also disrupt the gameplay. and second of all, the hitboxes can be inaccurate, since the client ball takes time to tween to the server ball, the server ball can be a few studs ahead, influcing the hitbox

please help im out of ideas :pensive:

1 Like

There’s many ways to do client replication for projectiles, a method I opt for is creating and moving the ball on all clients. You may worry about the difference between each clients ball but we can minimize those differences by using math.

-- Taking these values as examples
local character: Model = params[1] -- The person firing the ball
local spawnpos: Vector3 = params[2] -- Where the ball should be spawned at
local speed: number = params[3] -- The speed in which the ball is moving
local direction: Vector3 = params[6] -- The direction the ball will move at

local latency: number = workspace:GetServerTimeNow()-params[5] -- params[5] is workspace:GetServerTimeNow() since this would be sent over from the initial firing of the client
ball.Position = spawnpos
ball.Position += (direction*speed*latency) -- This calculates how much distance was made in the latency
1 Like

Im basically with the same problem :face_exhaling:

yeah i tried that, thats the first method in the original post, the problem is it de-syncs because the collision angles are different somehow on the client

it desyncs when it collides with something, not while flying

bump please help me :pensive:
charsss