What's the right way to enter a custom lobby instead of default when connecting to Master?

Hi guys!

What I'm trying to achieve is to get filtered room lists on different lobbies, so if a room is created on lobby A it's only visible on lobby A.

I can create rooms on a specific lobby, but I'm struggling to connect another client to that lobby after. I've checked the documentation and I believe this use case is not quite clear.

Any thoughts to avoid filtering on the client? Am I missing something?

Thank you!

Answers

  • Hi,

    Currently you can choose lobby if connect directly to master: https://doc-api.photonengine.com/en/corona/current/modules/loadbalancing.LoadBalancingClient.html#instance:connect
    Do you use nameserver instead?
  • Hi vadim,

    Thank you for your answer! Currently I'm using client:connectToRegionMaster("us") to start the connection, so yes I think it's connecting to nameserver before actually connecting to master.

    I tried the connect method to connect directly to master, specifying the lobbyName in the options parameter, but I'm getting the following output in the console:


    Wed Jun 12 12:33:14 2019 INFO LoadBalancingClient: State: Uninitialized -> ConnectingToMasterserver
    STATE CHANGED: ConnectingToMasterserver
    Jun 12 12:33:14.642 Wed Jun 12 12:33:14 2019 INFO LoadBalancingClient: Connecting to Master ns.exitgames.com:5058
    Wed Jun 12 12:33:14 2019 TRACE PhotonPeer: create
    Jun 12 12:33:14.643 Wed Jun 12 12:33:14 2019 INFO PhotonConnect: ns.exitgames.com:5058 start connection to host
    Jun 12 12:33:14.776 Wed Jun 12 12:33:14 2019 INFO PhotonConnect: ns.exitgames.com:5058 ns.exitgames.com 5058 successful start connection
    Jun 12 12:33:14.776 Photon initialized successfully!
    Jun 12 12:33:15.335 Wed Jun 12 12:33:15 2019 INFO LoadBalancingClient: Master: Connected
    Jun 12 12:33:15.665 Wed Jun 12 12:33:15 2019 INFO LoadBalancingClient: Master: Encryption Establishing...
    Jun 12 12:33:16.292 Wed Jun 12 12:33:16 2019 INFO LoadBalancingClient: Master: Encryption Established
    Jun 12 12:33:16.299 Wed Jun 12 12:33:16 2019 INFO LoadBalancingClient: Master: Authenticate...
    Jun 12 12:33:16.541 Wed Jun 12 12:33:16 2019 INFO LoadBalancingClient: State: ConnectingToMasterserver -> Error
    STATE CHANGED: Error
    Jun 12 12:33:16.542 Wed Jun 12 12:33:16 2019 ERROR LoadBalancingClient: Load Balancing Client Error 1101 Master authentication failed (65534 Missing value 210 (AuthenticateRequest.Region)

    )


    Seems like I need to specify which region to use, but I didn't find in options parameter a way to do so. Maybe I should get regions before, but I think this forces me to connect to nameserver.

    Any thoughts? :smile:
  • PipeRock
    PipeRock
    edited June 2019
    Ok, so I noticed that if you want to connect to master using connect method you have to provide the IP of master server. As I want to be "load balanced" and also specify region I have to stick to the connectToRegionMaster method as specified in every demo/example.

    Fortunately, I realized that you can still select which lobby to enter by default intercepting the state change just after state State.ConnectedToMaster using onStateChange.

    So, in a very simplified fashion, you could do the following:

    function client:onStateChange(state)
    if state == LoadBalancingClient.State.ConnectedToMaster then
    -- Connection to master succeded, set the name of the lobby to join by default
    client.connectOptions["lobbyName"] = "defaultLobbyName"
    end
    end
    Hopefully, this will not break in the near future :)

    Hope this helps anyone!
  • Glad that you found a workaround. It should work in the future though I hope we will find a time to add lobby options to nameserver connection calls parameters