Why one device is not detecting other connected devices to photon cloud?

edited October 2017 in Native
I have three devices connected to photon cloud A,B & C. device A and device B is showing 2 devices are connected but device C is connected to photon but not detecting A & B and showing only 1 device connected for itself. What is the issue here? Thanks.

Comments

  • JohnTubeJohnTube mod
    edited October 2017
    Hi @AnkitKushwah,

    What Photon value do you use to get count of "connected devices"?
    From client or from server?
    You should know that app stats may take some time to refresh.

    Do you connect to Photon Cloud or Photon Server?
    Read more about Photon Lobby and App Stats.
    Also the two devices/clients could be connected to different virtual apps.
    Read our "Matchmaking Checklist".
  • Hi,

    I am using load balancing client like this :

    int NetworkLogic::getPlayersNotinRooms()
    {
    return mLoadBalancingClient.getCountPlayersOnline();
    }


    I am using photon server.
  • edited October 2017
    Hi @JohnTube ,

    Sorry we are actually using photon cloud but I have appID and AppVersion. Sometimes devices shows the right number and sometimes they don't show the right playerCount. I am not changing the appID or appVersion. The build is same in both devices. Any idea what is happening?

    Thanks.
  • @JohnTube

    what do you mean by Photon Value ?
  • JohnTubeJohnTube mod
    edited October 2017
    If you read the docs carefully you will know that:
    • Number of connected players is part of AppStats event sent by server to clients.
    • You need to be connected to a Photon Master server (not joined to a room) to get AppStats event.
    • AppStats is send every 5 seconds.
    This should explain what you are reporting.
  • Value is not updating. It's the same after 5 seconds. I am calling run() in every frame. If I restart my app again then I can see the right number of devices. I will give you more info regarding this after I'll be sure that my code isn't the problem. I checked it several times. Thanks anyways.
  • Hi @AnkitKushwah.

    In the related ticket you have mentioned that the players from you different devices are not able to join the same room.

    Additionally with the information that you have provided in this thread this leads me to the idea that the most likely cause for what you are observing is, that the two devices are connected to different Cloud regions.

    Are you by any chance using RegionSelectionMode::BEST?
    Doing so means that each client will connected to the Photon region to which it has the best ping.

    However when the region with the best ping differs between two clients that of course means that those two clients will connect to different Cloud regions.
    Clients on Photon Clouds can only see other clients when the appID, the appVersion and the region match. As you have already checked the appID and the appVersion this leaves us with the clients connecting to different regions.

    Please try if using RegionSelectionMode::SELECT instead helps.

    With RegionSelectionMode::BEST a client requests the list of available regions from the Photon Cloud nameserver, then pings all regions and then automatically connect to the region with the lowest ping.

    However with RegionSelectionMode::SELECT a client requests the list of available regions from the Photon Cloud nameserver, then passes that list to your implementation of Listener::onAvailableRegions() then pauses the connection flow and waits for you to call Client::selectRegion(), then it continues the connection flow by connection to the region which you have specified in your call to Client::selectRegion().

    Both ways are demonstrated in demo_loadBalancing inside the Client SDKs demo folder. That demo uses RegionSelectionMode::BEST out of the box, but it also implements Listener::onAvailableRegions() and you can change the value of the regionSelectionMode variable at the top of NetworkLogic.cpp to let is use RegionSelectionMode::SELECT.

    If you have 1 device located in India and one located in Brasil for example, then the former device will most likely get the best ping result for the Indian Cloud region, while the latter one will get its best ping result for the South American one, so that the will connect to different regions. With many players online world wide and a type of game for which ping time is relatively important this is advantageous to ensure low pings.

    However with only few players and a game which can work with sub-optimal pings, you might want to prefer players to connect only to certain regions to make sure that there will be opponents available for them in the region to which they are connected.
    For example you could have both, that Indian player and that Brazilian player from my above example, select the Photon Cloud EU region so that they can play against each other.
  • Yes Indeed I am using RegionSelectionMode::BEST . Thanks for explaining this briefly. It helped. Thanks a lot.
  • briefly
    :D
  • In Kaiserludi terms it actually is brief ;)
  • Hi @Kaiserludi ,
    Both the devices I have been using are connected to the same internet connection, so they should be getting the same best region.
    I haven't tested it but I'm assuming they should have the same best server region, considering the fact that they are sharing one single internet connection.

    Thanks.
  • Hi @AnkitKushwah.

    That is not necessarily true.

    If those clients are located near the servers of a certain region, then it's likely that that region will be the best region result for both of them, but if they are located in a place where the pings to the two best regions are very similar to each other, then the best region result might be vary between those 2 regions. The ping results can vary with each ping. So for example the average ping to region A could be 85ms and to region B 87ms, but 5 seconds later it becomes 86ms to A and 82 to B for the same client connection.

    Are you experiencing this for connection of one of your customers or is that a connection that is used by you own team? In the latter case you might just retrieve the IP addresses for all regions (by using RegionSelectionMode::SELECT and reading them out in onAvailableRegions()), open a command prompt in your OS and run the ping command for all IPs. You could then see the pings from your connections to the various regions.
Sign In or Register to comment.