简体   繁体   English

如何使用Google Play游戏在实时多人游戏中处理应用版本?

[英]How to handle app versions in real-time multiplayer using Google Play Games?

Here is the example: 这是示例:

  • First game version (v1) - initial multiplayer features. 第一游戏版本(v1)-初始多人游戏功能。
  • Second game version (v2) - fixed minor bugs, remains compatible with v1. 第二游戏版本(v2)-修复了一些小错误,仍与v1兼容。
  • Third game version (v3) - added some new gameplay mechanics, this version is NOT compatible with v1 and v2. 第三游戏版本(v3)-添加了一些新的游戏机制,该版本与v1和v2不兼容。

In this situation, I want Play Games Services to allow auto-connect for versions v1 and v2, but players on v3 should only connect to other v3. 在这种情况下,我希望Play游戏服务允许v1和v2版本的自动连接,但是v3上的玩家只能连接到其他v3。

How do I do this with Google Play Games Real-time multiplayer ? 如何使用Google Play游戏实时多人游戏做到这一点?

The RoomConfig has a variant field that is used to match players. RoomConfig的变量字段用于匹配玩家。 The variant value must exactly match in order to connect players. 变量值必须完全匹配才能连接播放器。 For more information see: https://developers.google.com/android/reference/com/google/android/gms/games/multiplayer/realtime/RoomConfig.Builder.html#setVariant(int) 有关更多信息,请参见: https : //developers.google.com/android/reference/com/google/android/gms/games/multiplayer/realtime/RoomConfig.Builder.html#setVariant(int)

When building the room your code would look something like (where GameVersion is the version of your game): 建造房间时,您的代码应类似于(其中GameVersion是游戏的版本):

    int minPlayers = 2;
    int maxPlayers = 2;
    long bitmask = 0;
    Bundle am = RoomConfig.createAutoMatchCriteria(minPlayers, maxPlayers, bitmask);
    // build the room config
    RoomConfig.Builder roomConfigBuilder = makeBasicRoomConfigBuilder();
    roomConfigBuilder.setAutoMatchCriteria(am)
    .setVariant(GameVersion < 3 ? 1 : 3);

    RoomConfig roomConfig = roomConfigBuilder.build();
    // create room:
   Games.RealTimeMultiplayer.create(mGoogleApiClient, roomConfig);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在使用Google Play游戏服务的实时多人游戏中使用僵尸玩家? - How can I use bot players in real-time multiplayer games using Google Play game services? 当应用程序进入后台时,实时多人游戏Google Play游戏服务同行会断开连接 - Real-time Multiplayer Google Play Games Services peer gets disconnected when app goes in background 如何检测客户是否故意在Google Play游戏实时多人游戏中留下房间? - How to detect if client intentionally left Room in Google Play Games Real-time Multiplayer? Google Play 游戏服务实时多人游戏 - Google Play Games Services Real Time Multiplayer 如果Google Play游戏服务提供实时多人游戏,那么使用gamesparks.com有什么优势? 两者有什么区别? - If Google Play Games Services offer Real-time Multiplayer, what is the advantage of using gamesparks.com? What is the difference between these two? 如何在Google Play游戏实时多人游戏中定义主机? - How to define a host in google play games real time multiplayer? Google Play游戏-回合制或实时多人API? - Google Play Games - Turn Based or Real Time multiplayer API? 如何在实时多人Google Play游戏服务中创建房间时向其他参与者发送数据 - How to send data to other participant on Room creation in Real-time Multiplayer Google Play Game Services Android上的Google实时多人游戏 - Google Real-time Multiplayer on Android Google玩实时多人并发-有时玩家会在同一时间选择正确的答案 - Google play real-time multiplayer concurrency - sometimes players pick the right answer at the same time
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM