- Home /
Transform network views and dead reckoning
I think maybe I'm misunderstanding something in the documentation about Unity's built in networking. I plan to make a networked game which uses dead reckoning, however the documentation seems to suggest that syncing is automatically done when using network views that watch transforms and state synchronization. It then later suggests that prediction/dead reckoning algorithms be used.
Is there some extrapolation/predictive model already built in to Unity's networking or am I just misunderstanding something? I can't seem to comprehend how I would implement dead reckoning with network views if the network view is already dictating how and when the transform is updated. Or perhaps I'm misunderstanding the "state synchronization" functionality? Does this literally mean that transforms are synced between server and client, or does it mean that the state of the network view itself is synced leaving it up to the developer to decide how to utilize the information on the network view to update the actual transforms?
Answer by david.almroth · Aug 31, 2011 at 02:21 PM
You can save the state sync you get from the server and use it for extrapolation and interpolation = dead reckoning.
This can be done by implementing the callback OnSerializeNetworkView() in a script and put some code there to send/write the postion (from the sender) and receive/read the position (in all clients) for the prefab. Add the script to your prefab and attach a networkView to the prefab. Change the network view observed property to your script.
Now it is up to you to code a nice logic that you can call from the update() method to use the stored statesync and make a smooth movement for the game game based on the stored statesync. Remember to check the timestamps of the statesyncs to make a good algorithm that can handle lost messages.
Good luck!
That didnt really answer for me. So does that mean unity handles interpolation dead reckoning etc for you when the network view is attached to a transform ins$$anonymous$$d a script ??