Hosted Matches

TL;DR: How do we actually use the hosted matches APIs from GameKit?

We host our own servers and would like to use Game Center matchmaking and invite systems to get players together into a match.

For that, we're using GKMatchmaker findPlayersForHostedRequest:withCompletionHandler:, both for sending invites to friends and for matching players that don't know each other.

On both cases, we get a GKPlayer for the invited player or a list of GKPlayers respectively. Up to this point everything is as expected and works without issues.

Now the issue we have is that in both scenarios, the remote player GKPlayer gamePlayerID and teamPlayerID are some sort of random number:

DATA FROM INVITE OR MATCHMAKING
recipientResponseHandler (Invite sender perspective)
    Name:InviteReceiver
    TeamPlayerID:165662439500382624
    GamePlayerID:165662439500382624
    PlayerID:UNIQUE_ID_RECEIVER

player didAcceptInvite (Invited player perspective)
    Name:InviteSender
    TeamPlayerID:165662439889816800
    GamePlayerID:165662439889816800
    PlayerID:UNIQUE_ID_SENDER

/////////////////////////

DATA THE LOCAL PLAYER SEE ABOUT THEMSELVES 
Actual invite receiver data
    Name:InviteReceiver
    TeamPlayerID:UNIQUE_TEAM_ID_RECEIVER
    GamePlayerID:UNIQUE_GP_ID_RECEIVER
    PlayerID:UNIQUE_ID_RECEIVER

Actual invite sender data
    Name:InviteSender
    TeamPlayerID:UNIQUE_TEAM_ID_SENDER
    GamePlayerID:UNIQUE_GP_ID_SENDER
    PlayerID:UNIQUE_ID_SENDER

I need to use this data to get them into the same match/server. Both have access to our backend and given some sort of stable ID that would be simple.

The root of the problem is that I can't really use name or alias to do this and playerID, which is the only stable id, is marked as deprecated.

This leaves teamPlayerID and gamePlayerID, which simply don't match when viewed from the other players perspective.

I've been thru all the documentation and samples I could find but none helped.

GKBasePlayer has a playerID which is not marked as deprecated and given GKPlayer and GKLocalPlayer are subclasses, I could just cast to it and use the "non-deprecated" id there.... but it not being marked as deprecated is probably just an error on the documentation.

Thanks for reading.

Accepted Answer

Thanks for reaching out EvilZeh. Let me work with the team and get back to you with some guidance.

  • The Game Center Team

Hey Keith,

Just wanted to follow up on this to see if there might be any updates on this. Thanks!

Hosted Matches
 
 
Q