How to link multiple normcore rooms together
How to link multiple normcore rooms together?
2 Replies
Hi @Trần Phát Tài. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To link multiple Normcore rooms together, you can use the Realtime API. Normcore allows you to connect to multiple room servers simultaneously. This can be especially useful if you need to segment a large open-world into multiple quadrants that players can freely move between.
Here's a general process:
1. Create multiple Realtime instances: Each Realtime instance can be thought of as a connection to a single room. If you want to use multiple rooms in your multiplayer project, you can do so by creating additional Realtime instances.
2. Connect to a room: To connect to a room, call
Connect()
along with the room name and app key. All clients that connect to the same room name with the same app key will connect to the same room server.
3. Use the Room + Datastore API: This API manages your connection to a room server and the synchronization of raw state in your application. It is unaware of your Unity scene or any Unity objects.
Remember, when you're connecting to a room server, you can use the optional roomModel
field on the Connect()
. This is a freshly initialized model that represents the root of your datastore. Any state changes to this model are replicated to the room model instance on all clients.
Here are the relevant documentation links for more details:
- Connecting to a room server (https://normcore.io/documentation/room/room#connecting-to-a-room-server)
- Realtime API (https://normcore.io/documentation/realtime/realtime)
- Room + Datastore API (https://normcore.io/documentation/room)
- Common Questions (https://normcore.io/documentation/essentials/common-questions#can-i-connect-to-multiple-rooms-at-the-same-time)
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------<@1151010407012634654> kapa.ai is still learning and improving, please let us know how it did by reacting below