Platforms to show: All Mac Windows Linux Cross-Platform

Back to GKTurnBasedMatchMBS class.

GKTurnBasedMatchMBS.acceptInvite(tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 13.0 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Programmatically accept an invitation to a turn-based match.

When this method is called, it creates a background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls your GameKitMBS.acceptInviteCompleted event.

Available on Mac OS X 10.8.2 and newer.

GKTurnBasedMatchMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The constructor.

GKTurnBasedMatchMBS.creationDate as date

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The date that the match was created. (read-only)

GKTurnBasedMatchMBS.currentParticipant as GKTurnBasedParticipantMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The participant whose turn it is to act next. (read-only)

After a match starts and until it ends, the current player is the one who needs to take action to drive the match to completion. Other players are not allowed to change the state of the match.

GKTurnBasedMatchMBS.declineInvite(tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 13.0 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Programmatically decline an invitation to a turn-based match.

When this method is called, it creates a background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls your GameKitMBS.declineInviteCompleted event.

Available on Mac OS X 10.8.2 and newer.

GKTurnBasedMatchMBS.endMatchInTurnWithMatchData(matchData as Dictionary, tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Ends the match.

matchData: The end state for the match.

Calling this method ends the match for all players. This method may only be called by the current participant. Before your game calls this method, the matchOutcome property on each participant object stored in the participants property must have been set to a value other than GKTurnBasedMatchOutcomeNone.

When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls your GameKitMBS.endMatchInTurnWithMatchDataCompleted event.

GKTurnBasedMatchMBS.endTurnWithNextParticipant(nextParticipant as GKTurnBasedParticipantMBS, matchData as Dictionary, tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Updates the data stored on Game Center for the current match.

nextParticipant: The next player in the match who needs to take an action. It must be one of the object's stored in the match's participants property.
matchData: The game-specific state for the match.
completionHandler

When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls the GameKitMBS.endTurnWithNextParticipant event.

GKTurnBasedMatchMBS.endTurnWithNextParticipants(nextParticipants() as GKTurnBasedParticipantMBS, timeout as Double, matchData as Dictionary, tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 13.0 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Updates the data stored on Game Center for the current match.

nextParticipants: An array of participant objects reflecting the order in which the players should act next. Each object in the array must be one of the objects stored in the match's participants property.
timeout: The length of time the next player has to complete their turn.
matchData: The game-specific state for the match.

If the next player to act does not take their turn in the specified interval, the next player in the array receives a notification to act. This process continues until a player takes a turn or the last player in the list is notified.

When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls your GameKitMBS.endTurnWithNextParticipantsCompleted event.

Available on Mac OS X 10.8.2 and newer.

GKTurnBasedMatchMBS.loadMatchData(tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Loads the game-specific data associated with a match.

When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls GameKitMBS.loadMatchDataCompleted event.

GKTurnBasedMatchMBS.matchData as Dictionary

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Game-specific data that reflects the details of the match. (read-only)

Although Game Center knows who is participating in the match and who is expected to act next, it does not know anything about your game's internal logic. Your game provides the match data and all the programming logic required to interpret it. This data should include the current state of the game and provide any necessary details about what actions the current player is expected to take. It can also be helpful for your game to record information about recent moves made by other players. The game can then replay those moves visually for the player to show exactly how the match reached the state it is in now.

Your game never directly updates the match state associated with this property. Instead, when the data is updated to reflect the actions of the current player, your game serializes the updated state into dictionary and calls one of the match's instance methods that transmit the updated state to Game Center.

The value of this property is nil until after your game calls the loadMatchDataWithCompletionHandler: method and the load task is complete. After this task completes, the matchData property holds the data that the last player to act transmitted to Game Center.

GKTurnBasedMatchMBS.matchDataMaximumSize as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 13.0 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the limit the Game Center servers place on the size of the match data. (read-only)

Game Kit returns an error if your game sends updated data larger than this value.
Available on Mac OS X 10.8.2 and newer.

GKTurnBasedMatchMBS.matchID as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
A string that uniquely identifies the match. (read-only)

This string is not intended to be displayed to players. Your game should use this string whenever it needs to refer to a specific match. For example, if you want your game to store additional information on a device, it might store it in a database using the match ID as a key.

GKTurnBasedMatchMBS.message as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
A message displayed to all players in the match.

The message property is displayed by the standard user interface; this allows your game to use the message to inform players of the current state of the match.

Important This property can be changed only by an instance of your game associated with the current player. If an instance of your game associated with another player in the match attempts to write to this property, an exception is thrown.

GKTurnBasedMatchMBS.participantQuitInTurnWithOutcome(matchOutcome as Integer, nextParticipant as GKTurnBasedParticipantMBS, matchData as Dictionary, tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Resigns the current player from the match without ending the match.

matchOutcome: The end outcome of the current player in the match.
nextParticipant: The next player in the match who needs to take an action. It must be one of the object's stored in the match's participants property.
matchData: A dictionary the game-specific state for the match.

Your game calls this method on an instance of your game that is processing the current player's turn, but that player has left the match. For example, the player may have willingly resigned from the match or that player may have been eliminated by the other players (based on your game's internal logic).

When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls GameKitMBS.participantQuitInTurnWithOutcome event.

See also:

GKTurnBasedMatchMBS.participantQuitInTurnWithOutcome(matchOutcome as Integer, nextParticipants() as GKTurnBasedParticipantMBS, timeout as Double, matchData as Dictionary, tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 13.0 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Resigns the current player from the match without ending the match.

matchOutcome: The end outcome of the current player in the match.
nextParticipants: An array of participant objects reflecting the order in which the players should act next. Each object in the array must be one of the objects stored in the match's participants property.
timeout: The length of time the next player has to complete their turn.
matchData: The game-specific state for the match.

Your game calls this method on an instance of your game that is processing the current player's turn, but that player has left the match. For example, the player may have willingly resigned from the match or that player may have been eliminated by the other players (based on your game's internal logic).

If the next player to act does not take their turn in the specified interval, the next player in the array receives a notification to act. This process continues until a player takes a turn or the last player in the list is notified.

When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls your GameKitMBS.participantQuitInTurnWithOutcomeCompleted event.

Available on Mac OS X 10.8.2 and newer.

See also:

GKTurnBasedMatchMBS.participantQuitOutOfTurnWithOutcome(matchOutcome as Integer, tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Resigns the player from the match when that player is not the current player. This action does not end the match.

matchOutcome: The end outcome of the current player in the match.

If the local player decided they wanted to resign from the match but is not the current participant in the match, your game calls this method.

When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls GameKitMBS.participantQuitOutOfTurnWithOutcomeCompleted event.

GKTurnBasedMatchMBS.participants as GKTurnBasedParticipantMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Information about the players participating in the match. (read-only)

The elements of this array are GKTurnBasedParticipantMBS objects representing each participant in the match. Your game uses these objects to retrieve more information about the participants in the match. Your game also uses one of the objects in this array as a parameter whenever it calls a method that sets a different participant to act in the match.

The size of the array and the order in which the participants appear in the array are set when the match is first created, and never changes. When a match is first created, some participants may not hold actual players yet. Game Center searches for a player to fill that spot in the match only after your game sets that participant as the current player.

GKTurnBasedMatchMBS.rematch(tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 13.0 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Create a new match with the list of players from an existing match.

Calling this method uses auto-matching to recreate a previous match. A new match with the same set of players is created and returned. If your game attempts to recreate matches using this method, each instance of your game on each device should call this method.

When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls GKGameKitMBS.rematchCompleted event.

GKTurnBasedMatchMBS.remove(tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Programmatically removes a match from Game Center.

Even after a player's participation in a match ends, the data associated with the match continues to be stored on Game Center. Storing the data on Game Center allows the player to continue to watch the match's progress, or even see the final state of the match when it ends. However, players may also want to delete matches that they have finished playing. If you choose not to use the standard matchmaker user interface, your game should offer the ability to delete a finished match from Game Center. When a player chooses to delete a match from Game Center, call this method. It is a programming error to call this method on a match that has the local player as an active participant.

When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls GameKitMBS.removeCompleted event passing the tag. Keep in mind that the completion handler may be called on a thread other than the one originally used to invoke the method. This means that the code in your block needs to be thread-safe.

When the task completes, the match is no longer visible to the local player whose device made the call. Other players involved in the match still see the match.

GKTurnBasedMatchMBS.saveCurrentTurnWithMatchData(matchData as Dictionary, tag as Variant = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 13.0 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Update the match data without advancing the game to another player.

Available on Mac OS X 10.8.2 and newer.

matchData: The game-specific state for the match.

This method updates the match data stored on Game Center. Call this method when the current player takes an action that advances the state of the match but does not end the player's turn. For example, if your game has a fog-of-war mechanic, you might call this method when the player revealed new information on the map.

When this method is called, it creates a new background task to handle the request. The method then returns control to your game. Later, when the task is complete, Game Kit calls your GameKitMBS.saveCurrentTurnWithMatchDataCompleted event.

GKTurnBasedMatchMBS.status as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The current state of the match. (read-only)

The items on this page are in the following plugins: MBS MacFrameworks Plugin.


The biggest plugin in space...