Platforms to show: All Mac Windows Linux Cross-Platform

Back to GKMatchMBS class.

GKMatchMBS.chooseBestHostPlayer(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
Determines the best player in the game to act as the server for a client-server match.

Calling this method causes Game Kit to attempt to estimate which player has the best overall network connection using a variety of metrics such as bandwidth, latency and network reliability. Typically, you call this method when your game implements a client-server model on top of the match's peer-to-peer connection. See "Designing Your Network Game" in Game Center Programming Guide.

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 GKMatchMBS.chooseBestHostPlayerCompleted event.

GKMatchMBS.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.

GKMatchMBS.disconnect

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

Your application should call disconnect before releasing the match object. Calling disconnect notifies other players that you have left the match.

GKMatchMBS.expectedPlayerCount 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 remaining number of players who have not yet connected to the match. (read-only)

The value of this property is decremented whenever a player connects to the match. When its value reaches zero, all expected players are connected, and your game can begin the match.

GKMatchMBS.playerIDs as string()

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

The playerIDs property initially includes the player identifiers for any players already connected to the match; the array may initially be empty. As each player connects to the match, that player's player identifier is added to the array.

GKMatchMBS.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.

GKMatchMBS.sendDataToAllPlayers(data as Dictionary, mode as Integer, byref error as NSErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Transmits data to all players connected to the match.

data: The game data to send.
mode: The mechanism used to send the data.
error: If the data could not be queued, on return, this parameter holds an NSError object describing the error.

Return true if the data was successfully queued for transmission; false if the match was unable to queue the data.
The match queues the data and transmits it when the network becomes available.

GKMatchMBS.sendDataToPlayers(players() as string, data as Dictionary, mode as Integer, byref error as NSErrorMBS) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Transmits data to a list of connected players.

data: The game data to be sent.
players: An array containing the identifier strings for the list of players who should receive the data.
mode: The mechanism used to send the data.
error: If the data could not be queued, on return, this parameter holds an NSError object describing the error.

Returns true if the data was successfully queued for transmission; false if the match was unable to queue the data.
The match queues the data and transmits it when the network becomes available.

GKMatchMBS.voiceChatWithName(name as string) as GKVoiceChatMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method GameKit MBS MacFrameworks Plugin 12.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Joins a voice channel.

Returns an voice chat object for the voice channel, or nil if an error occurred.

Calling this method joins a voice channel, creating it if necessary. Your application should retain the voice chat object returned by this method. All participants who join a channel with the same name are connected to each other.

A single match can have multiple voice chat channels, and any player in the match can join multiple channels simultaneously. For example, a team-based game might create a channel for each team, and a single channel that includes all of the players.

Voice chat objects are dependent on the network connection provided by the match. When the player disconnects from the match, all voice channels associated with that match stop working. Typically, you should release any voice channels you joined before calling calling disconnect on the match.

Parental controls may prevent a player from joining a voice chat. If the player is not permitted to join the voice channel, a nil object is returned to your application.

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


The biggest plugin in space...