Multiplayer in MAGES™ SDK

Applications built with MAGES™ SDK are multiplayer/network ready, meaning that with a few more actions needed by the developers, multiple users can cooperate and complete these simulations together online [M1].

In this section we will go through the details that developers need to check to ensure that their application is multiplayer/network ready, as well as a tutorial on how a user can create and/or join multiplayer sessions within a MAGES™ application.

Networking Developer Guidelines

MAGES™ SDK supports Photon networking as the default networking API. For cooperation/multiplayer mode you need to setup Photon (playing in the same room with other players).

First you need to install the Photon PUN2 asset (it is free). Navigate to the MAGES menu and click the “MAGES Helper”

../../../../_images/HelperMenu.png

The Helper window will pop and you will see that you need to install the PUN2 package. Click the “Add PUN2 package”.

../../../../_images/HelperWindow.png

This will navigate you to the asset store. From there you can add the package to your assets.

../../../../_images/PUN2Asset.png

And import the package to your project.

../../../../_images/PUN2Import.png

After installing the package, you need to create an account at Photon.

After successful registration, go to the Photon Dashboard and click the CREATE A NEW APP button.

Photon Create New App Button

Select Photon PUN from the Photon type dropdown, give a name to your application and click the CREATE button.

Photon Create Application

Navigate back to the main dashboard page and you will see your new PUN application. You need to copy the App ID. Open the Unity project and from the top bar go to Windows/Photon Unity Networking/PUN Wizard.

Note

Click the code next to the App ID to reveal the full key.

Photon PUN ID Login Window

Click Setup Project, paste your App ID at the Appid or Email field and click Setup Project.

Photon PUN ID Login Window

Configure Prefabs

Before hosting a multiplayer session, you must make sure that the prefabs are correctly set for multiplayer mode.

To configure them in order to be multiplayer-ready, follow the steps below:

  1. Navigate to the MAGES Menu and click Configure prefabs for Network.

    ../../../../_images/ConfigurePrefabsForNetwork.png
  2. Click Select All and then Transform as Bulk op. Finally, click Configure All.

    ../../../../_images/BulkOp.png
  3. If everything was done correctly, now each prefab will have set its Ownership Transfer to Takeover.

    ../../../../_images/TransformPhoton.png

Host Online Session

  1. Once you start the simulation, you will be greeted with two options. Starting the simulation in Single Player, or go to Online Sessions.

    ../../../../_images/HostCoop1.png

  2. Select the Online Sessions. There you will be able to create a new session and wait for other to join, or join an existing session that is demonstrated on the Sessions board.


  1. To Create a session, select the Create New Session, as illustrated.

    ../../../../_images/HostCoop2.png

  2. Wait for others to join. If at least one more user has joined, you will be able to start your online session.

    ../../../../_images/HostCoop3.png

  3. If you want to go back, select Exit VR to quit.

    Note: If you are using older versions of our simulation, please refer to this video for instructions.

Join Online Session

  1. Once you start the simulation, you will be greeted with two options. Starting the simulation in Single Player, or go to Online Sessions.

    ../../../../_images/JoinCoop1.png

  2. Select the Online Sessions. There you will be able to create a new session and wait for others to join, or join an existing session that is demonstrated on the Sessions board.


  1. Select an available session from the Sessions board, and select Join Session. Each available session will demonstrate all connected users.

    ../../../../_images/JoinCoop2.png

  2. If you want to go back, select Exit VR to quit.

    Note: If you are using older versions of our simulation, please refer to this video for instructions.


References

M1

Kamarianakis, M., Lydatakis, N., & Papagiannakis, G. (2021, September). Never ‘Drop the Ball’ in the Operating Room: An Efficient Hand-Based VR HMD Controller Interpolation Algorithm, for Collaborative, Networked Virtual Environments. In Computer Graphics International Conference (pp. 694-704). Springer, Cham.