Remove players from Room?

Options

Hi, I've just started using photon a few months ago (it's amazing by the way : ) but I can't seem to remove players, I'm building a FPS Game where Players have to kill other players so this mechanic is very important for the functioning of my game, however There seems to be suprisingly little answers for this problems all of which I have tried, but they simply don't work I've used these three:

PhotonNetwork.Destroy();

PhotonNetwork.LeaveLobby();

PhotonNetwork.LeaveRoom();

Is there any other way I can acheive this?

Answers

  • Meep
    Meep ✭✭✭
    edited November 2022
    Options

    Hi, PUN is a client-authoritative SDK. There is no way to remove someone from a room unless you are on Enterprise plan or are using a self-hosted version of the server since this functionality requires server-logic.

    The reason for this is difficult and many people pass this off as Photon being insecure, but in reality it is a difficult problem to solve while keeping all customers happy. If you add a server-side kick then you must also stop people from being able to migrate MasterClient by their own volition. A lot of games rely on this functionality, so it is not easy for them.

    You can do a workaround by sending an event/RPC to the other player which calls LeaveRoom as you said. Functionality like this already exists in the form of CloseConnection . But remember this is a client-authoritative approach and can be disabled by someone hacky.

    Alternatively, you can look at Fusion which is their successor to PUN. They are taking a lot of these fundamental roadblocks with PUN into consideration when building that SDK.

    Take care.

  • Hi, thanks for responding and trying to help I really appreciate it, you're comment has really helped, so I have considered changing the game mechanic so the player just respawns instead of dying :) it might be the only solution right now...