Platforms to show: All Mac Windows Linux Cross-Platform
GKMatchMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | GameKit | MBS MacFrameworks Plugin | 12.3 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
Matches provide both data and voice services. Your application never directly allocates GKMatch objects. Instead, your application uses the GKMatchmaker class to programmatically find a match with other interested players or a GKMatchmakerViewController object to display a user interface to the player.
After your application receives a match object, you must set a delegate and then wait until the other participants are connected to the match. You can read the expectedPlayerCount property to determine how many players have not connected to the match.
Your application transmits data to other players by calling either the sendDataToAllPlayers method or the sendDataToPlayer method. To transmit and receive voice data, call voiceChatWithName to create one or more voice channels.
When you are finished with the match, call the match's disconnect method.
- property Handle as Integer
- 9 methods
- method chooseBestHostPlayer(tag as Variant = nil)
- method Constructor
- method disconnect
- method expectedPlayerCount as Integer
- method playerIDs as string()
- method rematch(tag as Variant = nil)
- method sendDataToAllPlayers(data as Dictionary, mode as Integer, byref error as NSErrorMBS) as boolean
- method sendDataToPlayers(players() as string, data as Dictionary, mode as Integer, byref error as NSErrorMBS) as boolean
- method voiceChatWithName(name as string) as GKVoiceChatMBS
- shared method Available as boolean
- 5 constants
Constants
Constant | Value | Description |
---|---|---|
GKMatchSendDataReliable | 0 | One of the mechanism constants used to transmit data to other players. The data is sent continuously until it is successfully received by the intended recipients or the connection times out. more |
GKMatchSendDataUnreliable | 1 | One of the mechanism constants used to transmit data to other players. The data is sent once and is not sent again if a transmission error occurs. more |
Match State Constants
Constant | Value | Description |
---|---|---|
GKPlayerStateConnected | 1 |
Connected to the match. |
GKPlayerStateDisconnected | 2 |
Disconnected from the match. |
GKPlayerStateUnknown | 0 |
Initial player state. |
This class has no sub classes.
Some methods using this class:
- GKMatchmakerMBS.addPlayersToMatch(match as GKMatchMBS, matchRequest as GKMatchRequestMBS, tag as Variant = nil)
- GKMatchmakerMBS.finishMatchmakingForMatch(match as GKMatchMBS)
- GKMatchmakerViewControllerMBS.addPlayersToMatch(match as GKMatchMBS)
Some events using this class:
- GameKitMBS.addPlayersToMatchCompleted(MatchMaker as GKMatchmakerMBS, match as GKMatchMBS, matchRequest as GKMatchRequestMBS, error as NSErrorMBS, tag as Variant)
- GameKitMBS.chooseBestHostPlayerCompleted(match as GKMatchMBS, playerID as string, tag as Variant)
- GameKitMBS.matchConnectionWithPlayerFailed(match as GKMatchMBS, playerID as string, error as NSErrorMBS)
- GameKitMBS.matchDidChangeState(match as GKMatchMBS, playerID as string, state as Integer)
- GameKitMBS.matchDidFailWithError(match as GKMatchMBS, error as NSErrorMBS)
- GameKitMBS.matchDidReceiveData(match as GKMatchMBS, data as Dictionary, playerID as string)
- GameKitMBS.matchForInviteCompleted(Matchmaker as GKMatchmakerMBS, invite as GKInviteMBS, match as GKMatchMBS, error as NSErrorMBS, tag as Variant)
- GameKitMBS.matchmakerViewControllerDidFindMatch(viewController as Variant, match as GKMatchMBS)
- GameKitMBS.matchShouldReinvitePlayer(match as GKMatchMBS, playerID as string) as boolean
- GameKitMBS.rematchCompleted(TurnMatch as GKTurnBasedMatchMBS, match as GKMatchMBS, error as NSErrorMBS, tag as Variant)
Xojo Developer Magazine
- 12.5, page 34: Writing OS X Apps for Game Center, Part 2: Requesting a Match by Tom Baumgartner
- 12.5, pages 31 to 32: Writing OS X Apps for Game Center, Part 2: Requesting a Match by Tom Baumgartner
The items on this page are in the following plugins: MBS MacFrameworks Plugin.
GKMatchmakerViewControllerMBS - GKMatchRequestMBS