How to handle Master Client freezing?

Options
What is the solution to handling the master client freezing? What if there game freezes for say 10 or 30 seconds for some reason and now messages aren't being sent. Is there a way to detect if a master client has frozen and disconnect them after a period of time?

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited July 2018
    Options
    Hi @seanybaby2,

    I guess you read this page already.

    - You can check the timestamp of the latest event received from Master Client if any.
    - You can implement a heartbeat mechanism: every now and then the Master Client broadcasts an event to everyone telling them he is still there. If one actor misses that event after a while you can start investigating or do the switch right away.
    - Or you can do a periodic check on the Master Client: every now and then send an event to the Master Client from one or more actors asking him if he's alive/awake or not and expect another event as an ACK in return.

    The tricky parts are:

    1- choosing the period or the interval of the events/checks. it should be less than the default client timeout < 10 seconds.
    2- choosing the next best suitable candidate to become the new Master Client (by default Photon chooses the next actor number)
  • seanybaby2
    Options
    Yeah... I did a bit of digging and I am now using a heartbeat methodology.

    I now send a message from the MasterClient to the clients every 5 seconds. If a client misses 4 messages consecutively then the client chooses a new client to become the masterclient. I'm a little concerned that this idea isn't entirely hackproof / stable since the client decides when to make a new master and could have a bad connection or be tampered with but I think it's good enough for now.