Creating your Own Character

This page outlines the steps involved in setting up your character in a way that is compatible with the Morpheus Platform. Note that there are some steps here that are different to native Unreal, so it is worth even experienced Unreal users looking through this page.

Setting up your Morpheus Actor

The Morpheus Actor is the class that will be responsible for networking your character. For more details on this, see Introduction to Morpheus Networking.

If you are using the Morpheus Base Project, BPM_Example_PlayerCharacter has been made for you.

We require that the morpheus actor for your main character extends from M2M_CharacterBase at the minimum. This is a child of MorpheusPawnActor (a specialised form of MorpheusActor), that includes implementation of some of our core functionality, such as Crowd Animation, and Avatars. For other morpheus actors in-game, you can go directly from MorpheusActor or below.

Your Morpheus Actor is responsible for spawning its "render target actor", and tracking any replicated state, including your "avatar". For how these are done, see the following steps:

Configuring your Pawn Set

What is a Pawn Set?

Your pawn set is responsible for determining what "physical representation" your character has at different rendering "LOD Levels" (what we call "Render Targets"). In most cases, this means configuring the Actor that is used when the player is nearby, and the configuration of the "crowd" (see Crowd Rendering) used for distant actors.

More details on these "Render Targets" in Morpheus Render Targets

A demonstration of the difference between render targets. In this example, there are 3 characters in the world (so 3 BPM_M2Example_PlayerCharacters), but only 2 render target actors (BP_M2Example_PlayerCharacter). This because we have set the "NumInLOD0" to 1, meaning that other than yourself, only one other character will be a render target actor, and any past that point will be represented in the crowd.

The following image is of our default pawn set: DA_Pawns. The main things to bear in mind here are:

  • OverrideAuthPawnClass: If this is set, your local character will use this class as the Pawn. If no overide is set, then the asset will fall back to using the DefaultPawnClass defined by your active Game Mode.

  • OverrideActorClass: Similar to the above, but for nearby (LOD0) characters. Either this class, or the default pawn, will be used as the physical representation of other players near to you in the world

  • CrowdData: If you are not running smaller experiences (i.e. around 30 players or fewer), this will be needed to configure the distant actors (the crowd). This can largely be left as the default, except for a few conditions, discussed below in Modifying your Crowd Data

(more details in Pawn Sets)

The Pawn Class

Like in traditional Unreal projects, we use the Pawn class to represent most players. As mentioned above, the main difference is that for remote characters, we switch between these Render Target Actors, and a "crowd" representation.

We use the pawn class for handling game logic that requires a physical in-game body, e.g. collision or moving the actor through the game world (any networked state needs to be sent through the Morpheus Actor).

If you are using the Morpheus Base Project, BP_Example_PlayerCharacter has been made for you.

We require your main character to extend from M2_CharacterBase at the minimum (A child of Character). This is to handle some of our core functionality, such as Actor Poolingand handling custom avatars' Capsules and Mesh Transforms. If you are using making other Morpheus Actor render targets, you can go directly from Actor or below.

Some important things to note regarding using pawns on the Morpheus Platform

Modifying your Crowd Data

The default DA_SkeletalCrowdData_LoD1 should be fine for most use cases. Regarding the current properties, and the conditions in which they could be changed:

  • Skeleton: We advise leaving this unchanged.

  • CrowdAnimInstance: This should be changed if you change the Anim Class used by your pawn. It doesn't have to match, but generally makes the most sense to match, to ensure animations are consistent.

  • AnimNameToSequence: This is a mapping of animation montages that can run on the animated crowd. The can be triggered via e.g. JM_MontageComponent::PlayMontageByName(MontageName). If you want to add montages that you expect to play on the crowd, they will need to be added here.

  • NumCustomDataFloats/NumCustomDataFloatsPerMesh: Intended only for specialist use. We advise leaving these unchanged.

How do you apply a Pawn Set?

  • There is the following helper function that can be called on your Morpheus Actor: ApplyPawnSet.

    • This will apply the config above to your local Morpheus Actor, providing e.g. the right auth pawn, LOD0 render target actor, and crowd details.

    • As mentioned above, if the "Override" fields are left blank, it will instead set to the DefaultPawnClass provided in your Game Mode (see Setting up your Game Mode)

    • NOTE: This operation is only done locally, so ApplyPawnSet will need to be called on every machine.

  • We also have a Default Pawn Set, defined in your project settings.

    • This can be obtained via the GetDefaultPawnSet helper function. (It returns a soft asset reference, so will need to be loaded via e.g. JunoAsyncLoadAsset).

This is done already for you in BPM_Example_PlayerCharacter, due to the following logic in the parent class: BPM_M2Example_PlayerCharacter:

Our example/default behavior: at the start of the game, every character (on every machine), loads the default pawn set, and applies it to themselves. Our default pawn set (DA_Pawns) has no override classes. This will therefore set them up to use the default pawn from the game mode.

The Player Controller

Player Controllers work basically the same in the Morpheus Platform as they do in native Unreal, on the local client. When your authoritative Render Target Actor is spawned, it will be possessed by your Player Controller.

In the Morpheus Base Project, BP_Example_PlayerController has been made for you.

Setting up your Game Mode

What's in the Game Mode?

The game mode allows use to configure some default classes for your project or map. Important ones to consider here:

  • PlayerMorpheusActorClass: sets the Morpheus Actor that will be used for your character in the level. If you made your own class in Setting up your Morpheus Actor, you will need to make sure it is defined in your active game mode for it to be used.

  • DefaultPawnClass: sets the pawn class used for player characters. When you apply a pawn set, this is the class that is used if you don't provide an OverrideAuthPawnClass /OverrideActorClass. For more details, see How do you apply a Pawn Set?

How do I set my Game Mode?

The Game Mode used by your project can be configured either by:

  • Setting the default game mode via the project settings:

  • Overriding the game mode for your specific map, in your World Settings:

    An example of overriding the default game mode: here to BP_CombatExample_GameMode

In the Morpheus Base Project, BP_Example_GameMode is set as our default game mode, and no override is added to the ExampleMap level, meaning that the default will be what is used. It has already been configured to use the _Example_ classes outlined in the steps above.

Updating your character avatar

Instead of using regular meshes directly from Unreal, we use an interoperable avatar system, where character models are downloaded via Urls. (See Avatars). The following is some guidance on how that flow works

Creating an MML Avatar

We have documentation that outlines the process to go from a 3D model to an MML avatar that can be used in-game, and across Morpheus Platform experiences: Creating an Avatar

Setting your character in-game

Once you have created an MML character Url, or have one you want to use from elsewhere, you can set it via your CharacterAssetComponent. For details on how this works, see: Using an Avatar in-game

The BPM_M2Example_PlayerCharacter has some default behavior that sets some MML avatars for you:

  • If a plyer has a character Url already defined in their profile, that will be used.

  • If not, they will default to using a fallback avatar from a pool of example avatars.

The example logic in BPM_M2Example_PlayerCharacter waits for your profile to be loaded. Once it is loaded, it obtains the profile's Url field, and loads it. The example also includes some fallback behavior, to load some fallback avatars if there is no avatar tied to their profile.
  • This pool of example avatars is defined via live config (DefaultAvatar.FormatAvatarUrl), with the default of https://casual-filtered-v1.msquaredavatars.com/{0}.mml - it will select a random url replacing {0} with a number between DefaultAvatar.MinEntry and DefaultAvatar.MaxEntry.

Last updated

Was this helpful?