- Home /
Networking State Synchronization Question
Hey guys again, I have a quick question. I'm developing a game with basic LAN functionality, using State Synchronization for players who are constantly in motion. Is there any way to combat the choppiness of the player movement across the network? Something akin to prediction on authoritative models? (My model is non-authoritative btw)
Thanks in advance!
Answer by Agustin Petrini · Mar 25, 2011 at 03:26 PM
If you mean the owner player you should:
- Move the player locally.
- Send the packet to the server.
- Process movement in the server and replicate to clients.
- On owner client linear interpolate between the server position and the local postition.
You should take a look at the networking tutorial for an example on how to do it.
I'm working on an authoritative model right now and I'm dealing with this exact same problem but in regard to AI and non auth clients. I've read somewhere that there's a technique where you delay the world time a bit to make the player not feel the lag, but I can't find any docs on it.
Another thing I'm thinking is to have the AI working not only on server but on clients as well and use the same techinque used with the owner. But not really sure about this.
Answer by AnotherYeti · Jul 24, 2011 at 12:24 AM
Look in this networking example.
The file GraduallyUpdate.cs has an example implementation of an updating position for other players. The code should be the same whether it's an authoritative server or not; an authoritative model only makes a serious difference in local player movement code.
Your answer
Follow this Question
Related Questions
A better way to do jumping? 2 Answers
Choppy Camera Follow 1 Answer
[UNET] Arbitrary movement on client side. 0 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Unity + PHP networking movement sync 0 Answers