Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Game Engine

Unreal Engine 5.0

Tutorial Level

Easy

Properties

Transform

Project Files

https://github.com/Cavrnus-Inc/chess-demo-csc-unreal

Starting Project

We are going to begin with a simple single-player Chess scene.

  • 32 movable chess pieces on a table.

  • A Reset button in-scene which resets all pieces to their original positions.

  • No special game logic other than moving pieces around on the board.

Installing the Cavrnus Plugin (Unreal Engine)

As with any Unreal plugin, adding the Cavrnus Spatial Connector is a simple 3 step process:

...

Tip

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

  1. 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.

...

Tip

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

  1. This project uses a custom game mode called “BP_MouseDragGameMode”.

    1. From the World Settings panel, expand the Game Mode rollout.

    2. In the “GameMode Override” field, note the entry says “BP_MouseDragGameMode”.

  2. This project also uses a custom Default Pawn Class “BP_MouseGrabPawn”.

    1. In the World Settings panel, under Game Mode, expand the Selected GameMode rollout.

    2. Note that the Default Pawn Class references “BP_MouseGrabPawn”.

    3. Click the “Browse to Asset in Content Browser” button next to the field.

  3. Open the “BP_MouseGrabPawn” blueprint from the Content Browser.

  4. Under the Component panel in the blueprint editor, note the following components:

    1. SyncTransform_Character

      1. Property Name: Transform

    2. NameTagWidget

    3. CavrnusProperties Container

Add Sync Components to Chess Pieces

  1. For each asset in the hierarchy that requires transform synchronization, add the following components

    1. Sync Transform

      1. Set the Property field to “Transform”. Note that this property is case-sensitive.

    2. CavrnusPropertiesContainer

      1. 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.

...

Info

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. In this demo we’ve already created a customized player pawn, BP_ChessPlayer, specifically tuned for this level. This custom pawn can be found in project Content folder under Blueprints, and is derived from the BP_Cavnus_Pawn blueprint which comes with the plugin. Note that the derived player pawn inherits all the necessary Cavrnus Sync components from that parent.

...

You can also create a Custom Avatar by applying the necessary Sync Components to your own pawn, or simply inherit from one of the Cavrnus base pawns. You can find these pawns in the Content Browser under Plugins / Cavrnus Content / Pawns / Blueprints.

Final Product

With the Sync Transform components added, the Avatars and Chess Pieces will move in a synchronized way for all users in the space. This, combined with Voice and Video, will let you play a chess game with whomever else launches this scene!

...