【问题标题】:Google Play Games - Turn Based or Real Time multiplayer API?Google Play Games - 回合制还是实时多人 API?
【发布时间】:2015-06-05 23:19:17
【问题描述】:

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

在此游戏中,至少 3 名玩家必须在开始之前和玩游戏时在线。如果我将 TurnBased Multiplayer API 与 AutoMatching 标准一起使用,那么游戏会在 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 和实时多人 API 之间进行选择。如果仍然是 TurnBased API 是最好的,那么如何处理玩家在游戏开始前等待的过程,就像在 Realtime API 中一样

【问题讨论】:

    标签: android google-play-games


    【解决方案1】:

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

    【讨论】:

      猜你喜欢
      • 2015-10-29
      • 2019-06-15
      • 1970-01-01
      • 1970-01-01
      • 2016-10-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-04-04
      相关资源
      最近更新 更多