开发者

GameCenter - handling incoming calls etc

开发者 https://www.devze.com 2023-01-20 08:04 出处:网络
What would you do in the following scenario: When implementing a multiplayer game, you use GKMatchmaker to find players.

What would you do in the following scenario:

  1. When implementing a multiplayer game, you use GKMatchmaker to find players.
  2. When the required number of players has connected, you start the match.
  3. Now one of the players receives an incoming call.

What now? If the user takes the call, the application will move to the background, the connection to GameCenter will 开发者_运维知识库be lost, right?

What to do with the player and what to do with the match?

I guess you would have to rate that game as lost for the player who has disconnected, and try to go on with the match with the remaining players.

Has anyone come up with a better way of handling this?


The connection to Game Center is not "lost" immediately, i am unsure of the actual timeout period, and would not count on it being any particular period if it is not specified in the docs somewhere. You can always test it for a particular release/version using two connected players.

In our game Tic Tac Toe Twist, when a player disconnects due to timeout or other networking problem, we let the players know who disconnected with a message on screen for five seconds, leave the match we are in, reset the game state and then drop them back to the start game screen.

You could also remove them from your game and recover, if your particular game worked well that way.

Be sure to check out the WWDC 2011 information for updates as to how Game Center will handle this in the future, just in case Apple decides to change things...

0

精彩评论

暂无评论...
验证码 换一张
取 消