[Master Actor] Changing the master actor from the server when unresponsive?

wiseone
wiseone
edited March 2022 in JavaScript and TypeScript

Hi there,

How do I go about changing the master actor automatically from the server, when the master actor suddenly stops broadcasting? For instance, when the master actor suspends, minimizes or closes the game application. And, this is when the master actor is also responsible for the objects, npcs and bots.

Not having a master actor, even for just a moment, can ruin a game.

I'm aware it is possible to assign a new master player from the client, and choosing the next master actor by activity. However this isn't as reliable as well, since timing is an issue.

I'm also aware of kicking the player out of the room before application suspension, but this is as well unreliable due to the possibility of the server not receiving the message, if closed too quickly or in an event of a crash.

Please let me know if this is possible.

Thank you.

Answers

  • Hi,

    The server assigns a new master client when the current master disconnects. Client's myRoom().masterClientId property is updated automatically.