当同伴从Google Play服务中的某个房间离婚时 [英] When a peer disconected from a room in google play services

查看:74
本文介绍了当同伴从Google Play服务中的某个房间离婚时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

断开对等端与离开房间的对等端之间有什么区别

What is the different between a peer dissconnected to a peer leaving a room.

如果参与者从房间断开连接,他的身份将是什么? STATUS_JOINED还是STATUS_LEFT?

if a participent disconnect from a room, what would his status be? STATUS_JOINED or STATUS_LEFT?

我正在做一个相当长的回合制游戏(应该是几分钟的游戏),我相信我想解决的案件很多.

I'm working on a fairly long turn based game (should be a few minutes game) and i believe there would be alot of disconnecting cases that i would like to resolve.

是否可以向断开连接的用户重新发送邀请并将其带回房间?

Would it be possible to resend an invitation to the disconnected user and get him back to the room?

如果房间创建者已断开连接,并且有可能存在先例,那么重新连接后他是否仍将是该游戏的创建者?

if the room creator got disconnected, and the previuse was possible, would he still be the creator of that game after reconnecting?

推荐答案

第一个警告是,实时多人游戏API并非真的适用于回合制游戏.因此,如果有人从房间掉下来,就无法重新添加.同样,如果您的活动进入后台,您将不能留在房间里.现在,要解决这个问题:

The first caveat is that the Real Time Multiplayer API is not really meant for turn-based games. So if someone gets dropped from the room, they can't get re-added; also, you can't remain in the room if your Activity goes to the background. Now, to get to the question:

  1. 如果参与者离开会议室,则其状态为STATUS_LEFT.如果它们在房间中但仍无法到达(即玩家尚未成为P2P连接图的一部分),则它们可能处于STATUS_JOINED状态,但尚未连接.此外,由于存在错误,您可能会看到参与者具有STATUS_LEFT,但仍报告为已连接.因此,在检查参与者是否真的在那里"的逻辑中,应检查参与者是否处于STATUS_JOINED状态(不是一个或另一个)已连接.

  1. If a participant leaves the room, their status is STATUS_LEFT. If they are in the room but can't be reached yet (i.e. the player is not yet part of the P2P connected graph), they might be in the STATUS_JOINED state, but not connected. Also, due to a bug, you might see a participant who has STATUS_LEFT but still reports as connected. So, in your logic to check if a participant is "really there", you should check that they are in STATUS_JOINED state and connected (not just one or the other).

您无法将邀请重新发送给断开连接的用户,以使他们回到会议室.但是,如果所有玩家都具有游戏状态,则没有什么可以阻止您从头开始建造新房间来继续游戏.当然,这不适用于自动匹配功能(因为您不能要求新房间的参与者与旧房间的参与者相同),但是在玩家与圈子中的朋友一起玩时可以使用.

You can't re-send an invite to a disconnected user to get them back in the room. But if all players have the game state, nothing prevents you from building a new room from scratch to continue the game. Of course, this won't work with automatch (because you can't request a new room with the same participants as the old one), but would work when players are playing with friends from their circles.

没有房间所有者"之类的东西-它是一个P2P对称网络.如果玩家A创建游戏室并邀请游戏者B和游戏者C,那么游戏者A可以离开游戏室,游戏者B和游戏者C仍然可以使用该游戏室.不要求游戏室的创建者留在游戏室中.

There is no such thing as the "room owner" -- it's a P2P symmetrical network. If player A creates the room and invites player B and player C, player A can then leave the room and the room will still work for players B and C. There is no requirement that the creator of the room remain in the room.

希望这会有所帮助!

这篇关于当同伴从Google Play服务中的某个房间离婚时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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