Hi!
I will be grateful for any help, because I am just starting to master the NGO.
Initially, I used Network Transform to synchronize the player’s position on the client from the server side. But then I noticed that the client-side interpolation works with a huge delay (the final “synchronized” position of the player’s prefab was set 200-500 ms after it was stabilized on the server), even if the client and server are running on the same computer.
Then, at the moment of displacement on the server, RPC was called on the client with the parameter of the set vector, and in this case the client’s position responded almost instantly (<100ms).
From this, I concluded that Network Transform gets a new object position almost instantly (just like RPC), but then moves the object from the old position to the current one for a very long time and too smoothly.
Is it possible to set a “smoothness” or some kind of interpolation curve for NetworkTransform, or limit it to some time interval?
Thank you!
Yes, because interpolation interpolates “towards” the current position. It’s basically following the position the client already knows where the object is. It’s because of this I wouldn’t recommend using interpolation unless the smoothness of the movement is more important than the lag, for instance in slow-paced or turn-based games.
If you can, I would instead increase the Network tick rate from its default 30 Hz. Although this comes with an increase in bandwidth and CPU consumption which, if you want to host dedicated servers, means additional costs.
The real solution isn’t yet available in NGO: client-side prediction. The client can assume the object keeps moving in the direction it was moving last frame and applies that movement, with corrections from the server-side. This is rather elaborate to implement and perhaps we’ll have this in NGO within a year or so anyway.
Note that if you use Relay the communication always routes through the Relay server, adding a corresponding latency even in local tests.
1 Like
Thanks for the quick response!
At the moment, I have already solved this problem by sending an RPC to the client with the current point, and following the client prefab from this point to the last one received from the server, this makes it possible to have a minimum delay (<100ms) and at the same time smooth movement It’s just that I was hoping that Netcode provides some kind of more elegant “out-of-the-box solution”.
Anyway, thanks a lot for your response, and to the Unity team for the wonderful tool they created for all of us!
Hmmm … this ought to be what interpolation does. Maybe try again? Perhaps you were observing a different issue initially.