The Faction System provides a flexible, Gameplay Tag-driven approach to defining relationships between actors in your game. It integrates seamlessly with the Gameplay Ability System, enabling faction-aware targeting for abilities, AI perception, and team-based mechanics.
The system consists of three interconnected classes:
| Class | Type | Purpose |
|---|---|---|
UWCGASFactionRelations |
Data Asset | Designer-authorable asset defining relationships between faction pairs |
IWCGASFactionAgent |
Interface | Opt-in interface for actors that participate in the faction system |
UWCGASFactionLib |
Blueprint Function Library | Static helpers for querying faction relationships from anywhere |
flowchart TB
subgraph DataLayer["Data Layer"]
DA["UWCGASFactionRelations<br/>(Data Asset)"]
Tags["Gameplay Tags<br/>Faction.Player<br/>Faction.Monsters<br/>etc."]
end
subgraph ActorLayer["Actor Layer"]
Agent["IWCGASFactionAgent<br/>(Interface)"]
ActorA["Actor A<br/>FactionTags: Player, Heroes"]
ActorB["Actor B<br/>FactionTags: Monsters"]
end
subgraph QueryLayer["Query Layer"]
Lib["UWCGASFactionLib<br/>(Blueprint Function Library)"]
end
subgraph ResultLayer["Result"]
Result["EWCGASAttitude<br/>Friend / Neutral / Enemy"]
end
DA --> Tags
ActorA --> Agent
ActorB --> Agent
Lib --> Agent
Lib --> DA
Lib --> Result
style DataLayer fill:#4a90e2,stroke:#2171b5,color:#fff
style ActorLayer fill:#41a161,stroke:#228b22,color:#fff
style QueryLayer fill:#7b68ee,stroke:#6a5acd,color:#fff
style ResultLayer fill:#b87700,stroke:#ff8c00,color:#fff
The three-state attitude enum determines how actors perceive each other:
| Value | Description | Use Case |
|---|---|---|
Friend |
Full cooperation, no friendly fire | Valid heal/buff target, allied AI |
Neutral |
Non-hostile until provoked | NPCs, wildlife, non-combatants |
Enemy |
Valid combat target | Hostile AI, ability damage targets |
When actors belong to multiple factions, this determines which attitude wins:
| Mode | Behavior | Best For |
|---|---|---|
MostHostile |
Enemy wins if ANY pair is hostile | Combat games ("attack if any reason to") |
MostFriendly |
Friend wins if ANY pair is friendly | Diplomacy games ("ally if any reason to") |
Priority |
First faction (alphabetically) takes precedence | Predictable results, primary faction matters most |
Example with Multiple Factions:
ActorA factions: [Player, Heroes]
ActorB factions: [Monsters, Bandits]
Relations defined:
- Player vs Monsters: Enemy
- Player vs Bandits: Enemy
- Heroes vs Monsters: Enemy
- Heroes vs Bandits: Neutral (truce)
Results:
- MostHostile: → Enemy (any Enemy relation wins)
- MostFriendly: → Neutral (any non-Enemy relation wins)
- Priority: → Enemy (Player vs Monsters checked first)
UWCGASFactionRelations is the designer-authorable data asset that defines all faction relationships in your game.