Detecting other player disconnection before server timeout

Options
I have a case when detecting disconnection is really important so I can show to other players a dialog where they are notified that player has disconnected and they are waiting for him to reconnect.
I have looked in other answers and all say that server side timeout cannot change.
Can we change disconnection timeout for remote players at client?

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @Eduard,

    Can we change disconnection timeout for remote players at client?
    No.
    What you could do is to have a heartbeat system that tries to detect unresponsive clients that are not considered disconnected yet.

    This heartbeat system could be designed after answering these questions:

    1- how a player sends his heartbeat to others or tell them that he's alive
    2- how often should a player do this?
    3- how to detect that a player is unresponsive?
    4- how often should we check?
    5- who should detect and mark the player as unresponsive?
    6- how should we mark the player as unresponsive and tell others about it?

    I can offer some suggestions:

    1.a. each player keeps setting his custom player property periodically to the network timestamp
    1.b. each player keeps sending a custom event to others periodically to say that he's "alive"

    3. it depends on 1.

    5. master client should do it by looping over all joined active players periodically.

    6.a. by setting a custom player property to a boolean flag or to a timestamp of when marked as unresponsive (or both, two properties).
    6.b. by sending an event to all other joined players informing them that a player X has been marked as unresponsive.
  • Eduard
    Options
    Hi @JohnTube
    I really appreciate your help with giving me the guideline to solve this problem.
    The last question based on your experience whats the minimum heartbeat time to detect a disconnection?
    Can a minimum of 2 secs cause problems with false positive disconnection?