Not connecting to room with Unity 2017.4.2f2 and PUN Voice 1.13.1

crystalpug
edited May 2018 in Photon Voice
Is anyone else having this issue?

I had been using Unity 2017.1.1f1 with PUN Voice 1.13 and everything was working fine with room connections and multiplayer. I recently upgraded to Unity 2017.4.2f2 and it still works.

However, if I update to PUN Voice 1.13.1 (which includes PUN 1.89), the clients fail to connect with other rooms, saying none were found with matching custom properties (both are searching for the same properties with values 0 and 0). In which case, they both just open a new empty room and wait for others to join.

I rolled back to 1.13 with exactly the same code and steps, and the game works as intended.

Code below:
RoomOptions RoomOps;

void Start ()
{
               RoomOps = new RoomOptions ();
               RoomOps.CustomRoomPropertiesForLobby = new string[] { "mo", "st" };
               RoomOps.CustomRoomProperties = new ExitGames.Client.Photon.Hashtable () { { "mo", 0 }, { "st", 0 } };
               RoomOps.MaxPlayers = 2;

               if (PhotonNetwork.connected)
                              JoinRoom ();
               else
                              PhotonNetwork.ConnectToRegion (CloudRegionCode.us, Settings.VersionStr);
}

public override void OnConnectedToMaster ()
{
               JoinRoom ();
}

void JoinRoom ()
{
               PhotonNetwork.JoinRandomRoom (RoomOps.CustomRoomProperties, RoomOps.MaxPlayers);
}

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @crystalpug,

    Thank you for choosing Photon!

    This is expected if you update PUN.
    Read about Versioning in PUN.
  • Hi @JohnTube, thanks for the suggestion but that's not the issue. I am building to both devices each time with the same version (PC & PC, or PC & tablet).
  • JohnTube
    JohnTube ✭✭✭✭✭
    Could you go through our Matchmaking Checklist?
  • Hi @JohnTube, thanks I've checked through the list and I'm doing everything in it
  • JohnTube
    JohnTube ✭✭✭✭✭
    I assume you are creating a new room if none was found, so both clients end up creating two separate/different rooms.
    Is that so?
    Do you explicitly name the rooms?

    Maybe it is a timing issue then.
    Probably you are trying to call JoinRandomRoom "at the same time" from the two clients.
    Try waiting for the room creation to be complete and for one client to join a room then do it from the other one.
    You could rely on AppStats or on FindFriends to make sure there is a room already and the other client is already in a room.
  • crystalpug
    edited June 2018
    @JohnTube After much head scratching I finally tracked down the issue. The two players cannot see each other's room because they have the same playerName. Setting unique playerName's is a "to do" in my new game, as I have not implemented social services yet (players are all assigned the same name "Player0"). However, looking at the docs and forums, I can't see anywhere stated where PhotonNetwork.playerName (a.k.a. NickName) needs to be unique? Is this a bug or in fact intended?

    Below are details on how to reproduce:

    1. Open PUNVoice/DemoVoice/DemoVoice-Scene.scene
    2. Edit ConnectAndJoinRandom.cs on the "PUN" object in the scene.
    3. In the Start function, add the line: PhotonNetwork.playerName = "SameName";
    4. Run an instance game in an EXE build
    5. Run a second instance from the Editor - it fails to find the room created by the EXE, so it creates a new empty room - hence the two clients are not visible to each other

    Note that this error occurs in Photon Voice 1.15, and from previous attempts at updating, I believe it began occuring from 1.13.1 onwards. If you perform the same steps above with Photon Voice 1.13, you will note that the two instances connect successfully in step 5.
  • Also, another issue I noticed when using the demo scene is that the bunny avatars slowly fall through the floor once connected.
  • Also, the two files Plugins/x86/libopus_egpv.dll and opus_egpv.dll appear to be incorrectly flagged as x64 in their platform settings properties, creating a build error on standalone unless the x64 properties are unchecked.
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited June 2018
    Hi @crystalpug,

    Thank you for all the valuable feedback.
    We appreciate it.
    We will fix and update accordingly.

    About the PhotonNetwork.playerName and UserId uniqueness (a PUN thing discussed here), here is how the UserId is set in PUN now:

    1. If Custom Authentication is configured and auth provider endpoint returns UserId then that UserId is used.
    2. Else if the client sets the UserId before connecting then that UserId is used.
    3. Else the Nickname (previously named playerName or name) is sent and used as UserId.
  • Ok good to know, thanks John. I hope the docs can be updated accordingly, cheers!