How-To: Declared Teams & Colors

Goal: declare named teams on the Game State, auto-assign players to them, and drive per-team colors - the full PvP/faction setup beyond raw tags.

Prerequisites
Quick Start done. A Game State you can add a component to.

1. Make a display asset per team

Content Browser -> right-click -> Data Asset -> CrimsonTeamDisplayAsset (one per team). Fill ColorParameters (e.g. TeamColor), ScalarParameters, TextureParameters, and TeamShortName. These names match the parameters on your team materials.

Screenshot pendingImages/CrimsonTeams/howto-display-asset.png
A CrimsonTeamDisplayAsset with TeamColor and a short name set.

2. Declare the teams on the Game State

Add a Crimson Team Creation Component to your Game State and fill Teams To Create (tag -> display asset). On BeginPlay (server) it spawns the replicated ACrimsonTeamPublicInfo / PrivateInfo actors and registers them with the subsystem.

Teams To Create keyvalue
Team.RedDA_Team_Red
Team.BlueDA_Team_Blue
Inject teams from a Game Feature
Mode-specific teams can be added/removed at runtime via UCrimsonTeamCreationComponent::AddTeams / RemoveTeams (call them from a Game Feature Action's activate/deactivate) - no edit to the base Game State.

3. Assign players to teams

Players are auto-assigned on join. Override ServerChooseTeamForPlayer to control how; the default picks the least-populated team.

cpp
void UMyTeamCreation::ServerChooseTeamForPlayer_Implementation(APlayerState* PS)
{
if (UCrimsonTeamAgentComponent* Team = PS->FindComponentByClass<UCrimsonTeamAgentComponent>())
{
Team->JoinTeam(FGameplayTag::RequestGameplayTag(FName("Team.Red"))); // your choice
}
}

4. Apply the colors

Resolve an agent's display asset and apply it to materials / Niagara, or let the async observer keep UI in sync.

cpp
// Push team colors onto every mesh / Niagara on an actor:
if (UCrimsonTeamDisplayAsset* DA = UCrimsonTeamStatics::GetTeamDisplayAssetForAgent(Pawn))
{
DA->ApplyToActor(Pawn, /*bIncludeChildActors*/ true);
}
// Safe per-parameter reads with a fallback:
const FLinearColor C = UCrimsonTeamStatics::GetTeamColorWithFallback(DA, TEXT("TeamColor"), FLinearColor::White);
Verify
Play as 2+ players: each spawns on a team, team-colored materials apply, and the Dev Tools Teams tab lists both teams with their display assets and member counts.

See also

  • Concept: Team Registration & Info Actors - what the creation component spawns and how registry works
  • API Reference - display asset, creation component, info actors