joining empty rooms
how do i stop users from joining empty rooms (rooms that havent been hosted yet)
12 Replies
Hi @MasterOX 水. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Currently, Normcore does not provide a built-in feature to prevent users from joining empty rooms. However, you can manage this yourself by implementing a system that checks the status of a room before allowing a user to join.
You can use the
Realtime
class properties to manage the connection to a room. For instance, you can use the connected
property to check if the Realtime instance is connected and its views are initialized. If not, you can prevent the user from joining the room.
Here is an example of how you can use the Realtime
class properties:
Please note that this is a workaround and may not cover all scenarios. For more information, you can refer to the Normcore Documentation (https://normcore.io/documentation/reference/classes/Normal.Realtime.Realtime).
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@758040514678489279> kapa.ai is still learning and improving, please let us know how it did by reacting below
that sounds like a lobby feature
you could wait for lobby to be released or do something like make a master room that holds the number of players in each room
or i could disconnect the player if it's the first one that joined
what is it that you're doing?
like the game?
what situation would the player join a room which you would then kick them
im making a kahoot like game for a school project and i want people to only create rooms on the browser, not in app
I've not played it, do you enter a room code on the phone?
what I'd do is get all the phones to connect to a master room on start and then the "host" generates a game with an associated pin code. When the phone user enters a wrong room code they don't just connect to a room with that name and instead checks on the master room list for an existing pin code.
or use unity lobby
quicker than connecting to the wrong room and then disconnecting
if you use unity lobby you wont eat up room hours with people joining the master room before a match
got it thanks
Yeah easiest way would be to say that if you are ClientID = 0 when joining you are alone.
thats what i endedd up doing