lobby chat

Hello!

Is it possible to be in a room and still receive room list updates? (for a lobby with a chat)

What approaches are possible here?

thanks,
Slav

Comments

  • No thats not possible, if you are in the room you can't be in a different room so the room list is meaningless as you need to leave the current one first to go anywhere else
  • You can't get the room list unless you're completely disconnected from a game?
  • I used this while I was in a room and it worked just fine. It just doesn't show the room you are in. But if you start two different rooms at the same time they will see each other.
    foreach (RoomInfo roomInfo in PhotonNetwork.GetRoomList())
                {
                    GUILayout.Label(roomInfo.name + " " + roomInfo.playerCount + "/" + roomInfo.maxPlayers);
    }
    

    So you should be able to make people just join a Lobby room and then list the other rooms with this inside.
  • The room list is provided and updated by the lobby and this is only available on the master and while you're not in some room.
    So, yes, it's available after you joined a room but no, it's not up to date.

    Why have a room list updated while you're playing.
  • Gnoblin made another example of if you wanted to join other rooms with you friends in "squads" You could have a chat going in one room and then join the next in squads (the squad being whomever is in the "chat" room).

    What if you wanted to just switch servers like in a half-life game? You can just press escape and update the room list (without leaving the game you are in) and then join another server or stay in the one you're in if you don't want to room switch. Now if you're saying it's not constantly updating like while you're in the lobby that's fine. But the person should be able to at least refresh it on command?
  • You could implement this with the Photon Server SDK, based on the source of the Loadbalancing Application included.
    The Photon Cloud does not currently enable you to fetch the room list while on a Game Server (playing in some room).

    Depending on the needs of developers and customers, this might get on our roadmap.
  • How come this code works then when you just create or join the room?
    foreach (RoomInfo roomInfo in PhotonNetwork.GetRoomList())
                {
                    GUILayout.Label(roomInfo.name + " " + roomInfo.playerCount + "/" + roomInfo.maxPlayers);
    }
    

    It doesn't refresh though. Isn't there a way to "fake" being in the lobby for 1 frame or to quickly leave and re-enter the room you were in in the same position so that the room list updates. This is definitely a really important issue to me. I feel like it's only a couple of lines of code somewhere in the Photon scripts in unity? What exactly is restricting from sending the room lists while you're in a room?
  • when you leave the room and reenter it you will definitely not do it within 1 frame or anything in the millisecond range.
    also all your belongings in the room will be removed when you leave the room as your peer is terminated. not even your id will be the same on returning as the room internal id is not server wide unique
  • Yeah even if it's not in the millisecond range, that's ok. But I just hope I don't have to take a separate approach to solving this issue.

    Here's a couple solution ideas...

    Every time you start a server, send the server data to an SQL database (not ideal).

    Maybe have one computer that is constantly in the lobby checking the status of the games and uploading the data elsewhere. Then while in the game, people could read it with a WWW form?

    Once again I feel like changing a couple of lines of code somewhere in the Photon Network unity .cs files would expose where it determines whether or not to look at the Room list?
  • you need to modify the server code, the client code has nothing to do with this I fear.
    And in case of LoadBalancing (which is the server side of PUN) this can be a more complex task at times
  • Dreamora or Tobias, what do you think the best solution for seeing the game list while in a room is, while still using Cloud? Is there a way to make it communicate with a normal photon server?

    Is there any way to see what servers are running on my application id/game while not being inside of unity? like from a webpage?
  • Everybody is supposed to create or join rooms on the master server. This is the basic principle of loadbalancing. Also, you get the room list but unless you tell the master you want to join one, you have no clue where it is located - we have multiple game servers after all.

    If you absolutely must, you could create another networking peer and connect that to the master and the lobby. It would get the list and updates but to make your "first class" peer join a room, it still has to quit the current, connect to the master and (without joining the lobby) it has to join the picked/new room.

    Possible at the cost of an additional concurrent user, which is one of the limiting factors for subscriptions on the cloud.
  • Would you just make a second networkingPeer variable in the PhotonNetwork class and then duplicate it's code where it returns values then? Would this potentially half the number of CCUs?

    Actually, what if just the master player in the room was grabbing the master lobby info and then RPCing it to the other players when they needed to check the server list. That way only the master player would need the extra networkingPeer, so a "lobby room" with 20 people in it would have 21CCUs.

    Also a method that I figured out last night that seems to work is to have players send their server data when they connect to an SQL database that I have running. Every 30 seconds or so, the master player can send the current state of the room to the database again. The players can easily read this database from within the game and get the variables you need, like the player number, map, and room name. This solution may not work for every game but it is a start.
  • Tobias wrote:
    You could implement this with the Photon Server SDK, based on the source of the Loadbalancing Application included.
    The Photon Cloud does not currently enable you to fetch the room list while on a Game Server (playing in some room).

    Depending on the needs of developers and customers, this might get on our roadmap.

    I would find this feature very valuable!
  • I don't think it makes sense to duplicate the room list into a database. It is outdated the moment you write it.
    Also it's a (really) bad idea to fetch the roomlist to then send it from one client to the others. This might be a really long list.

    If you really need to do this, you either need a second peer to connect (check out the Unity Lobby Chat Demo from the client SDK from our page) or you have to add this feature to the server.
  • I'm assuming you're talking about the "demo-litelobby-chatroom" from here: https://www.exitgames.com/Download/Photon/Photon%20v3.Photon-Unity3D_v3-0-1-2_SDK.zip

    I'm trying it right now, but does this work with cloud just so others can know?
  • Ok I tried loading the lite chat demo and putting in app.exitgamescloud.com:5055 for the serverAddress and it errors out with a null reference exception on line 171 of PhotonClient.cs

    this.ActorNumber = (int)operationResponse[(byte)LiteOpKey.ActorNr];

    what to do?
  • The Chat Lobby Demo is not built for the cloud but for a local server running the "Instance1" setup, which includes the LiteLobby application (server logic). Sorry, forgot to mention that.
    None of our Cloud / LoadBalancing demos uses 2 peers (connections) but the principle of using a second peer can be applied to the Cloud as well.
  • Got it fully working with SQL database. Doesn't even access the Room list at all.

    All info is sent to and comes from the database, and is updated every 5 seconds. Checks server to make sure there has been an update in the last 15 seconds or else it doesn't come up on the lobby list. Works while in a photon room or outside of one.

    I guess this is a fine solution for now, and it's nice cause you can see the servers that are up from a website as well if you want without being in the game.
  • xblade724
    xblade724
    edited June 2017
    Tobias said:


    Why have a room list updated while you're playing.

    Just because you're in a room does not mean you are playing. Think staging, like League of Legends matchmaking. We have 16 people matchmake and, during Alpha/Beta, population is low so it takes time.

    During this time, you may want to ask your friend to get on. "Hey man, 4/16, hop on". He hops on. "Dude, where are you? We're all waiting on you" and he responds "IM HERE! I see you, why can't you see me?". The guy in the room can never invite his friend to the same game because he never comes online due to not being able to update friends list or get updated lobby info while in the staging room.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @xblade724,

    I see your point.

    Currently only Photon Chat is suitable for this use case.