What occurs when a player declines an invitation?

Do you know how the GKMatchmakerViewController handles a decline from a player (friend) who was listed in the "request.recipient" array?

Does Game Center then automatically hunt for some random player or does the match request fail?

Accepted Reply

I believe I found my answer in the Game Center Programming Guide under "Real Time Matches" (see below),


I guess a "match" will be returned after calling "findMatchForRequest" and I can then check whether the "match.expectedPlayerCount == 0" . If not zero then I guess I know some players provided in the "request.recipient" array did not accept the invitation. I can then either invite more friends (ie: call addPlayersToMatch and providing a new request.recipient array) or simply fill in the empty slots with random players (ie: call addPlayersToMatch but do not provide any request.recipient array information)


GAME CENTER PROGRAMMING GUIDE (REAL-TIME MATCH)

Because some of the invitations may not be accepted, it is possible you may receive a match that still needs more players. With this in mind, your custom user interface should implement the following behavior:

  • The first time the player invites players to join the match, create the match request with those players and call the
    findMatchForRequest:withCompletionHandler:
    method. Wait for the match to be returned (or cancel the request if the player cancels the invitations).
  • If the player wants to add more players to the match after the invitations are processed, perform the same procedure again, but call the
    addPlayersToMatch:matchRequest:completionHandler:
    method instead.
  • If the player wants to automatch the remaining slots, create a match request but do not include a list of players to invite. Call the
    addPlayersToMatch:matchRequest:completionHandler:
    method to fill the remaining slots. You must wait until all invited players have connected as all pending match requests are cancelled when automatching the remaining player slots.
  • If the player wants to start the match with the players already in the match, call the
    finishMatchmakingForMatch:
    method to end matchmaking entirely.

If you want to create a match that contains both invited players and automatched players, you must first create the match with the invited players. After all invited players have connected, you can then add players through automatching.



Replies

I believe I found my answer in the Game Center Programming Guide under "Real Time Matches" (see below),


I guess a "match" will be returned after calling "findMatchForRequest" and I can then check whether the "match.expectedPlayerCount == 0" . If not zero then I guess I know some players provided in the "request.recipient" array did not accept the invitation. I can then either invite more friends (ie: call addPlayersToMatch and providing a new request.recipient array) or simply fill in the empty slots with random players (ie: call addPlayersToMatch but do not provide any request.recipient array information)


GAME CENTER PROGRAMMING GUIDE (REAL-TIME MATCH)

Because some of the invitations may not be accepted, it is possible you may receive a match that still needs more players. With this in mind, your custom user interface should implement the following behavior:

  • The first time the player invites players to join the match, create the match request with those players and call the
    findMatchForRequest:withCompletionHandler:
    method. Wait for the match to be returned (or cancel the request if the player cancels the invitations).
  • If the player wants to add more players to the match after the invitations are processed, perform the same procedure again, but call the
    addPlayersToMatch:matchRequest:completionHandler:
    method instead.
  • If the player wants to automatch the remaining slots, create a match request but do not include a list of players to invite. Call the
    addPlayersToMatch:matchRequest:completionHandler:
    method to fill the remaining slots. You must wait until all invited players have connected as all pending match requests are cancelled when automatching the remaining player slots.
  • If the player wants to start the match with the players already in the match, call the
    finishMatchmakingForMatch:
    method to end matchmaking entirely.

If you want to create a match that contains both invited players and automatched players, you must first create the match with the invited players. After all invited players have connected, you can then add players through automatching.



I recommend you experiment with Game Center by simply downloading the app "Go Game Connect" and trying it. The local WiFi system is a roll-your-own match system that does not use Game Center. The Game Center system will allow you to experiment with various choices and see the view controllers.