MasterOX 水
MasterOX 水2mo ago

joining empty rooms

how do i stop users from joining empty rooms (rooms that havent been hosted yet)
12 Replies
kapa.ai
kapa.ai2mo ago
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:
Realtime _realtime = GetComponent<Realtime>();

if (!_realtime.connected) {
// Prevent the user from joining the room
}
Realtime _realtime = GetComponent<Realtime>();

if (!_realtime.connected) {
// Prevent the user from joining the room
}
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: ----------------------
kapa.ai
kapa.ai2mo ago
<@758040514678489279> kapa.ai is still learning and improving, please let us know how it did by reacting below
Mechabit
Mechabit2mo ago
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
MasterOX 水
MasterOX 水2mo ago
or i could disconnect the player if it's the first one that joined
Mechabit
Mechabit2mo ago
what is it that you're doing?
MasterOX 水
MasterOX 水2mo ago
like the game?
Mechabit
Mechabit2mo ago
what situation would the player join a room which you would then kick them
MasterOX 水
MasterOX 水2mo ago
im making a kahoot like game for a school project and i want people to only create rooms on the browser, not in app
Mechabit
Mechabit2mo ago
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
MasterOX 水
MasterOX 水2mo ago
got it thanks
xulipa
xulipa2mo ago
Yeah easiest way would be to say that if you are ClientID = 0 when joining you are alone.
MasterOX 水
MasterOX 水2mo ago
thats what i endedd up doing