Setup
This page will walk you through the pre-requisites and steps necessary to enable the Ninja Factions plugin.
Installing the Plugin
Once acquired, you can install the plugin via the Epic Games Launcher. Like any code plugin, it can be installed to any compatible engine version.
Once installed, create or open your project and navigate to Edit and then Plugins. In the search bar, type Factions and the Ninja Factions plugin should appear. Tick the checkbox and restart the engine.
C++ Modules
If you're working with C++ and using classes from the Factions System, ensure you add the following modules to your Build.cs
file:
Asset Manager
Add the Faction Data Asset to the Asset Manager, ensuring that the correct name and folder are added.

Here's a summary of changes in the new entry:
Setting | Description |
---|---|
Primary Asset Type | Unique name used to identify this asset. The name defined in the class is |
Asset Base Class | Base class that represents this these assets. In our case, |
Directories | All content folders where assets of this type can be found. Adjust this as necessary. |
Cook Rule | Always cook. |
Faction Component
The Faction Component must be present on each actor that belongs to a Faction. The most common examples are certainly the Player or AI characters, but other actors such as vehicles and buildings can have factions too.
Optionally, each Faction Member can implement the Faction Manager Interface (FactionMemberInterface
). This allows the system to quickly retrieve the Faction Manager, without the need to iterate over actor components.
Controllers
If you are planning to use Factions to determine the AI Attitude between AI Agents and actors detected by their Perception, then you also need to configure both the AI and Player Controllers.
The Unreal Engine's Perception System will use the GenericTeamAgentInterface
, implemented by Controllers, to determine the attitude between members of certain teams.
Factions are designed to provide a predefined Team ID, and if you are also using Reputation, it can be used to define the attitude.
AI Controller
The AI Controller already implements GenericTeamAgentInterface
, so all that is left is to extend the implementation, so it uses the Faction Manager for attitude checks.
The Faction System provides a base AI Controller, ANinjaFactionAIController
, that is able to retrieve the Faction Manager from its possessed Pawn and, by using the system's Attitude Provider, determine the correct attitude between the agent and its sensed targets.
Player Controller
The Player Controller does not implement the GenericTeamAgentInterface
used by the AI System to determine the attitude between AI and Player Controllers. Furthermore, this interface is not implementable in Blueprints.
The Faction System provides a base Player Controller, NinjaFactionPlayerController
, that is able to retrieve the Faction Manager from its possessed Pawn, and use it to determine the Team ID for the AI System.