谷歌播放实时多人游戏问题 [英] Google Play Realtime Multiplayer Questions

查看:224
本文介绍了谷歌播放实时多人游戏问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有,只是没有在文档中回答了一些问题: https://开头developers.google.com/games/services/android/multiplayer

I have some questions that just weren't answered in the documentation: https://developers.google.com/games/services/android/multiplayer


  1. RoomConfig.createAutoMatchCriteria(1,3,0)不按预期工作。它只会尝试匹配了2人游戏中,从来没有一个3和从来没有4.我只有3设备,但我花了2或许数小时试图匹配的设备和他们只是在做对。我读这篇文章:<一href=\"http://stackoverflow.com/questions/16785447/auto-match-criteria-in-google-multiplayer-sample-bittonclicker-game-for-android\">Auto在谷歌样品多人游戏BittonClicker匹配条件为Android 其中有类似的问题。此外 GamesClient.getSelectPlayersIntent(1,3)有同样的错误。

  1. RoomConfig.createAutoMatchCriteria(1, 3, 0) does not work as intended. It will only try to match up a 2 player game, never a 3 and never a 4. I have only 3 devices, but I spent perhaps 2 hours attempting to match up the devices and they were only done in pairs. I read this post: Auto Match Criteria in Google Multiplayer Sample BittonClicker Game for android which had similar issues. Also GamesClient.getSelectPlayersIntent(1, 3) has the same bug.

GamesClient.getRealTimeWaitingRoomIntent(室,0)不按预期工作。该文件指出,如果连参加人数超过或等于指定的最小值开始游戏,开始播放在候车室UI选项启用。然而,在测试中,我还没有看到一个开始播放选项。什么情况是,每当第一人的消息说,'prepare播放弹出之后连接的候车室会自动退出。改变从0到1具有相同的效果,所以没有更改为 Integer.MAX_VALUE的。任何人都可以提供一种方式来实现预期的功能?难道我做错了吗?

GamesClient.getRealTimeWaitingRoomIntent(room, 0) does not work as intended. The documentation states " If the number of connected participants is more than or equal to the specified minimum to start the game, the Start Playing option in the waiting room UI is enabled." however upon testing I have yet to see a 'Start Playing' option. What happens is that the waiting room is exited automatically whenever the first person is connected after a message saying 'Prepare to Play' pops up. Changing from 0 to 1 has the same effect, so does changing to Integer.MAX_VALUE. Can anyone provide a way to achieve the intended functionality? Am I doing something wrong here?

我都玩过哪些有用户加入,然后离开Android的一些多人游戏,和别人需要自己的位置。我一直无法看到这个测试,无论我怎样假设参数automatching。如果一个玩家离开房间,将另一名球员来填补他的位置?如果是这样,将'Room.getParticipantIds()。大小(),比4返回一个数字更大?

I have played a few multiplayer games on android which have users join, then leave, and someone else takes their place. I have been unable to see this in testing, no matter what parameters I assume for automatching. If a player leaves a room, will another player come and fill his place? If so, will `Room.getParticipantIds().size() return a number greater than 4?

在一些游戏中,一旦游戏开始旁若无人联接。我已经测试这些游戏和我已经加入了一个房间,被告知,这是正在进行一次未找到。难道他们以某种方式告诉该游戏已经开始,而不是将它们与其他玩家匹配的服务器?如何其他球员加盟只是还没有开始游戏吗? (这些游戏是使用谷歌Play游戏服务)

In some of these games, once a game has started no one else joins. I have tested these games and not found on one occasion that I have joined a room and been told that it is in progress. Are they somehow telling the server that the game has started and not to match them up with other players? How are other players only joining games that have not started yet? (These games are using Google Play Game Services)

我还有其他问题,但我不想问不必要的问题。这些问题会如此有益的,如果回答了会大大降低我的压力。

I have other questions but I don't want to ask unnecessary questions. These questions would be so helpful and would reduce my stress greatly if answered.

感谢您的时间。

推荐答案

1)这是工作正是因为谷歌打算。谁也不能保证,如果你使用createAutoMatchCriteria(1,3,0)这3的对手将是为你的游戏中。在我的测试,(4器件请求一次),90%以上的时候就会变成2游戏上手。只有当我有一个设备或者邀请朋友或手动选择自动选取,然后有机会大幅去得到一个3或4人游戏开始了长达(否则,纯自动匹配导致2和2行为)

1) This is working exactly as Google intends. There is NO GUARANTEE that if you use createAutoMatchCriteria(1, 3, 0) that 3 opponents will be found for your game. In my testing, (4 devices requesting at once) 90% or more of the time It will become 2 games of 2 that get started. Only if I have one device invite either a friend or manually select AutoPick, then the chances go up dramatically of getting a 3 or 4 player game started (otherwise, pure AutoMatch results in the 2 and 2 behavior)

2)如果我理解正确的行为,你会得到一个球员的离开候车室(通常发起第一设备),然后其他玩家加入,但第一个玩家离开候车室,另一个是左在里面?如果是这样,那么你需要确保你使用以下(我做在onRoomConnected

2) If I understand the behavior correctly, you get one player that leaves the waiting room (normally the device that initiates first) and then the other player joins, but the first player leaves the Waiting Room, and the other is left in it? If so, then you need to ensure you use the following ( I do it in onRoomConnected

try {
        bWaitRoomDismissedFromCode = true;
        finishActivity(RC_WAITING_ROOM);
    } catch (Exception e) {
        dLog("would have errored out in waiting room");
    }

这将然后关闭对于那些在候车室还是任何玩家的候车室,并让他们回到您的活动。从下面,如果你想要的开始播放的行为,这仅仅是是否有接受邀请,进了房间邀请的球员。 (如果谷歌意味着它的工作了自动匹配的另一种方式,他们还没有得到它那里还)

This will then close the waiting room for any players that are in the waiting room still, and get them back into your activity. From below, if you want the behavior of "Start Playing", this is only if there are invited players that have accepted invitations into the room. (IF Google meant it to work another way for AutoMatch, they haven't got it there yet)

公众意向getRealTimeWaitingRoomIntent(间客房,诠释minParticipantsToStart)

public Intent getRealTimeWaitingRoomIntent (Room room, int minParticipantsToStart)

返回的原意,即会显示等待室屏幕,显示参与者加入一个实时的多人房间的进度。注意,这必须以startActivityForResult(意向,INT)被调用,使得调用包的身份可以成立。

Returns an intent that will display a "waiting room" screen that shows the progress of participants joining a real-time multiplayer room. Note that this must be invoked with startActivityForResult(Intent, int), so that the identity of the calling package can be established.

如果同行的必要数量的连接,并且它现在OK开始游戏,或者如果用户明确要求立即开始游戏,活动结果将是RESULT_OK。如果用户跳伞候车室屏幕没有采取任何行动,其结果将RESULT_CANCELED。如果用户明确选择离开房间时,其结果将是RESULT_LEFT_ROOM

If the necessary number of peers have connected and it's now OK to start the game, or if the user explicitly asked to start the game now, the activity result will be RESULT_OK. If the user bailed out of the waiting room screen without taking any action, the result will be RESULT_CANCELED. If the user explicitly chose to leave the room, the result will be RESULT_LEFT_ROOM.

不管结果code是什么,候车室活动将返回包含在EXTRA_ROOM客房对象重新presents您最初作为参数传递这里的房间的当前状态的数据的意图。

Regardless of what the result code was, the waiting room activity will return a data intent containing a Room object in EXTRA_ROOM that represents the current state of the Room that you originally passed as a parameter here.

如果需要,候车室可以允许用户开始播放室完全连接,甚至在比赛前。这是由minParticipantsToStart参数控制:如果至少有很多的参与者(包括当前播放器)连接到房间里,一个开始播放菜单项将在候车室UI被启用。设置minParticipantsToStart为0意味着开始播放永远可用,MAX_VALUE的价值将完全禁用的项目。注意:如果你允许用户及早开始,你需要通过明确地告诉其他连接的同行,该游戏现在开始处理这种情况;详情请参阅开发者文档。

If desired, the waiting room can allow the user to start playing the game even before the room is fully connected. This is controlled by the minParticipantsToStart parameter: if at least that many participants (including the current player) are connected to the room, a "Start playing" menu item will become enabled in the waiting room UI. Setting minParticipantsToStart to 0 means that "Start playing" will always be available, and a value of MAX_VALUE will disable the item completely. Note: if you do allow the user to start early, you'll need to handle that situation by explicitly telling the other connected peers that the game is now starting; see the developer documentation for more details.

最后,注意候车室本身从来没有明确采取任何行动来改变房间或参与者的状态。因此,如果该活动的结果是RESULT_LEFT_ROOM,它的调用者的责任,实际上离开房间。或者,如果结果RESULT_CANCELED,它的调用者的责任,要仔细检查房间的当前状态,并决定是否要开始游戏,继续等待,或做其他事。但需要注意的是,虽然候车室是积极的,房间的状态将作为参与者接受更改或拒绝邀请,并且参加人数甚至可能会改变,因为自动匹配玩家得到补充。

Finally, note that the waiting room itself will never explicitly take any action to change the state of the room or its participants. So if the activity result is RESULT_LEFT_ROOM, it's the caller's responsibility to actually leave the room. Or if the result is RESULT_CANCELED, it's the responsibility of the caller to double-check the current state of the Room and decide whether to start the game, keep waiting, or do something else. But note that while the waiting room is active, the state of the Room will change as participants accept or decline invitations, and the number of participants may even change as auto-match players get added.

3)谷歌Play游戏服务(对于自动匹配)没有这种行为。只有一个房间的所有参与者都发现服务器选择,将在房实际上可以连接(onRoomCreated并不意味着对通信的房间已经建立,它是为玩家加入,如果他们正在等待其他人加入......能够切换将服务所有其他球员)onRoomConnected是所有连接的玩家最后一次通话,并表示该房间已经准备好各地传递信息。现在,如果你有intivees,行为的变化,即是的,你可以看到一个被邀请者接受,但如果他们然后离开了房间..有没有办法把它由一个自动匹配填补,但你可以看到他们离开。 ..(怎么好看啊?)

3) Google Play Game Services (for Auto-Match) does NOT have this behavior. Only when all participants for a Room are found and selected by the server, will the room actually be Connected (onRoomCreated does NOT mean that a ROOM for communication has been setup, it is for the players to join if they are waiting for others to join... and can be switched once the Service has all the other Players) onRoomConnected is the last call to all connected players and signifies the Room is ready for passing messages around. Now, if you have intivees, the behavior changes, in that yes, you can see an invitee accept, but if they then leave the room.. there is NO WAY to have it filled by an AutoMatch, but you CAN see them leave... (how nice eh?)

4),如果游戏是使用GPGS,那么一旦一个房间已被创建并做了它对onRoomConnected阶段,它正在发挥并没有​​更多的比赛可以用那个房间来完成。所以,当你加入一个房间,其他人都已经加入在同一时间。因此,当一个玩家离开,其他人就可以加入。

4)If the games are using GPGS, then once a room has been created and made it to the onRoomConnected stage, it is being played and no more matches can be done with that room. So when you join a room, everyone else has joined at the same time. So when a player leaves, nobody else will be able to join.

公共抽象无效onRoomConnected(INT状态code,客房)

public abstract void onRoomConnected (int statusCode, Room room)

调用时实时房间里所有的参与者都完全连接。这被调用一次邀请所有接受任何必要的automatching已经完成。可能的状态codeS包括:

Called when all the participants in a real-time room are fully connected. This gets called once all invitations are accepted and any necessary automatching has been completed. Possible status codes include:

STATUS_OK如果数据加载成功,是先进的日期。
  STATUS_CLIENT_RECONNECT_REQUIRED如果客户端需要重新连接到服务访问此数据。
  STATUS_INTERNAL_ERROR如果在服务中出现意外的错误。
  参数
  房间里的完全连接房间对象。房间可以为空,如果它不能被加载成功。

STATUS_OK if data was successfully loaded and is up-to-date. STATUS_CLIENT_RECONNECT_REQUIRED if the client needs to reconnect to the service to access this data. STATUS_INTERNAL_ERROR if an unexpected error occurred in the service. Parameters room The fully connected room object. The room can be null if it could not be loaded successfully.

这篇关于谷歌播放实时多人游戏问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆