join with friend to random room

Options
hey !
I'm trying to make a situation where I can connect with a friend to an existing room or create a new room with him together (not a private room) that if another pair of players want to enter together they can.

I read here: https://doc.photonengine.com/en-us/pun/current/lobby-and-matchmaking/userids-and-friends

But I did not understand one thing.
When I try to connect to an existing room for example, and I enter my friend's ID in the room entry function to save space for him, how can my friend find the space reserved for him?

I'm trying to create a game like Fortnite that I can enter a random room with more people and with a friend or more.

Thanks for the help.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @orim,

    Thank you for choosing Photon!
    how can my friend find the space reserved for him?
    there are multiple ways:

    1. if you can share the room name between friends (either using PUN/Photon Realtime if joined to a room, or via Photon Chat or via an external service) then all of them can use JoinRoom or JoinOrCreateRoom at some point.
    2. If one of the friends takes care of (teams/party) matchmaking then the other team members or friends on the same team can join him by getting the room name he is in by repeating calls to FindFirends until it returns a room name.
  • orim
    Options
    JohnTube wrote: »
    Hi @orim,

    Thank you for choosing Photon!
    how can my friend find the space reserved for him?
    there are multiple ways:

    1. if you can share the room name between friends (either using PUN/Photon Realtime if joined to a room, or via Photon Chat or via an external service) then all of them can use JoinRoom or JoinOrCreateRoom at some point.
    2. If one of the friends takes care of (teams/party) matchmaking then the other team members or friends on the same team can join him by getting the room name he is in by repeating calls to FindFirends until it returns a room name.

    thank you !

    I tried to use option 2, but when I enter the ID of a particular user in FindFriend function it always returns true. Whether connected or not to the server.
    Can you please explain to me how to use this function properly?
    And if the player I'm looking for is in a room, how can I get the name of the room where the player is with this function?
    I have tried to find answers to these questions online without success.

    Thank you!.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @orim,
    if (friendInfo.IsInRoom) 
    {
        string roomName = friendInfo.Room;
    }