gpt4 book ai didi

java - Android TurnBasedMultiplayer 与 exclusiveBitMask 自动匹配

转载 作者:行者123 更新时间:2023-11-30 11:23:13 25 4
gpt4 key购买 nike

有人可以解释一下这个位掩码参数如何用于自动匹配游戏中的独占角色吗?是否有可能自动匹配具有独特角色的多个玩家?

这里提到了here

Your game can also use the exclusiveBitMask parameter in createAutoMatchCriteria() to pair auto-matched players who are interested in playing specific exclusive roles in a game.

还有api docs

public static Bundle createAutoMatchCriteria (int minAutoMatchPlayers,
int maxAutoMatchPlayers, long exclusiveBitMask)

Creates an auto-match criteria Bundle. Can be passed to createMatch(GoogleApiClient, TurnBasedMatchConfig) to create a match for a turn-based game.

Parameters minAutoMatchPlayers min number of auto-matched players. maxAutoMatchPlayers max number of auto-matched players. exclusiveBitMask exclusive bitmask for exclusive roles for the player. The exclusive bitmask of each pairing of players must equal zero for auto-match.

最佳答案

来自文档:

When auto-matching with this option, players will only be considered for a match when the logical AND of their exclusive bit masks is equal to 0.

因此,如果您在此掩码中设置了位,那么如果您的对手想与您配对,则他们也不能设置该位。

例如在国际象棋中,如果 A 想下白,B 想下黑,他们可以在这个掩码中指定(0x1 为白色,0x2 为黑色),并且可以配对。两个想下白棋的玩家将不会匹配。

面具为 0x0 的玩家可以与任何玩家配对,无论是白色还是黑色。

关于java - Android TurnBasedMultiplayer 与 exclusiveBitMask 自动匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21345656/

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