Facebook Photon Authentication

Options
After Facebook Login, one player Join Lobby, When second player join lobby "OnJoinedLobby" event call on second player side and player counts are now 2 on second player side. But first player count is 1. How will first player know other player join the lobby. Is there any event which call on first player side to know other player join the lobby. Is there any other way to start the game between players.

I completed my multiplayer with PUN. But when connected through Facebook i am freeze at this issue. Need help on this. If anyone integrate Facebook using PUN please help me.

Thanks in advance.


Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @app_mechanic201,

    Thank you for choosing Photon!

    How will first player know other player join the lobby
    No, you should do this using Photon Chat or something other than Photon Realtime / PUN as using those clients can't communicate when in lobby, they can communicate only inside the exact same room. You could look into ways of sending messages or app invites or challenges via Facebook API. You will need the Facebook SDK of course for that.

    The issue is not really related to Facebook authentication, so the name of the topic should be changed.
  • [Deleted User]
    Options
    Hi @app_mechanic201,

    to get the current number of players that are inside the lobby, you would have to check PhotonNetwork.countOfPlayersOnMaster regularly and update your visualization accordingly. There is no other possibility while the client is in the lobby. Would be something different if the client is already in a room.

    To get matches as fast as possible, you could try another 'workflow' like the following: as soon as a client has joined the lobby, he can try to join a random room by using PhotonNetwork.JoinRandomRoom();. If a room is available, he will join it. If there is no room available a callback will be called. This one is void OnPhotonRandomJoinFailed(object[] codeAndMsg). Inside this callback, the client can create and join another room.

    When the client has finally joined a room, he can wait for the void OnPhotonPlayerConnected(PhotonPlayer newPlayer) callback, which tells him, that another client has joined the room.