Teams

Due for Removal, please see Docs.

07/11/2024: Teams will be removed in the near future. This is a feature that can be built entirely in Blueprints and done so in a way that will provide more flexibility and specificity than our current implementation can.

Please reach out to your Support Team with any questions.

Overview

This is our system for handling splitting players into different groups, for various gameplay purposes.

Features include:

  • Create arbitrary teams as data assets and associate any information with them

  • Make any AMorpheusActor eligible for joining a team by giving it a UMorpheusTeamComponent

  • Decide at runtime which teams should currently be active

  • Add and remove team members from a team and have that information replicated in the background

  • Includes the option of auto-assigning members to teams, and auto-balancing teams

  • Handles all replication for you, race-condition free

Main Classes

The plugin contains these classes:

  • UMorpheusTeamData

    Data asset base class. Creating instances of this defines the available teams. While you could just create instances of this class directly, you'll likely need more information to distinguish between teams, e.g. a name, team color or material etc. It's recommended to derive a class from this base class and add all static information about a team to that class.

  • UMorpheusTeamComponent

    This component has to be added to an AMorpheusActor and makes that actor eligible to join any team. It contains information about which team the actor belongs to which can be queried. Team assignments are handled either via UMorpheusTeam or AMorpheusTeamManager.

  • AMorpheusTeamManager

    Manages the known teams and which of them are currently active. To use a team at runtime it has be configured in the AllKnownTeams array. Whenever a UMorpheusTeamComponent enters play, it automatically registers itself with the team manager. This class is generally used to manage teams and perform operations on all registered team components.

  • UMorpheusTeamSubsystem

    Game instance subsystem that holds the singleton reference to the team manager. Also holds an array of pending team component registrations if those components enter play before the team manager is checked out. This class normally doesn't need to be used directly.

  • UMorpheusTeam

    Represents an active team at runtime. Created by the team manager and also referenced by each team component it contains. Provides the main interface to interact with an individual team. This class is not replicated. The team manager automatically takes care of synchronizing the team's content on client and server.

Integration into your project

To integrate the teams plugin, follow these steps:

  1. (optional, recommended) Create a class derived from UMorpheusTeamData and add properties with all the required information about your teams

  2. Create an instance of your data asset class for each team that exists in your game

  3. (optional) Create a class derived from UMorpheusTeamComponent. Chances are that you need to react in some way when an actor's team assignment changes. UMorpheusTeamComponent::HandleTeamChanged can be overridden for that purpose. Use the UMorpheusTeam::TeamData property to get a reference to the associated data asset

  4. Add an instance of UMorpheusTeamComponent (or your derived class) to all actors that need to join a team

  5. Put an instance of AMorpheusTeamManager into your level and configure the AllKnownTeams property with references to all the data assets you created in step 2. (Alternatively, you can make a class derived from the team manager, configure it there, and it to the Additional Singletons list in your world settings)

  6. At runtime, get an instance to the team manager (using the GetMorpheusTeamManager helper) and call ActivateTeams with an array of all the data assets that should currently be active. These need to be contained in the AllKnownTeams property. Depending on the ExistingPolicy and NewPolicy, existing and newly created team components will either be automatically assigned to teams or you have to assign them manually

  7. Add and remove team members by using assign functions on either AMorpheusTeamManager or UMorpheusTeam. To get a reference to the latter, either use one of the various getter functions on the team manager, or get a reference from a team component that is assigned to that team

Last updated