Need Help for Join the room!

Options
Hello everyone,
We are primary user,We use V1.22 version, we found a problem:
Assuming player1 create room A, palyer2 also joined the room A, and then player1
leave the room A enters the room B.
After a child, player1 exit the room B back to the room A, this time there are
about 20% chance to happen a problem, he can not join a room A. .

Our process is this:
We records the room name when player1 exit the room A , and when he want to
return the room A , it use "leave room" first, then returned to the Lite Lobby,
search room list, find the room A 's name , then Try to join the room A, but
failed, direct message "join the room failed ."

The caveat here is that 1, room A only one player, and is not full, the room is
open by default; 2 ,We can searched Room A 's name in room list, but join
failed . 3 When we try to create room A after join failed, but failed too,
because there are same room name. We do not know how to do.

In addition, we also tried other methods, after the failure in first joined,
the script automatically disconnected, and then reconnect join the room A, but
this does not significantly improved,

In addition 2, we watch that the room can not be joined only in the case when
back room , just restart the game, it will be able to join in the room, so we
think that there are somethings no reset when disconnected?

So we do this, after disconnect, we created a new LitePeer, and then try to join
the room A, so that every time we can returned the room A, seems to solve the
problem, but, player1 and player2 can not be see each other in the room A ,
although both names are exactly the same room! But it looks like a completely
different room, no association!

Just yesterday, we have updated V1.23.1 However, the situation seems worse. .
After the update is complete, no errors, I try to use my iphone and Unity editor
game join the same room, but there are also completely unable to see in the
same room, UI shows both room name identical.

We want to know is: Is it except for the name, to join the room there are other
identity? Why does the same room I feel like the name of the two players in a
different room?

what is the correct approach of repeatedly jump room ? I can not guarantee that
we are all doing the right thing, hoping to see an example

For example: Exit the room B, then disconnect, reset some parameters, and then
connect again, so that it can join the room A?

I feel we missing a ring, hoping to Exit Game engineers can give a reply, thanks
in advance!
Sorry for my bad english. :)

Comments

  • Tobias
    Options
    Hm. I don't understand yet why you want to hop through rooms but there are three things that keep you from entering an existing room:
    a) Each room has a maxPlayers value. If it's 2, only 2 players can be in the room any time. If a player does not properly disconnect or leave, the timeout for an automatic leave is up to 20 seconds.
    b) A room has a isOpen property. If this is false, you can't enter the room.
    c) The room might be in the lobby's room list but while you send your join request, it might become empty and closed (there is a delay before the lobby is updated).

    One of these must happen.
    Make sure not to close the room and keep an eye on the screen of the player who stays in the room: Make sure the leaving player gets removed from the player list to get an impression if the maxPlayer setting might be bad for your usecase.
    You can check out the "Demo Worker" in the PUN package. This should do what you expect. Compare it's code to yours.

    If you updated to PUN 1.23, make sure all clients are updated. PUN gets a new version number each update, so different client builds will be separated.
  • Thanks Reply
    I would like to explain that:
    room A is a camp, and the room B is a dungeon map.
    Therefore need to repeatedly return to the room A.

    a) we set maxPlayers value is 100, and it is normal exit when player1 exit the room A , I can see player1 object has been deleted in the editor .
    b) room 's isOpen property is true.
    c) room A has always been there, and did not close or is empty
    Because we are trying to build the same name as the room A but failed,

    And it can not return to the room of this situation does not always happen, it happens only at sometimes.

    Finally, I updated to PUN1.23, we use the same project to build on my iPhone, so in theory the items on the Unity editor and iPhone projects are identical.

    However, thanks to your suggestions, we look at the latest example, did find a number of different
    Because our script is written in reference to the previous example,
    For example at the beginning of the connecting portion:
    "Demo Worker" is written so this:
    public void Awake()
    {
    PhotonNetwork.automaticallySyncScene = true;
    if (PhotonNetwork.connectionStateDetailed == PeerState.PeerCreated)
    {
    PhotonNetwork.ConnectUsingSettings("1.0");
    }
    }

    Our Project is written so this:
    public void Awake()
    {
    if (!PhotonNetwork.connected){
    PhotonNetwork.ConnectUsingSettings("1.0");
    }
    }

    This is the point?
  • Tobias
    Options
    That piece of code only changes the check whether the client should do an initial connect.
    After that initial connect, the script might be run multiple times over when returning to the menu.
    This might relate to your project, yes, when you connect involuntarily when returning to the room you initially enter.
  • Thanks again to continue Replies
    Today, we address the use of the new version in the same room with each other
    can not see the problem ,Reason is our script .
    We expect players to be able to automatically join the room , formerly so
    written :
    PhotonNetwork.CreateRoom (roomname, true, true, 100);
    PhotonNetwork.JoinRoom (roomname);

    Yes, we want players to be able to automatically join the room , If there is no,
    on their own to create one.

    If this room exists, then CreateRoom will be fail, then it will automatically
    execute the commands - JoinRoom . Although there have been a red debug
    information , but the actual running well.
    So it is no problem in in PUN1.22,

    Now, in PUN1.23 , we found that the operating mechanism has been changed,
    CreateRoom even appear a red debug information (indicating there is the same
    name's room) , but it will still create a namesake room ! !

    Thus they are in "same" room but do not see each other 's situation . Because
    they do not in the same room.

    We changed to the following , it is much better
    PhotonNetwork.JoinRoom (roomname);
    ...
    function OnPhotonJoinRoomFailed () {
    PhotonNetwork.CreateRoom (roomname, true, true, 100);
    }

    Probably summarize:
    V1.22 version
    If there is same name's room, CreateRoom will report an error and will not execute .

    V1.23 version
    If there is same name's room, CreateRoom will report an error , but will still create a new room .

    We decided to update to V1.23 version, looking forward to not return to the room problem can be resolved. As to why there are two rooms with same name, it is still unknown.
    Thanks again
  • Tobias
    Options
    I guess the issue was due to calling CreateRoom and JoinRoom both. CreateRoom will also join it, so unless create fails, you shouldn't also join.
    It's much better to use one or the other like you do now.

    I implemented a new way to get into "known" rooms and create them if they don't exist. This will be part of PUN 1.24 and up (not yet released).
    This should possibly help in your case, too.