Photon Cloud & High Latency

Options
Kuroato
edited January 2013 in Photon Server
Hello,

I hope this is the right place to post this Question since it is dealing with Server Side.

How does Photon Cloud handle High Latency Clients? Does Photon Cloud have some kind of built-it Anti-High Latency System ? Basically what i'm asking If I am using Photon Cloud with a default Setup from my Project / Client Build, if my ping is lets say at 50 ping, and other players connect to my game with high pings of 200+, will Photon Cloud automatically Kick these Players Off to prevent the Server / Game from Lagging?

If Not, what I can I do to prevent High Pingers (high latency) Connections to my Game using Photon Cloud?

Comments

  • chvetsov
    Options
    Hi, Kuroato.

    Defenetly, Photon Cloud will not do this automaticly, because reaction on this depends on game.
    Photon.SocketServer.PeerBase contains two properties 'RoundTripTime' and 'RoundTripTimeVariance'. this properties will help you to detect High latncy users. So later you can kick them
  • Thank you! but how do i do this exactly? is there any documentation you can link me to for how to kick high latency users with Photo Cloud?

    I'd like to try set this up for auto kick after a certain ping.
  • chvetsov
    Options
    I'm not faviliar with Photon Cloud a lot, but i think that to disconnect user you can use peer.DisconnectClient().

    How to detect user with Hi latance?
    I can offer next idea. You will have a timer. Let say every one second. And when you get this timer you will check peer.RoundTripTime if it will be to hi, you can increase some counter for this user. And when this counter will be more than 3, just disconnect user
    In this case you will disconnect user if he has hi latency more than 3 seconds.

    make it sense for you?
  • Let's be careful that we don't mix things up here :)

    It is correct right that Photon Cloud does NOT disconnect high latency clients automatically (as long as they manage to send some data before a certain "timeout" time span has passed, which is in the realm of ~ 5-10 seconds).

    If you are using a self-hosted Photon server, you can modify the server-side game logic and use the RoundTripTime & RoundTripTimeVariance properties of the Photon.SocketServer.PeerBase class, as Ilya has explained. Unfortunately, it is currently NOT possible to modify the server-side game logic in this way on Photon Cloud (only on self-hosted Photon Server installations).

    So the only viable option for Photon Cloud is to do the round-trip-time check on the client side and disconnect your client if the round trip time is too long. I believe that most client SDKs have built-in methods and properties that provide information about the latency, so you can modify your client like this:

    a) disconnect the client if the round trip time exceeds a fixed value or,
    b) at regular intervals, each client publishes it's own performance (you could use a property or event that contains the round trip time) to the other clients in the same room, and each client can calculate if it's own performance is good enough in comparison to the others, and disconnect itself if it's latency is to high.

    There are probably some other (and maybe better) ways to achieve this, but whatever you choose to do, you need to handle this on the client side.
  • Thank you all for your responses... I think that since I am using Photon Cloud, I will probably utilize the option of providing different Web Player Clients offering Players the ability to Connect to Different Regions. So this should help with this problem abit, then if I really need to dive in and disconnect the laggers... then i'll do it.

    thanks again!