I am creating a real time multiplayer game in Unity 3d using Google Player Services that has a ball that the players will interact with. I'm not particularly sure how I will update the ball's position on all of the games though. I have each player sending updates for their positions and all of that but with the ball being interacted with by all players I'm not sure how to figure out who's update of the ball position I should take.

  • \$\begingroup\$ Is that ball a physical object in your game? Or you are moving it manually? \$\endgroup\$ Commented Mar 2, 2016 at 14:21
  • \$\begingroup\$ @HamzaHasan It is a physical object that has physics working it and everything. \$\endgroup\$
    – sabo
    Commented Mar 2, 2016 at 14:56
  • \$\begingroup\$ Then I'd suggest to send only initial calls, for example initial force applied by a player, and thn apply the same force vector on other hand, instead of updating positions at every frame. Then at the end verify the position and all that \$\endgroup\$ Commented Mar 2, 2016 at 15:16
  • \$\begingroup\$ I presume this is a game without a dedicated server component? That is, the multiplayer is peer-to-peer? \$\endgroup\$
    – user1430
    Commented Mar 2, 2016 at 16:20

1 Answer 1


I'm not sure how to figure out who's update of the ball position I should take.

One way to handle this problem is to introduce the concept of authority over an object. It's particularly useful in games that aren't backed by a dedicated server process (if there is a dedicated server, just make the server the authority for the ball's simulation).

The client that has "authority" over a particular object is the one responsible for the simulation of that object that everybody else eventually sees. Even if each client does some local prediction of the ball movement (which they probably should), they will ultimate defer to the authoritative corrected state of the ball sent to them from the client with authority over that ball.

Grant authority to a client when that client first interacts with the ball in some fashion. That client retains authority over the ball until some other client touches or interacts with it. While a client has authority, it's the one responsible for periodically sending updates to everybody else.

You'll need some form of consistent timestamp or token mechanism to resolve who wins in the event that two clients interact with the ball at approximately the same time.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .