Player Names in Room v.2.0 Server

Options
shanefarris
edited January 2013 in Photon Server
How do I store player names in LitePeer, and have the room they are in store those names? I'm using the Photon.NetSyncObject.Server project to host my game.

Thanks.

Comments

  • chvetsov
    Options
    Hi, shanefarris!

    It seems, that you can not store user name in LitePeer. And room does not store it.
    You need to add this functionality manually
  • dreamora
    Options
    In Lite and its extending versions (Lite + LiteLobby as well as the Cloud / LoadBalancing instance), the player stores it in form of the PlayerProperties. You can also store whatever else you want in there. For each of them you can decide if a change to them is broadcasted (sent to all players in room) or only stored (in which case its changed locally and on the server).

    For that reason the room also does not really need to store them, the room on the server can just get it from the connected players properties.
  • Yeah, I can get a room based on its name, so it would be easier to get the room and then get the players in the room. So I need to get a list of all the players, then iterate through all of them and get the room from there? How do I get the complete list of players?
  • I'm not completely sure what you are trying to achieve - can you please give us a short description of your use case?

    As dreamora said, we don't have built-in "Usernames", but you can set properties for players and rooms - so each player could have a "username" property and each room could have a "list of all player names" property, which is updated each time a player joins or leaves a room. There's an example for this in the LiteLobby Chat demo: http://doc.exitgames.com/photon-server/ ... y_ChatDemo

    If you still have questions, please let us know what exactly you want to do (on client & server), and we can give an example that fits your requirements better.
  • I am trying to see who is in what room. If the room doesn't contain the list of players, then I will have to iterate through a list of players (peers?) to get their state and then the room right? How do I get a list of all the players?
  • dreamora
    Options
    you can not get all connected players through any function.
    You can only get rooms.

    The room would have to provide you with the player names, but as you are on an outdated photon version you can't use the exposed room properties to transfer this information easily into the room list, so you would be required to backport this feature kinda
  • What do you mean backport?

    I want to get a list of players that are in a room, can I do that and how?