in0finite / SanAndreasUnity

Open source reimplementation of GTA San Andreas game engine in Unity
https://discord.gg/p6jjud5
MIT License
2.15k stars 353 forks source link

Better vehicle sync #47

Closed in0finite closed 3 years ago

in0finite commented 4 years ago

Vehicle syncing is not good for local players (vehicle drivers).

Drivers should completely control the vehicle, and send it's current state (position, rotation, velocity, angular velocity) to server. Server will check these values, and correct them if needed. If there is no need for correction, he will just accept new state. Otherwise, he sends a packet back to driver, telling him to correct the state.

So, server will allow a certain difference between his state and driver's state. If the difference is small enough, he will accept new state.

in0finite commented 3 years ago

Syncing is fixed using rigid body's interpolation and by disabling wheel colliders on clients.

Fixed as of commit b7d11a770511863af03f8b69ee88dd9a0dd9e93b.