Kick an inactive player in Pun Room

I've found a topic talking about that. The conclusion is that there is no way to kick an inactive player from the room.

https://forum.photonengine.com/discussion/8302/how-can-i-kick-the-inactive-user

So I am asking what else I can do about that. My game(Majiang) is a mobile game that needs four players to start it.


Before the real Majiang Game, players will play on an island together for killing time, but we got an issue here.

And When a player disconnects accidentally, I set playerTTL for letting the player rejoin the game. If the player wipes out the app and joins the same room(not rejoin). the player will see itself in the room and I have no way to kick the inactive player.

Also, when a player is in background mode on mobile, it will become inactive. If the player has no sign to return the game, I need my room master can kick the inactive player to let others join the game.

How can I handle the issues? Many thanks.

Answers

  • JohnTube
    JohnTube ✭✭✭✭✭

    Hi @scozirge,

    How long is your PlayerTTL? you could set it to a lower value and inactive actors will be removed automatically.

    If the player wipes out the app and joins the same room(not rejoin). the player will see itself in the room

    You need to use the same UserID per player to make this impossible to happen. The player who tries to join the game where he's already joined to (using the same UserID) will fail to do so.

  • ok, Thanks! That avoids the same player joining the same room now.

    About the second question, I can make playerTTL shorter, maybe 40s. But it is still too long for players in certain situations. But not a big problem. Thank you.

  • Hi, I'm facing the same issue in my VR application. When a player deliberately disconnects, it keeps hanging in the room till PlayerTTL expires. I want this user to immediately leave and those players who face connection issue can go in inactive state.

    Coming back to my main point, can you tell me how can I keep same UserID per player? Isn't it something that is obtained in response from Photon server?

  • Tobias
    Tobias admin
    edited June 2022

    Replied here. Avoid double posting...