Delightex Nova allows you to collaborate and play together with others through its multiplayer Experiences.
In this tutorial, you’ll learn how to create and explore your first multiplayer session step by step.
Starting a multiplayer session
In multiplayer mode, multiple users connect to the same session so they can see and interact with each other’s actions. Think of it like a shared virtual room, everyone inside can see the same things happening live.
Every multiplayer session has two roles:
Usually, the Host generates a link and sends it to other Players so that they can join the session.
To start a multiplayer session, you need to call:
1Multiplayer.startSessionThe Host start a new session, while Clients use the same method to join an existing one.
In other words, both sides call Multiplayer.startSession: the host creates a new session, and the clients connect to that session using the host’s link.
To do so, create a TypeScript script and type the following:
1async function startMultiplayer() {
2 await Multiplayer.startSession();
3
4 if (Multiplayer.isClient) {
5 Debug.log("Joined to the multiplayer session");
6 } else {
7 Debug.log("Started a multiplayer host, link " + Multiplayer.joinLink);
8 Input.copyToClipboard(Multiplayer.joinLink);
9 }
10}
11
12startMultiplayer();Now start the space and open the browser console. You’ll see a message like this:
1Started a multiplayer host, link
2https://nova.delightex.com/experiences/abcdefg?mp-sid=zxcvbnThe link is already copied to your clipboard, so you can open another browser window and paste the link there. You’ll then see another message in the console:
1Joined to the multiplayer sessionThat’s it! You’ve just created your first simple multiplayer game.
Note: You can’t invite other players directly from your editor. You first need to publish your Experience, either to the Gallery or by sharing it through a direct link.
In the next lesson, we’ll explore how synchronization works, so you can understand how data is shared between players and learn how to control what gets synchronized — allowing each player to have their own unique perspective while still staying connected in the same world.