How to create a room for all the players on Application?

Options

So I am working on a metaverse project where I am using PUN2 for multiplayer functionality.

The main point of the project is that all players online are meant to be inside a single room created by a Main Client or Head whatever you want to say.

I have tried to use

if(PhotonNetwork.CountOfRooms == 0)

    {

      PhotonNetwork.CreateRoom(RoomName, roomOptions);

    }

    else

    {

      PhotonNetwork.JoinRoom(RoomName);

    }

to avoid other users creating a room for themselves but sometimes some users can by pass this and are able to create a custom room for themselves breaking the game.

What can I do to make sure that anyone who tries to play the game are always in the same room and if there is no room created by master client , then they will not be able to join the room.

Answers

  • Tobias
    Options

    You could use PhotonNetwork.JoinOrCreateRoom() to get everyone in the same room but there are limits on how many can get into a room together. PUN is for up to 16 players in a room and a bit dated.

    Better look into using Fusion and also make sure you can work with additional, sharded rooms for loadbalancing (you won't be able to get everyone into a single room, so it's a bad approach to not prepare for more users).