use HurricaneVR through the network / documentation version 1.2
With "Multiplayerkit for HurricaneVR" you can use the popular asset "HurricaneVR" over a network with multiple players. For this purpose, the networking library "Netcode for GameObjects" specially developed by Unity is used. "Multiplayerkit for HurricaneVR" provides you with a basic framework to elevate the functionality of HurricaneVR into the realm of multiplayer and gives you some demo assets to which the networking functionality has been applied.
Our Asset contains the following content:
To use this asset it is highly recommended to have a basic knowledge of Netcode for GameObjects and Hurricane VR.
To get the Multiplayerkit for Hurricane VR running you need to execute the following steps.
Step 1: Purchase and import the HurricaneVR asset
To use Multiplayerkit for HurricaneVR, you first need the HurricaneVR asset from Unity's asset store. Once you have purchased and downloaded the asset, import it into your project using the appropriate import feature in Unity.
Step 2: Install the Netcode for GameObjects Package
In addition to the HurricaneVR asset, you need to install the Netcode for GameObjects package. This package is required to enable network gameplay for your game. It can be downloaded and installed from the Package Manager in Unity.
Step 3: Add the Client Network Transform Component
In order for Multiplayerkit for HurricaneVR to work properly, you need to add the Client Network Transform Component to your project. This component ensures that the network position and rotation of the objects in the game are updated on the client side. To add this package open the Package Manager, select Add->Add from git URL and copy and paste the following Git URL: https://github.com/Unity-Technologies/com.unity.multiplayer.samples.coop.git?path=/Packages/com.unity.multiplayer.samples.coop#main.
Step 4: Import Multiplayerkit For Hurricane VR
Add the Multiplayerkit For Hurricane VR Asset to your project. Go to Assets->Import Package->Custom Package and here select the package from the folder you downloaded it to.
Step 5: Configure Multiplayerkit for HurricaneVR
After you have installed all the necessary components and packages, you need to configure Multiplayerkit for HurricaneVR. This includes adding network components to your game objects and configuring network settings in Unity. Follow this Documentation for more informations on that.
To get the included demo scene running, you need to add the Unity Service Relay, as well as the Unity Service Lobby to your project. The Unity Services Relay and Lobby are two features provided by Unity Technologies to simplify the process of building real-time multiplayer games.
Unity Services Relay is a cloud-based networking service that allows players to connect to each other through a relay server, without the need for port forwarding or other complex networking setups. This ensures that players can connect to each other reliably and with minimal latency, regardless of their geographic location or network setup.
Unity Services Lobby is a matchmaking service that helps players find and join games with other players. The Lobby service allows players to search for games based on specific criteria, such as game type, player count, or geographic region. It also provides features such as player matchmaking and game invitations, which make it easier for players to find and join games that match their preferences.
Once you have installed the services, you can start the demo scene. You can find the scene in the folder "MultiplayerkitForHVR/Scenes". Once you have started the scene, you will find a user interface on the wall. Click the button "Start Multiplayer". At the status display you can see if you are online.
Every further user who starts the scene and the online mode will now join your instance via relay. If you want to test the scene alone, we recommend to use the Unity extension ParrelSync. After installing ParrelSync you should comment in the marked parts in the Script "SimpleMatchmaking.cs" (lines 20-22 and lines 80-82).
You can also create your own Multiplayerkit for HurricaneVR scene or update an existing scene so that it becomes networked. Therefore you would have to add a Network Manager to your Scene. You can either use the supplied NetworkManager Prefab or create your own Network Manager. Now you need to add a Player Prefab to the Network Manager. We supplied a Player Prefab in the folder "MultiplayerkitForHVR/Prefabs". The last steps you have to do is to make your gameobjects network ready. You can read how to do this in the following chapters.
If you have problems setting up the multiplayerkit for HurricaneVR feel free to contact us for further support
Our asset provides you with a ready-made Player Prefab object that is a visual representation of your player character. It includes a represantation of the players head, body, hands and their teleportation intent. Each player is represented by an own color. To change or add new player colors you can edit the NetworkedPlayerColor Script. If there are more players in the Scene than added colors each additional player will be assigned a random color.
If you want to use your own representation, you can simply exchange your own model with the existing one. Each bodypart needs to contain a ClientNetworkTransform component and a NetworkFollowBehaviour component. You can specify the body part in the body part section of the NetworkFollowBehaviour component
The HVRGrabbable Component is one of the most important of the HurricaneVR Asset. To make it network ready you need to add the Network Adapter component to the GameObject containing the HVRGrabbable component.
When the adapter component is added, it will prompt you to automatically add any other missing components. Click the button to finalize making grabbable networked.
Once done, you can assign additional objects that are linked to this one in the "Linked Ownerships" section (e.g. objects that are linked with a joint and need to have both their ownerships transferred in order to properly work), as well as assign events for when the object spawns as well as "Generic RPC Events" which you can also fire via events. This way you can synchronize events between clients.
The Multiplayerkit For HurricaneVR asset contains prefabs for large and small networked sockets. You can just use these networked sockets and configure them just like regular sockets. To make already existing sockets network-compatible you also simply need to add the Network Adapter component to the GameObject containing the HVRSocket component.
When the adapter component is added, it will prompt you to automatically add any other missing components. Click the button to finalize making the socket networked.