How can I tell if my opponent go idle or

How can I tell or what is the callback if my opponent go idle or just for example press the home screen of the phone, and not completely disconnected on photon.

or for example his internet is slow, and his actions are delayed than mine.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @tataygames,

    You could send custom events just before going to background and just after coming back from background inside OnApplicationPause/OnApplicationFocus callbacks.

    Clients could also disconnect explicitly or leave rooms when going to background or losing focus.

    In general, you could also add a broadcast heart beat custom event with timestamp.
    Every client sends this event to tell the others it's "alive" and not "idle", the other clients can .
    Each client can then periodically check if other clients are idle or not by comparing their last 'touch' timestamp with current time.

    Photon already provide a maximum of 10 seconds timeout disconnect & a keep alive ack only thread for background clients on Android (60 seconds by default), after which other clients should get an event about the respective clients leaving the room.
  • Hey thank you for the answer.

    Btw I really have a big problem.

    Im thinking in the future if I updated my game, and I have a random match,
    by JoinRandomRoom or CreateRandomRoom.

    What if I updated the game,
    and the version is not compatible? it will cause a huge bug.

    I cannot use
    PhotonNetwork.PhotonServerSettings.AppSettings.AppVersion

    Because in the friends list you cannot invite a friend using chat when your not the same version in photon appsetings appversion.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @tataygames,

    You can force client app updates (do not allow old AppVersion to connect using custom authentication). Example: Pokemon Go does this.

    You could use different AppVersion in Photon Chat and PUN.
    But even if the same AppVersion is used in Photon Chat to send invitations, a same AppVersion is needed in PUN in order to be able to join the same room.
    So when you update something breaking related to PUN just change the AppVersion of PUN.

    You could add another version parameter as a custom lobby property which works as a filter in random matchmaking.
  • okay thanks for the info!
  • BTW my game is live now, how many players can connect in 1 app?
    And I dont know why there are times I cant connect to photon,
    Im using photon 2, is there any issue on that?
  • I feel I cant connect if players reached 20???
  • Im new to this server multplayer thing, so I didnt know CCU is that max players an app can have
    I develop this for 2 months, and uploaded it live now, little did I know max players is just 20
    Now my players saying to me it keep on disconnecting. and cant invite a friend.
    oh God. and I need to pay $100 per month for 500 players a day? right?
  • Update: I paid $140 usd for 100 ccu for 5 years not bad.
    I hope you reply to me again cause I need help. dont be hurt :smiley: