问题
i'm creating a realtime multiplayer game in unity. i'm using this plugin : https://github.com/playgameservices/play-games-plugin-for-unity
i need to move a ball in field(ground).
i can send and receive message between two player. but i don't know which information should i send and when to send. for example i'm sending myObject.transform.position;
can you give me some ideas about syncing the ball's move in field?
回答1:
You can try sending the target position instead. Then when you receive this target position, you can try to interpolate from the current position to the target position. This will make the movement more smooth and less dependent on the network. Similarly, if your ball is fully based on physics you have to send velocity and acceleration over. But every few frames or so, you need to check if the position is too far away from the other screen and you may need to snap it back. For even more complex and dynamically changing motions, you have to do some prediction.
来源:https://stackoverflow.com/questions/23395185/how-to-move-object-in-real-time-multiplayer-google-play-games-plugin-for-unit