Game Center多人游戏,连接超时时间很长
我使用 Game Center 配对/多人游戏(换句话说,使用 GKMatch
)实现了一款 2 人回合制游戏。效果很好。只有一个问题:当一名玩家断开连接(即退出应用程序)时,其他玩家需要一段时间才能收到通知(使用 match:player:didChangeState:
)。有时甚至30秒。
这不是一个好的用户体验。如果另一个玩家在 30 秒前已经断开连接,我不希望玩家无所事事。
2 个问题:
- 这只是沙箱服务器的问题吗?
- 如果不是,我可以采取什么措施来缩短/消除这个等待时间?
I've implemented a 2-player turnbased game using Game Center matchmaking/multiplayer, in other words using GKMatch
. It works well. There is just one issue: when one player disconnects (ie. quits the app), it takes a while before the other players gets notified of this (with match:player:didChangeState:
). Sometimes even 30 seconds.
That is not a good UX. I don't want a player to wait for nothing if the other player already disconnected 30 seconds ago.
2 questions:
- Is this an issue with the sandbox server only?
- If not, what can I do to shorten/eliminate this waiting period?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有依赖GC的notifyPlayer..从DC退出游戏到接收我通过自己的代码处理的呼叫的一切..
对于我的代码,当玩家A按下主页按钮时,意味着在应用程序委托的applicationDidEnterBackground中,数据被发送到玩家B通知玩家A已退出游戏。这样,当玩家A退出时,玩家B会立即知道玩家A退出了..而不是等待游戏中心通知你..
I did not rely on GC's notifyPlayer.. Everything from DC to quit game to receive calls i handle by my own codes..
for my code, when player A presses home button, means in app delegate's applicationDidEnterBackground, a data is sent to the player B to inform that player A has quit the game. This way, when the player A quits, player B will immediately know that player A has quit.. Rather than waiting for gamecenter to notify you..