Search code examples
javaandroidgoogle-play-servicesmultiplayergoogle-play-games

When to call takeTurn() to skip starting player's turn


I am using google's turn based multiplayer API in my android application. I see that the takeTurn() method is already called in startMatch() in the project that they provide for reference.

I know I need to call takeTurn() in order to skip over the player's turn that started the game so that the first player is not able to interact with the view until a player has joined the match and has taken their turn first. I am just not positive where I need to make the takeTurn() call in order to do this since it is already called in the onStart() method.

It makes me think that I would need to call it when a button is pressed to start a game but since onStart() is called in that process and onStart() calls takeTurn() it seems redundant to me.


Solution

  • The reason to call takeTurn() at the start is to notify the other play of the Turn-Based game. The other player is not notified until the first player has taken his/her turn.

    There is no set place you should call it, and it is not recommended or required to skip the first player's turn. It is just an option.