We are developing a fast pace server authoritative multiplayer racing game, want to know following two things
- Is there any built in functions or example scripts to sync Unity’s Game object with other players in real-time? Usually, all other multiplayer framework have such kind of functionalities for example Photon has TransformView, RigidbodyView and Fishnet has Network View etc…
I also tried Fish-Game example to sync player object but’s it’s not real-time and lags.
- To achieve real-time syncing we need to know the communication lag and this requires a common time reference for all clients. So does Nakama Unity-Client SDK has some property or method to know the server time/ticks? Or any other way to calibrate/sync client time with server time?
Time accuracy must be in milliseconds. Creating RPC and fetching timestamp from server every time, will also add it’s additional delays. Let’s say if tick rate is 12 then fetching server timestamp via RPC 12 times/sec somehow doesn’t seem right and may cause bottle neck.
Hi, @surajTLabs! And welcome to Heroic Labs forum!
For 1, it is currently on our backlog a set of improvements on this kind of documentation. More users have similar questions.
For 2, you can find documentation about ticks here.
Also, I found a similar question that has been asked here in the forum and will probably shed some light on your specific Nakama usage: Multiplayer game with physics - #2 by novabyte
We have an issue in syncing the player position we tried the same logic in naked fish game and it does not working there is a lag the second logic we tried is store the initial position in a vector and when the player start moving store the new position and subtract the new one from the old one and we store this vector in a vector called direction then send that vector over a network in addition to the current position, in the remote player script we add the direction vector to the position that we have received the leap the current position to that added vector this worked the lag its gone but there is a delay
The component we have the navmesh agent component to move the player what we can do to solve this problem
The leap time we used for the receiver:
0.5 ==> the local player ==> 0.5
0.02 ==> the local player ==> 0.01
0.09 ==> the local player ==> 0.08