Google Play游戏 - 基于回合制或实时多人游戏API?

时间:2015-06-05 23:19:18

标签: android google-play-games

正在使用Google Play Games API开发基于回合制的多人纸牌游戏。

在这个游戏中,最少3名玩家必须在开始之前在线。在玩游戏的同时如果我使用带有AutoMatching标准的TurnBased Multiplayer API,那么Game会在createMatch代码调用之后快速启动,如下所示。并且它还没有等到剩下两名球员加入

// Create a one-on-one automatch game.
public void startQuickMatch() {
    Bundle autoMatchCriteria = RoomConfig.createAutoMatchCriteria(
            2, 4, 0);

    TurnBasedMatchConfig tbmc = TurnBasedMatchConfig.builder()
            .setAutoMatchCriteria(autoMatchCriteria).build();

    // Start the match
    ResultCallback<TurnBasedMultiplayer.InitiateMatchResult> cb = new ResultCallback<TurnBasedMultiplayer.InitiateMatchResult>() {
        @Override
        public void onResult(TurnBasedMultiplayer.InitiateMatchResult result) {
            processResult(result);
        }
    };
    Games.TurnBasedMultiplayer.createMatch(Context.getApiClient(), tbmc).setResultCallback(cb);
}

如果我使用Realtime Multiplayer API,那么我可以向其他玩家加入等候室。但处理回合制游戏行动并不友好。

请帮我在TurnBased和Realtime多人游戏API之间进行选择。如果仍然使用TurnBased API,那么如何在游戏开始之前处理玩家等待过程,就像在Realtime API中一样

1 个答案:

答案 0 :(得分:2)

我认为这里的答案取决于你正在开发的游戏风格。 *如果游戏玩法应该是同步的(即,我们所有人都在同时移动),您想要使用RTMP API。 *如果游戏是异步的(即,我轮流,两天后你轮流,下周我回来并回复),TBMP API是正确的选择。

相关问题