Players control an object by giving WASD inputs, which fires a remote to the server and moves the object accordingly to the cardinal directions. It’s pretty simple really. HOWEVER, I am very aware the inputs are significantly delayed because the physics is not directly ran on the client.
I am looking for a way in which on the client’s screen, the object moves without delay while on the server still moving the same way as it would, like on the client.
I have tried to workaround by implementing NetworkOwnership and all that stuff, but another thing to note is that there are physics-based collision between objects. Meaning that if the objects were to belong to the client, it would be way too delayed and glitchy for a collision.
My thought is that I can ‘conceal’ the input delays by moving the object client-ly, but still have server handle movement and collision. However, simultaneous movement on the client and server can conflict, so I’m not sure whether the client will see its own movement or the delayed server one.
I can match the server-side object by pulling off sneaky extrapolation thingy later, but that’s not the main problem right now.
--Client (writing code on the top of my head)
local function keyPressed(w,a,s,d)
ServerMove:FireServer(w,a,s,d)
end
--Server
ServerMove.OnClientEvent:Connect(function(plr,w,a,s,d)
moveBy = convertToXYZ(w,a,s,d)
object.Velocity = moveBy
end
local function Collision(o1,o2,magnification)
o1.Velocity = (o2.Position - o1.Position).Unit*magnification
o2.Velocity = (o1.Position - o2.Position).Unit*magnification
end
Yeah, velocity is deprecated, but using a bodymover feels unnatural for some reason because it’s not smooth/too slow.
I’m open to suggestions because I’m sure they’re better than anything I could think of right now. Hopefully I’ll wake up to see potential solutions tomorrow