Hi everybody. I’m making basic multiplayer shooter in 2D with model in 3D for my studies with a authoritative server . Actually i try to go over the client prediction to have smooth movement in the client-side. So what i basically doing is to apply the same movement logic in the client side while the server apply it’s own movement logic and correct the client-side position with the server if there is too much difference. But i’m facing a big problem. The gravity is not apply on the same way in the server-side and the client-side i mean the client-side for example jump a little bit less than the server-side. And that apply a big desync between the two. I try to figure out what can happen and i think the problem is the frame-rate. I use a character-controller for the controller with my own implementation of the movement logic the script is the same for both client and server. So i try to understand how to be fully fps independent.
Actually this is how i calculate the gravity movement.
verticalSpeed -= gravity * Time.deltaTime; // apply the gravity
Vector3 movement = new Vector3 (
horizontal * trotSpeed,
verticalSpeed,
0);
movement *= Time.deltaTime;
collisionFlags = character.Move(movement); // apply the movement
What’s wrong with the short part of code why the server jump a litle-bit more than the client. Did i make a big mistake on the way i calculate my gravity ?
Thanks in advance for the response.