Get players in each region

Hello,
I'd like to display a list of available regions and the player count in that region. Is this possible without connecting to every region and getting the lobby stats from there?

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Moloko,

    Thank you for choosing Photon!

    Is this possible without connecting to every region and getting the lobby stats from there?
    No, that's the only way.
  • Kaiserludi
    Kaiserludi admin
    edited October 2018
    What you can do is write a special client that just connects to all regions and idles on the region masters 24/7 just to retrieve the player counts and run this client on your own server hardware. Then you can let your real clients retrieve the player counts for all regions from your own server, i.e. through HTTP.

    The downside of this approach is that it requires some additional development work from your side.

    The advantage however is that only this special client and not all of your clients need to connect to all regions and your other clients can instantly retrieve some cached values and don't have to wait until they have connected to all regions themselves, which is especially making sense for PUN, as PUN can't be connected to more than one region at once.
    Also you always have up to date values for all regions without having to stay online in each region with every client all the time, which would end up into each client counting against the CCU once per region instead of once overall.
  • Thanks for the replies. Coding a simple javascript server to get the players sounds like a good workaround.
  • I'm having difficulties writing the script to retrieve player counts:
    https://forum.photonengine.com/discussion/12959/wrong-game-peercount-in-photon-javascript#latest