Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reconnect player in Game Center

I'm having trouble figuring out how to reinvite a disconnected player in a good way, using the GKMatch class for the Game Center. The game is a 1 vs. 1 game.

When I detect a disconnected player, I try to reinvite that specific player to the match with this call:

[[GKMatchmaker sharedMatchmaker] addPlayersToMatch:theMatch matchRequest:request completionHandler:^(NSError *error)

This works as it's supposed to do. When the other player has established the connection he gets reinvited and the match can continue. But this leaves a problem I haven't been able to solve. Here comes the scenario:

  • Player 1 disconnects.
  • Player 2 leaves the match while Player 1 is disconnected.
  • Player 1 reconnects and detects that he lost connection to Player 2 and tries to reconnect to player2.
  • Player 2 is looking for a new match, which he is doing with the matchmakerViewController.
  • Player 2 suddenly joins the old match with Player 1, which he had left.

So my problem is that the matchmakerViewController let's players join old matches if they're reinvited. Is there a better way to handle this reconnection scenario so people won't get invited back to old matches?

like image 825
ThomasCle Avatar asked Apr 17 '12 14:04

ThomasCle


People also ask

How do I reconnect to Game Center?

Launch your Settings app. Scroll around and look for "Game Center". When you find "Game Center", click it. Enter your Apple ID (it's an email address) and your password.

How do you fix Game Center on iPhone?

Go to Settings > Game Center > Sign out and sign back in. If it continues, try connecting to a different Wi-Fi network or try from cell network. You can find additional details in. For the issue with Wallet and if you're still unable to connect to Game Center, reach out to Apple directly.

Is Game Center linked to Apple ID?

When you sign in with your Apple ID, you will be signed in to Game Center automatically. Game Center allows you to engage in game-related activities such as participation in leaderboards; multiplayer games; finding, viewing, and challenging friends; and tracking achievements.


1 Answers

You could provide an option to the player that still is connected, to either re-invite, or quit. You could also remove the matchmaking request to the player that left if the other player leaves.

like image 192
wquist Avatar answered Oct 20 '22 17:10

wquist