Mikameel
Mikameel3w ago

PC created rooms, connection links and lobby system

are there resources to create a room and join an existing room using a link? how can I let users join rooms that are created by friends?
8 Replies
kapa.ai
kapa.ai3w ago
Hi @Mikameel. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the knowledge sources provided, I can offer some information about creating and joining rooms in Normcore, though there isn't specific documentation about creating connection links or a lobby system. Here's what I can tell you: Normcore uses a room-based system for multiplayer connections. Rooms in Normcore are used to separate groups of players, typically for hosting a single match or a persistent space for an application. Players who join the same room name will be automatically connected to the same room server. To create and join rooms, you can use the Connect() method of the Realtime component. Here's how you can do it: 1. To create a room:
realtime.Connect("RoomName");
realtime.Connect("RoomName");
2. To join an existing room:
realtime.Connect("ExistingRoomName");
realtime.Connect("ExistingRoomName");
Realtime API Reference provides more details on the Connect() method. For letting users join rooms created by friends, you would need to implement a way to share the room name between users. Normcore doesn't provide a built-in lobby system or connection links, so you would need to create this functionality yourself. Some suggestions for implementing this: 1. Have the room creator share the room name with friends through an in-game chat system or external communication method. 2. Implement a custom lobby system where created rooms are listed and can be joined by other users. 3. Generate unique room names and share them as codes or links that friends can input to join the room. Remember that room names in Normcore are namespaced to your App Key, so any room name used with a different App Key is considered a different room server by Normcore. For more detailed implementation, you might need to combine Normcore's room system with your own custom networking solution to handle room discovery and joining. The provided knowledge sources don't contain enough information about creating a full lobby system or connection links. If you need more specific guidance on implementing these features, I recommend reaching out to the Normcore support team or checking their community resources for additional information. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3w ago
<@365574199844274177> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Mikameel
MikameelOP3w ago
How can I get the connection status from any script? How can I get the connection status from any script? @kapa.ai
kapa.ai
kapa.ai3w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- To get the connection status from any script in Normcore, you can use the Realtime component's properties. Here's how you can do it: 1. First, make sure you have a reference to the Realtime component in your script. 2. Then, you can use the following properties to check the connection status: - connecting: True if Realtime is in the process of connecting or initializing its views. - connected: True if Realtime is connected and its views are initialized. - disconnected: True if Realtime is not connected or in an error state. Here's an example of how you might use these properties in a script:
using Normal.Realtime;
using UnityEngine;

public class ConnectionStatusChecker : MonoBehaviour
{
[SerializeField] private Realtime _realtime;

void Update()
{
if (_realtime.connecting)
{
Debug.Log("Connecting to room...");
}
else if (_realtime.connected)
{
Debug.Log("Connected to room!");
}
else if (_realtime.disconnected)
{
Debug.Log("Disconnected from room.");
}
}
}
using Normal.Realtime;
using UnityEngine;

public class ConnectionStatusChecker : MonoBehaviour
{
[SerializeField] private Realtime _realtime;

void Update()
{
if (_realtime.connecting)
{
Debug.Log("Connecting to room...");
}
else if (_realtime.connected)
{
Debug.Log("Connected to room!");
}
else if (_realtime.disconnected)
{
Debug.Log("Disconnected from room.");
}
}
}
You can attach this script to any GameObject in your scene, and make sure to assign the Realtime component in the inspector. For more detailed information about these properties, you can refer to the Realtime API Reference. Additionally, if you need to check the connection state of the underlying Room directly, you can access it through realtime.room.connectionState. This property provides more detailed connection state information. Remember to handle cases where the Realtime component might not be initialized yet in your scripts to avoid null reference exceptions. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3w ago
<@365574199844274177> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Mechabit
Mechabit3w ago
normcore lobbies isn't ready yet, use unity lobby or some other lobby
Mikameel
MikameelOP3w ago
okay thanks! which one are you using? for now I just want to connect through sharing name of rooms. For my usecase this would be sufficient.
Mechabit
Mechabit3w ago
unity lobby. if you just want to share room.names you can post it on social media or something

Did you find this page helpful?