Network Transform desync after short rapid movement.

Hi, the network transforms desync and I cannot understand why. In the gif I attached you can see how after short movement, when the player stops moving, the other clients do not have the correct position. Sometimes after it has desynced, if you move it syncs again, but I don’t like that it desyncs at all. This happens only when interpolation is turned on. When it is turned off there is no desync.

9257772--1295178--Desyncing.gif

Still I tried the following:
Make it server authoritative, didn’t work. Checked all movement calculations if I have missed any addition of Time.delta time and the different FPS caused it to desync, but all include it. I removed the rigid body, maybe it’s the physics, still desyncs, the players in the gif do not contain a rigid body. I tried sending a small movement to the clients to force the transform to sync, but that also didn’t work, for some reason it updates in intervals and not move directly to the correct place. I also tried it in 3D (maybe there is some difference?), didn’t work either. Tried from different computers, with VPNs on and off (with relay). Still desyncs. Also tried LateUpdate, but doesn’t work either.

The player contains only a sprite renderer, network object, client network transform and a movement script.
This is the movement script of the player.

private float playerSpeed = 7f;
private Transform playerTransform;

void Update()
{
    if (!IsOwner) return;
    Vector3 moveDir = new Vector3(0, 0, 0);

    if (Input.GetKey(KeyCode.W)) moveDir.y = +1f;
    if (Input.GetKey(KeyCode.S)) moveDir.y = -1f;
    if (Input.GetKey(KeyCode.A)) moveDir.x = -1f;
    if (Input.GetKey(KeyCode.D)) moveDir.x = +1f;

    Move(moveDir);
}

private void Move(Vector3 input)
{
    transform.position += input * playerSpeed * Time.deltaTime;
}

I am using Netcode for GameObjects version 1.4.0

What I think is happening is the last few packets are not being sent or received therefore the clients desyncs.

I’m really confused why its happening and would greatly appreciate if someone can help me.

FIXED!
The setting Use Half Point Precision fixes it for some reason.

Try running the above code in LateUpdate(). If that doesn’t help, try replacing deltaTime with a constant value for testing.

You already figured out that the issue is related to interpolation. So it seems likely to be either a bug with Interpolation or a timing issue.

I’m not sure how to replace deltaTime with a constant value, can you give elaborate a bit more? Also lateUpdate doesn’t work, I tried before but forgot to mention it.

Just like this (or omit it altogether): :wink:

transform.position += input * playerSpeed * 0.016f;

Oh, I was thinking of something more complicated, didn’t work though. Thanks either way.

Okay update, just randomly decided to turn all of the settings on in the client network transform, last attempt before I give up completely. … Somehow it works now.
The setting Use Half Point Precision fixes it for some reason.
So yay :slight_smile: