GameCenter - 处理来电等

发布于 2024-09-27 19:55:50 字数 282 浏览 0 评论 0原文

在以下场景中您会做什么:

  1. 在实现多人游戏时,您使用 GKMatchmaker 来查找玩家。
  2. 当所需数量的玩家连接完毕后,您就可以开始比赛。
  3. 现在其中一名玩家接到来电。

现在怎么办?如果用户接听电话,应用程序将移至后台,与 GameCenter 的连接将丢失,对吗?

球员该做什么,比赛又该做什么?

我想您必须将已断开连接的玩家评为该游戏失败,并尝试与其余玩家继续比赛。

有没有人想出更好的方法来处理这个问题?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼睛会笑 2024-10-04 19:55:50

与游戏中心的连接不会立即“丢失”,我不确定实际的超时期限,并且如果文档中未在某处指定,则不会指望它是任何特定的期限。您始终可以使用两个连接的播放器测试特定版本/版本。

在我们的 Tic Tac Toe Twist 游戏中,当玩家由于超时或其他网络问题而断开连接时,我们会通过屏幕上的消息让玩家知道是谁断开连接五秒钟,然后离开我们所在的比赛,重置游戏状态,然后退出他们回到开始游戏屏幕。

如果您的特定游戏以这种方式运行良好,您也可以将它们从游戏中删除并恢复。

请务必查看 WWDC 2011 信息,了解有关 Game Center 将来如何处理此问题的更新信息,以防 Apple 决定改变情况……

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...

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文