Game Engine | Unreal Engine 5.0 |
Tutorial Level | Easy |
Properties | Transform |
Project Files |
Installing the Cavrnus Plugin (Unreal Engine)
As with any Unreal plugin, adding the Cavrnus Spatial Connector is a simple 3 step process:
Drop the latest version of the CSC plugin into the Plugins folder of your project files.
Load the project in Unreal Editor and enable the CSC plugin in the Plugins Manager
Restart the Unreal Editor as indicated.
The project now has the Cavrnus Spatial Connector plugin enabled. The next steps will connect a specific map in the project to a Cavrnus server.
Initial Cavrnus Setup
The first time a project is opened with the Cavrnus plugin enabled, the Cavrnus Spatial Connector dialog box will display to guide the initial setup.
Set up your Space - Adds an instance of the CavrnusSpatialConnector to the current map.
Web Console - Open the Cavrnus Web Console in the default browser.
Visit Documentation - Open the online documentation in the default browser. (You’re already here!)
Show when Unreal Editor Starts - Toggle this checkbox off to
Dismiss - Close the dialog.
Click Set up your Space to add an instance of the CavrnusSpatialConnector to the current map.
Alternatively, you can add the CavrnusSpatialConnector instance to the level from the Cavrnus menu on the Unreal Editor Menu bar.
Note that you only need one instance of CavrnusSpatialConnector for a given level.
As described in the Setup Your Scene guide, configure the settings for the CavrnusSpatialConnector on the Details panel:
Domain Name: cav.dev.cavrn.us
Auth Method: Guest Join Auto
Guest Join Username: <Enter any name here>
Space Join Method: Automatic
Automatic Space Join ID: Reference a valid 24-character Space ID from the Web Console. (e.g. 65d51cde823bca2e0f0bc79c)
At this point, the level is now connected to a server and will directly enter a Space with copresence. The next step adds synchronization of level assets.
Verify user Copresence Components
This project uses a custom game mode called “BP_MouseDragGameMode”.
From the World Settings panel, expand the Game Mode rollout.
In the “GameMode Override” field, note the entry says “BP_MouseDragGameMode”.
This project also uses a custom Default Pawn Class “BP_MouseGrabPawn”.
In the World Settings panel, under Game Mode, expand the Selected GameMode rollout.
Note that the Default Pawn Class references “BP_MouseGrabPawn”.
Click the “Browse to Asset in Content Browser” button next to the field.
Open the “BP_MouseGrabPawn” blueprint from the Content Browser.
Under the Component panel in the blueprint editor, note the following components:
SyncTransform_Character
Property Name: Transform
NameTagWidget
CavrnusProperties Container
Add Sync Components to Chess Pieces
For each asset in the hierarchy that requires transform synchronization, add the following components
Sync Transform
Set the Property field to “Transform”. Note that this property is case-sensitive.
CavrnusPropertiesContainer
Set the Container Name field to “Pieces/Dark_Pieces/<asset_name>”, where “asset_name” refers to the name of the object as it appears in the Outliner.
And that’s it! The project is now fully connected to the Cavrnus server, with copresence and shared properties that will be synchronized with other users accessing the same Space.
It’s worth noting that if you have matching projects in Unity and Unreal where the objects/assets in the corresponding Heirarchy/Outliner match each other in name (case-sensitive), then running the applications in the same Space will synchronize with copresense!
Adding an Avatar
The Cavrnus Spatial Connector comes with a complete set of default pawns ready to use in your Cavrnus Space. You can even Add a Custom Avatar by applying the necessary Sync Components to your own pawn, or simply inherit from one of the Cavrnus base pawns.
In this demo we’ve already created a customized player pawn based on the Cavnus Pawn blueprint. Like in the Developer Guide, we’ll start by just giving it a Sync Transform component, like we did the Chess Pieces.
Then, in the Cavrnus Spatial Connector, we will set the Remote User Avatar to be this.
And now we’re actually done!
Final Product
With the Sync Transform components added, the Avatars and Chess Pieces will move in a synchronized way for both users. This, combined with Voice and Video, will let you play a chess game with whomever else launches this scene!