Skip to main content

Turn Based Multiplayer - Implementation Overview

Overview

During the process of making a turned based game you will follow the procedure below:

Step 1 - Player 1

At this point the match will be valid and invited players will be sent invitations which will appear as notifications on their device. If they don't have the app installed they will be prompted to install.

Step 2 - Player 2

The other players will now receive a notification about a game invitation.

If they don't have the game installed they can install it at this point or ignore the invitation.

At this point they can accept the invitation and open / install the game. This can be done through the Game Center / Play Games application outside your application, although with Play Games you can do this in your game as well.

When this player launches the app:

As long as the player accepted one of the invitations they should now have an active match. So as part of your start up process you should load active matches.

Step 3

This step will repeat until the game is completed.

If the player has the application open then the TurnBasedMatchEvent.MATCH_UPDATED event will be dispatched and you can respond immediately.

Otherwise the player will receive a notification about a game update:

[images/android_playgames_turnnotification.png]] ](-[[images/android_playgames_turnnotification_b.png)

Either case you should process the match and give the user the option to take a turn.

Step 4

When your game logic determines the game to be complete the same process as step 3 above should be taken but instead of taking a turn the player should complete the match with the final game data.