GKMatchRequest

Inherits: RefCounted < Object

Configures how many players Game Center should recruit for a realtime match.

Description

Instantiate GKMatchRequest, set the minimum/maximum player counts and invite message, then either create a GKMatchmakerViewController (for full UI control) or call GKMatchmakerViewController.request_match() as shown in GameCenterGuide.md. The optional MatchType argument lets you switch between peer-to-peer, hosted, or turn-based matchmaking. Apple’s guide is at Apple’s GKMatchRequest reference.

Configuration snippet from the guide:

var request := GKMatchRequest.new()
request.max_players = 2
request.min_players = 1
request.invite_message = "Join me in a quest to fun"

var max_supported := GKMatchRequest.max_players_allowed_for_match(GKMatchRequest.MatchType.peerToPeer)
print("Peer-to-peer supports up to %d players" % max_supported)

Properties

int

default_number_of_players

0

String

invite_message

""

int

max_players

2

int

min_players

2

int

player_attributes

4294967295

int

player_group

1

Dictionary

properties

{}

String

queue_name

""

Dictionary

recipient_properties

{}

Variant

recipient_response

Array

recipients

[]

Methods

int

max_players_allowed_for_match(forType: MatchType) static


Enumerations

enum MatchType: 🔗

MatchType PEER_TO_PEER = 0

There is currently no description for this enum. Please help us by contributing one!

MatchType HOSTED = 1

There is currently no description for this enum. Please help us by contributing one!

MatchType TURN_BASED = 2

There is currently no description for this enum. Please help us by contributing one!


enum InviteRecipientResponse: 🔗

InviteRecipientResponse ACCEPTED = 0

There is currently no description for this enum. Please help us by contributing one!

InviteRecipientResponse DECLINED = 1

There is currently no description for this enum. Please help us by contributing one!

InviteRecipientResponse FAILED = 2

There is currently no description for this enum. Please help us by contributing one!

InviteRecipientResponse INCOMPATIBLE = 3

There is currently no description for this enum. Please help us by contributing one!

InviteRecipientResponse UNABLE_TO_CONNECT = 4

There is currently no description for this enum. Please help us by contributing one!

InviteRecipientResponse NO_ANSWER = 5

There is currently no description for this enum. Please help us by contributing one!

InviteRecipientResponse UNKNOWN = 6

There is currently no description for this enum. Please help us by contributing one!


Property Descriptions

int default_number_of_players = 0 🔗

  • void set_default_number_of_players(value: int)

  • int get_default_number_of_players()

Default number of players your UI suggests when presenting the matchmaking sheet.


String invite_message = "" 🔗

  • void set_invite_message(value: String)

  • String get_invite_message()

Optional text Apple shows when the player sends invitations (see the invite_message example in the guide).


int max_players = 2 🔗

  • void set_max_players(value: int)

  • int get_max_players()

Maximum desired players in the match.


int min_players = 2 🔗

  • void set_min_players(value: int)

  • int get_min_players()

Minimum player count required before the match can start.


int player_attributes = 4294967295 🔗

  • void set_player_attributes(value: int)

  • int get_player_attributes()

There is currently no description for this property. Please help us by contributing one!


int player_group = 1 🔗

  • void set_player_group(value: int)

  • int get_player_group()

There is currently no description for this property. Please help us by contributing one!


Dictionary properties = {} 🔗

  • void set_properties(value: Dictionary)

  • Dictionary get_properties()

There is currently no description for this property. Please help us by contributing one!


String queue_name = "" 🔗

  • void set_queue_name(value: String)

  • String get_queue_name()

There is currently no description for this property. Please help us by contributing one!


Dictionary recipient_properties = {} 🔗

  • void set_recipient_properties(value: Dictionary)

  • Dictionary get_recipient_properties()

There is currently no description for this property. Please help us by contributing one!


Variant recipient_response 🔗

  • void set_recipient_response(value: Variant)

  • Variant get_recipient_response()

There is currently no description for this property. Please help us by contributing one!


Array recipients = [] 🔗

  • void set_recipients(value: Array)

  • Array get_recipients()

There is currently no description for this property. Please help us by contributing one!


Method Descriptions

int max_players_allowed_for_match(forType: MatchType) static 🔗

Returns Apple’s maximum supported player count for the supplied match type (peer_to_peer, hosted, or turn_based).