Question about PlayerTtl

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Question about PlayerTtl

cmy
2017-07-08 22:46:06

Regarding PlayerTTL, the documentation states that

"If a client disconnects, this actor is inactive first and removed after this timeout. In milliseconds."

So my question are

  1. does the application need to perform anything when the actor become "inactive"? Or this is transparent and either everything returns to normal after the client "reconnect", or the MasterClient will receive a OnPlayerDisconnected after the time out?

  2. Does the disconnect client need to do anything in order to attempt the "reconnect" in question 1?

Thanks
David

Comments

JohnTube
2017-07-09 14:02:52

Hi @cmy,

Thank you for choosing Photon!

  1. I didn't really understand the question.
  • Player can be come inactive due to unexpected disconnect or explicitly by calling e.g. OpLeaveRoom(true).
  • MasterClient can be the actor becoming inactive.
  • When an actor becomes inactive or active again there is a callback for that: OnPhotonPlayerActivityChanged (PhotonPlayer otherPlayer).
  • If the room is still alive and PlayerTTL expires you should get a callback OnPhotonPlayerDisconnected (PhotonPlayer otherPlayer).
2) Yes within the PlayerTTL period/window the player can rejoin to become active again. after PlayerTTL expiration he can join as a new actor.
  • Sometimes if EmptyRoomTTL < PlayerTTL when last player leaves, the room can be closed before PlayerTTL expiration.
  • PlayerTTL = -1 or int.MaxValue mean infinite.
Back to top