Lag Compensation issue

Hello, I have an issue with the lag compensation. I tried following the guide but i couldn't get it to work. I'm fixing someone else's poorly written code, here's the script,

https://pastebin.com/sTJ1MGnL

Basically there's some weirdness with the rotation, I got the position syncing fairly well. Weirdly, i had it working before, but it broke. So, the "GetTargetRotation" method is just getting the joystick's input, or if it's keyboard, returning the rotation value which is just being increased or decreased with key presses... if it's another player, it moves towards the rotation on the network, and then setting the rotation to whatever that is.

I tried making it set the angular velocity, and set the rotation directly, but it made it look real choppy with like 1 second lag between two clients.

Forgot to mention, I'm using a transform view as well, idk if I should be haha, it was really choppy looking when i wasn't.

Does anyone know what I'm doing wrong here?

Thanks

Edit: I added the updated script, it's working better now, a little bit of weirdness and jittering... But, physics is a complete mess lol, if two ships crash, they will not sync properly, even despite the transform view, and the movements on the screen that crashed will be weird and janky.

Answers

  • We can't analyze that script for you. Synchronization and physics are not easy to keep in line and much less so without the concept of time steps (network ticks).

    We read positive feedback on Smooth Sync from the Asset Store. Maybe that helps?!

    Aside from that, we'd recommend Fusion for projects that use physics in game relevant ways.

  • Okay. I'm sorry, how come you can't analyze it? Only this line gets input from another script,

    movement.GetTargetRotation()

    Which is just simply getting input from a joystick or from the keys which add or subtrack a "rotation" value. I just thought you could give me some advice if I was implementing the lag compensation incorrectly or something.

    I can't really afford that Smooth Sync at the time, but what is Fusion?

  • We simply don't debug code unless we think it's a bug in PUN. It's out of the scope for free support, as we simply don't have enough time for that. Also, the solution often depends on what you need to achieve.

    Fusion is our new networking solution.

  • I mean, I wasn't asking you to fix my code, just help me figure out what I was doing wrong with the lag compensation. Isn't lag compensation somewhat related to Photon? I don't know, maybe I didn't follow the Photon guide correctly, which is why I showed it. I don't fully understand lag compensation.

    Thanks for the link, though. I'll have a look at it later.