Search Unity

Third Party Photon |Getting Room informations without running a for loop

Discussion in 'Multiplayer' started by EmreB05, Aug 13, 2015.

  1. EmreB05

    EmreB05

    Joined:
    Aug 9, 2015
    Posts:
    13
    So what i need to do is getting room informations without running a for loop and yes i do know name of the rooms. I am hosting those rooms at my own servers.

    The reason why i dont want to use a for loop is i was using a very simple for loop that i found at Photon documents and somehow that for loop is not working. Also if there is anyway to get room information with specifying the room name that would be much more stable for my situation.
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,068
  3. EmreB05

    EmreB05

    Joined:
    Aug 9, 2015
    Posts:
    13
    Thanks for the reply,

    The reason I wanted to avoid for loop is i am not very familiar with Photon API so i dont know what type of loop i am supposed to run.
    I found an example from your documents 'http://doc-api.exitgames.com/en/onpremise/current/pun/doc/general.html' but it seems to be not working. If there is any way to make it run, that could solve my issue from all aspects.

    At the meantime what i am trying to do until i find a way to fix that for loop issue getting count of players number connected to that room. I know room's name, their ips and all that information since im hosting rooms at my own servers as a master client.

    But, as i said;
    If there is any way to fix that foreach loop that could solve my issue from all aspects and that could even give me more possibilities to create a better matchmaking service.
     
  4. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,068
    You have the IP addresses listed? Why that? Photon gives you the IP when the client wants to join a particular room.

    I still don't know what the problem is. The for loop does not work. Which one? With which values?
    Check out this post, if you want to use Photon's lobby:
    http://forum.photonengine.com/discussion/6426/
     
  5. EmreB05

    EmreB05

    Joined:
    Aug 9, 2015
    Posts:
    13
    Okay, sorry for the misunderstanding.

    I have the ip adresses of the master clients of those rooms because i am the only one who is able to create a room and i host my rooms in my own dedicated servers to make it run 24/7. What i mean by i have the ip adresses is that; I have every single information related to the master clients of the rooms if i need it inorder to get room infos. I am not telling these just to tell people that i have got dedicated servers... What im trying to say is;

    I just need answer for this question;
    How can i get the room information of a specific room such as connected player amount? I just need to get connected player amount of a specific room.


    Oh btw here is the link of the broken for loop: http://doc-api.exitgames.com/en/onpremise/current/pun/doc/general.html there is a foreach loop to show rooms as a list, that script example is not working.
     
  6. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,068
    As long as a client is in a Lobby in Photon, you get the list of rooms of that lobby. You can loop through this list with:
    foreach (RoomInfo roomInfo in PhotonNetwork.GetRoomList()) {}

    The list won't be set if you are in a room or not in a lobby. Find the PhotonServerSettings object in your project and set "AutoJoinLobby".
    Check out the Worker Demo for a showcase.

    I don't understand where you stuck and I feel like this should be enough info and demo code to implement what you need.
    Let me know where you're stuck.
     
  7. Carterryan1990

    Carterryan1990

    Joined:
    Dec 29, 2016
    Posts:
    79
    you gotta delete these links i swear every one is dead lol
     
  8. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,735
    From a four year old post it's hardly surprising :rolleyes:
     
    SweatIRL likes this.
  9. Carterryan1990

    Carterryan1990

    Joined:
    Dec 29, 2016
    Posts:
    79
    That is true.. But you know If I ran a company I wouldnt want to have invalid information anywhere. Guess thats just my 2 cents, glad you had to throw yours in too.