gpt4 book ai didi

iOS游戏中心配对

转载 作者:行者123 更新时间:2023-11-29 03:34:54 25 4
gpt4 key购买 nike

我正在使用 Game Center 开发一款回合制游戏。我耐心地研究了以下问题,但我希望有人能提供解决方案。

我用某张 map 开始自动匹配游戏,我想只连接到选择同一张 map 玩的玩家。有什么办法可以限制吗?

谢谢。

最佳答案

其实我的问题的解决方案很简单,只是需要多读一点。创建匹配请求时,可以设置属性playerGroup以限制仅来自同一组的玩家连接到来自同一组的玩家。

但似乎在邀请好友时设置此属性不起作用,它仅适用于自动匹配。因此,如果有人打算这样做,你就必须找到解决方法。

GKMatchRequest *request = [[GKMatchRequest alloc] init];
request.minPlayers = 2;
request.maxPlayers = 4;
request.playerGroup = MyMap_Forest | MyRulesCaptureTheFlag;

If your game sets the playerGroup property, only players whose requests share the same playerGroup value are automatched by Game Center. The value of a player group is arbitrary. For example, you could define different playerGroup values to implement any of the following filters:

A game could restrict players based on skill level. A game that provides multiple game modes could use it to filter players into the specific game they want to play. A game that provides bonus content through in-app purchase could match players who own the same content with each other.

将playerGroup设置为0或根本不设置意味着该场比赛没有玩家组,因此任何人都可以连接到任何人。

关于iOS游戏中心配对,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19320311/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com