SkillzCrossplatform.cs, you will be able to find functions you can call for your synchronous tournaments, such as:
- Returns a Match object that has details regarding the specific match the user is in.
- Returns true if a player has started disconnect/shutdown (on reporting score or aborting).
- Explained in previous section here.
- Returns num players currently connected to the server.
- Returns current player ID as a 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()
var players = SkillzCrossPlatform.GetMatchInfo().Players;
if (players.Count < 2)
Debug.Log ("UNITY - Non async game");
if (players.ElementAt(0).ID < players.ElementAt(1).ID)
PlayerOne = players.ElementAt (0);
PlayerTwo = players.ElementAt (1);
PlayerOne = players.ElementAt (1);
PlayerTwo = players.ElementAt (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.