Setup Play-in-Editor

Setting up the common classes

The assets present in MSquared are read only - in a downstream project, you cannot modify them, only extend from them, or use them as reference. Therefore if you want to modify different classes' behavior, or add extra functionality, you will need to make your own versions of the assets and use them instead. There are different ways of doing this:

Using the template project

If you create your project using the M² Base Project, the majority of commonly overridden assets will be already made for you, e.g. BPM_Example_PlayerCharacter. These will be writable, renamable etc. so can act as a starting point for your project.

For further details of this flow, see Using The Template Project.

Summary

When making a new project off of MSquared's defaults, the following is a list of classes to consider making your own versions of, to extend the MSquared functionality whilst adding your own:

The assets below are what are made automatically for you by using the template project, so the simplest flow would be to start from there.

Asset to override
Copy or Inherit?
Where to apply?

BP_Origin_GameMode

Inherit

Project Settings -> Default GameMode, or World Settings -> GameMode Override

BP_Origin_PlayerController

Inherit

In the Game Mode (Player Controller Class)

BPM_Origin_PlayerCharacter

Inherit

In the Game Mode (Player Morpheus Actor Class) NOTE: Prior to V25, this will have to be done via the PlayerSpawner

BP_Origin_PlayerCharacter

Inherit

Either via the Game Mode (Default Pawn Class), or via the role's pawn set asset (see the further details) NOTE: Prior to V27, this will only be possible via the pawn set asset

BP_Origin_HUD

Inherit

In the Game Mode (HUD Class)

M2M_MorpheusGameState

Inherit

In the Game Mode blueprint (Morpheus Game State Class)

WBP_Origin_HUD

Copy

In your HUD BP

DT_RolesExample

Copy

World Settings -> Default Role & Data Tables

PDA_Skin_Origin

Copy

Project Settings -> Default Skin

DT_Origin_SettingList

Copy

In your Skin

In more detail:

  • The GameMode: This configures a bunch of the classes used in your level, e.g. the player controller and HUD classes outlined below. If you want to make a new game mode, it should extend BP_Origin_GameMode

    • To apply your game mode, you can either modify per-level in your world settings, or modify the default in your project settings -> Maps & Modes.

The Character:

  • The PlayerController: Should extend BP_Origin_PlayerController.

  • The Morpheus Actor: The representation of a client's character that is used for replication. Should extend BPM_Origin_PlayerCharacter.

    • Prior to V25, the Player Morpheus Actor Class is not available from the game mode. Instead, to make sure your correct morpheus actor is spawned, you should also update the "Player Spawner". Use BPM_Origin_PlayerSpawner as a base, and you can modify the PlayerMorpheusActorClass field in it. This can then be set in your level's world settings

  • The Render Target Actor(s): The actual character spawned in-game to represent a player. Should extend BP_Origin_PlayerCharacter

    • If you want to add further customization to the pawns used, e.g. wanting different roles to have different pawns, or want to make changes to the "animated crowd", you can configure them in your roles table's pawn set asset (the Pawn Lod Level Set field): (NOTE: Prior to V27 this flow is the only way to configure your render target actor)

      • For a given role, its PawnLodLevelSet controls what render target is used.

      • If you make a new pawn set asset (copying the existing one), you can swap out its Base Pawn and LOD0 Actor Class

  • The UI:

    • The HUD BP: The logic responsible for spawning the HUD, and managing our UI. Should extend BP_Origin_HUD.

    • The HUD WBP: The actual HUD widget that contains the in-game UI. To use your own HUD widget, we recommend making a copy of WBP_Origin_HUD. To use your new HUD, you can change the Game Layer Class in your HUD BP.

  • The Roles table: This controls which roles are available to your players. If you want to modify this, make a copy of DT_RolesExample.

  • The Skin: This is responsible for the styling of your UI etc. If you want your own skin, make a copy of PDA_Skin_Origin. For more details on skins, see How to use skins.

  • The Settings table: When you open the "Escape Menu", this table dictates what is present in the UI. If you want to change this, you should make a copy of DT_Origin_SettingList, and set your skin asset's Settings Skin Settings -> Settings Data Table field to your new table.

There are some other base classes in origin that can be used as valid starting points, such as BP_PlayerController, or BPM_M2_PlayerCharacterBase. However, these will be missing some of the expected Origin features, so only use these if you really know what you're doing.

Setting up the map

When making a new map, check the world settings, to make sure everything is as expected:

  • The GameMode Override: Make sure it points to your new game mode

  • The Roles table: You can configure the default role, and the roles table used here

  • The Singletons: There are a number of singleton actors that are spawned when the game is started, and enable various bits of Origin functionality. For more details on these, see Singletons.

    • In releases before V25, the PlayerSpawnerClass is one you may want to change - if you want to use a different morpheus actor, swap out the player spawner class with the one you created.

The MorpheusGameState class: This game state is similar to the unreal native game state, but with the benefit of being replicated by morpheus. Use this instead of unreal's game state

To set it up, go to your GameMode blueprint class and set it in the dropdown

To retrieve the morpheus game state, use the GetMorpheusGameState function

Changing animations

Your characters' animations are controlled in the ABP_M2_Human. Making changes to your Animation Blueprint in a downstream project is unfortunately quite an involved process currently compared to native Unreal, due to needing to be applied to both actor render targets and the animated crowd. If you do want to do this, please get in touch!

Configuring to use MMLs

There are a currently a few workarounds required for full functionality (especially related to MMLs) when using Play-in-Editor functionality.

The following sections are current required to place MMLs when in Play-in-Editor mode - this requirement will be removed in a future update.

Ensure you're using the correct game mode

You need to be using the BP_Origin_GameMode (configurable via world settings), or a game mode that is a child of this.

You may need also need to add this change to the template maps: InfinitySpace and Meadow. A fix for this will be rolled out in a future release.

Configuring Authentication

Local world authentication

By default, PIE sign-in is configured to use local-world sign in. This requires no configured by the user and should work immediately. You can check whether this setting is enabled by navigating to

Editor preferences -> Sign in settings -> Use Local World For PIE.

If you disable this setting, you will need to Set up server credentials.

Set up server credentials

This is only relevant if you don't have local world authentication enabled.

In Editor Preferences, in the Sign-in settings section, change your settings to reflect the following where:

  • Offline Mode is NOT ticked

In the Editor, click on the "Editor Sign In" button on the toolbar

The Editor Sign In button will only appear if Local world authentication is not enabled

You will be requested to sign in with your Google Account in your main system browser. Once complete, you will be presented with a list of api keys:

The name will depend on the key your organization admin set up.

Select the key they instructed you to use and click "ok".

Set up client credentials

In Editor Preferences, in the Sign-in settings section, change your settings to reflect the following where:

  • Offline Mode is NOT ticked

  • The Per Client Sign In Settings property has the Single Sign On element

Last updated