Photon Server and Ping List collection

Hello,

I understood the cloud server logic of PUN (named, master,game servers...), I have no problem in connection to pun servers in my game with best server option. I also want to let client change server option with server props (i.e. ping, number of players in that region, etc...). However, although I found related I could not implement them...

How can I do it? I use PUN2.

I want to contruct following functions but I could not succeed. I could not find any example...

void LoadServers() ==> Load the list of available servers and ping info of each of them (might be a list). The number of active players in that region server would be also great!

void ChangeServer(string servertoken) ==> connect to master server of a given region (i.e. eu or us).

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited January 2020
    Hi @Storm,
    void LoadServers() ==> Load the list of available servers and ping info of each of them (might be a list). The number of active players in that region server would be also great!
    PUN already does this you can take a look at the code and do something similar. Client connects to name server and authenticates, then calls OpGetRegions, after getting the response and parsing it, the client pings each region using RegionHandler. The result would be a region token + master server address per region + ping average/summary to that server.
    To get the number of players on a server you need to connect to it first. So if you want to get the number of players on each server you need to connect to each master server one by one separately using a single client OR have a LoadBalancingClient per region. Not so convenient but that's how it is.
    void ChangeServer(string servertoken) ==> connect to master server of a given region (i.e. eu or us).
    This is already available ConnectToRegionMaster()
  • Thanks a lot!