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.
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.