X157 Dev Notes

One simulant attempts to share insight with others.

Lyra Team System

Lyra ships with a reasonably featured Team System, the core of which is the Lyra Team Subsystem.

Conceptual Overview

Note: Teams do not exist outside a given Lyra Experience. This is yet another reason why you must correctly use On Experience Loaded throughout your Lyra project.

Team-based Actors in your game must implement Lyra Team Agent Interface to be team-aware. Lyra Characters, Player Controllers and Player States all implement this interface, for example.

By default, friendly fire is disabled and teams can only be categorized as either “same team” or “different team” relative to one another, but this is easy to change in C++.

The Team Subsystem is typically initialized in Lyra via a Game Feature Action (instantiated in the Experience Definition) by injecting a Lyra Team Creation Component into the Game State. For example, the quintessential Lyra Red vs Blue B_TeamSetup_TwoTeams in the example ShooterCore GFP.

Components of the Lyra Team System

How to Set or Change Teams

By default, there are only 2 ways a team might be assigned to an Actor in Lyra:

  1. When the Player joins the Game
    1. via the OnGameModePlayerInitialized delegate in ULyraGameMode
      • Team is assigned to the Player State and is thus inherited by related Actors
  2. By explicitly calling ULyraTeamSubsystem::ChangeTeamForActor
    • to change a Player’s team, call this on their Player State

Generally nothing in Lyra explicitly changes teams using the subsystem except for the Dev Cheat, but you can call it in your game whenever you want to allow players to change teams.

Also note that Lyra does most things using the Player State, and Teams are no different. If you want to change a player’s team, you change the team of their Player State. Doing so will broadcast a team change message on the Player State and their Controller, Pawn, etc, will update accordingly.

Lyra Examples

Mannequin Team Cosmetics

In the B_Hero_ShooterMannequin BP from ShooterCore:

ShooterMannequin ObserveTeamColors

Team Elimination Scoring

In the B_ShooterGameScoring_Base Blueprint, team elimination stats are updated whenever someone dies. The instigator’s team gets awarded an elimination point:

Elimination Scoring

Melee: Only Damage Pawns on Other Teams

In the GA_Melee ability, damage is only applied to hit pawns if they’re on a different team from the one executing the melee ability:

GA_Melee CompareTeams