SkillzSync.java, you will be able to find functions you can call for your synchronous tournaments, such as:
- Returns true if a player has started disconnect/ shutdown (on reporting score or aborting).
- Explained in previous section <link here>.
- Returns num players currently connected to the server.
- Returns current player ID as long.
- Returns server time in seconds as double (Prototype, Unreliable).
- Returns the actual time a player has left to reconnect if they are disconnected. You’ll need to pass in the tournament player id of the player that lost connection. For the current player pass
Determine which player goes first. Since it’s a turn-based synchronous game, you will need to create logic on which player goes first. Here are some ideas:
- The first player returned from the
Playersarray could go first.
- Use the Skillz Random class to implement a coin toss functionality.
public static void AssignPlayers()
List players = Skillz.GetMatchInfo(this).players;
if (players.size() < 2)
Log.d("Skillz”, “Non sync game");
if (players.get(0).getUserId() < players.get(1).getUserId())
SkillzPlayer PlayerOne = players.get(0);
SkillzPlayer PlayerTwo = players.get(1);
SkillzPlayer PlayerOne = players.get(1);
SkillzPlayer PlayerTwo = players.get(0);
Reporting a score is still the same. You’ll just need to call
onMatchCompletedmethod. This is called once a player has reported a score or aborted the match through the corresponding Skillz API methods.
onMatchCompletedfor the opponent player.
At this point, you have the tools necessary to develop the vast majority of your synchronous application. Spend time developing the game and data exchange in a manner that will fulfill the needs of the game. It is recommended that you greatly familiarize yourself with the data exchange flow before moving to the following advanced steps.
Next Step: Handle Disconnections
Note: Without following the steps to handle disconnections, you may experience frozen game states as the disconnect logic is not yet being handled.