Quantcast
Channel: Questions in topic: "online game"
Viewing all articles
Browse latest Browse all 36

A problem in implementation mirror networking in my multiplayer game

$
0
0
Hello I'm making a new game like [Soccer stars][1] using Unity and Node js now. I use [Socket.IO][2] plugin for sending and receiving information to the server. To move [pieces][3] and ball online on both phones I send a Vector3 that represents the power of the shoot and on the other phone receive this Vector3 from the server and I use AddForce(Vector3, forcemode.impulse) function to apply the force. This method works well up to 7-8 first strokes also the pieces and the ball will place in the same position on both phones but after that their position isn't the same on both phones. for debugging I print the Vector3 position of the pieces after each stroke and see the pieces' positions are not the same number on both phones after 4-5 first strokes. for example, the Y position of the first piece on the first phone is 8.4326f, but on the second phone, it's 8.4321f. Can anyone help me to solve the problem and found the bug? note that I print the Vector3 that represents the power of the shoot on both phones and that was the same Vector numerically. I mean, the numbers are sent and received correctly on the server. [1]: https://images-na.ssl-images-amazon.com/images/I/A1HmKt6tc0L.png [2]: https://assetstore.unity.com/packages/tools/network/socket-io-for-unity-21721 [3]: https://wordpress-miniclip.s3.amazonaws.com/wp-content/uploads/sites/6/2015/09/New-teams.png

Viewing all articles
Browse latest Browse all 36

Trending Articles