- Home /
Does the position change need state synchronization?
In my multiplayer game, I need to synchronize the patrolling enemies' positions in all clients. These position changes are written by script, not by players' controls. I tried to make State Synchronization to their positions, and I found it was acting like they were jumping/poping from one point to another, like I was running in pretty low frame rate. (However the movement in local is quite normal.) No matter I used Unreliable or Reliable Delta Compressed, it was the same.
So I wonder, what would be the right way to handle such position change? Is it a wrong way to use State Synchronization in this case? Thank you very much.
Answer by Bunny83 · Jun 17, 2011 at 04:04 PM
Make sure the enemies are only controled by the server. If your "AI" script is also enabled on the clients it will move on it's own and the position gets frequently overwritten by the server updates.
You are correct! Thank you,Bunny83! Thank you everyone!
Answer by Anxo · Jun 17, 2011 at 03:33 PM
you could state sync a variable and then have the enemy lerp to that variable.
Yeah, if the difference is small you should just guide him towards the correct position. If it is big, however, you may choose to actually teleport him or have some clever way of fixing it.
I did. I just synchronized a Vector3, not the whole transform.
@Joshua: Thanks. Actually it was not the position deviation. It's more like they're shaking.
Your answer
Follow this Question
Related Questions
get return on networkView.RPC 1 Answer
NetworkView Control 2 Answers
Sending info to/from different networkViews 1 Answer
Unity NetworkViewID Collision problem 0 Answers