Profiles and difficulty
A profile (UPulseAIProfile, primary asset type PulseAIProfile) describes a kind of agent. Agents read it when an AI controller possesses them; UPulseAIAgentComponent::SetProfile(Profile, true) switches at runtime.
| Category | Fields |
|---|---|
| Behavior | StateTree, display name, team (the start team of the pawn in Pulse::Team, unless it has one), roles, aggression (0..1) |
| Perception | sight radius, lose-sight radius, half view angle, hearing (on, range, awareness per noise), damage sense, awareness tuning, perception modifiers |
| Targeting | target scorers |
| Movement | walk and run speed (presets of the movement tasks), leash radius |
| Group | alarm radius, reacts to alarms, raises alarms when alerted |
| LOD | own Reduced / Dormant distances |
| Difficulty | scaling per difficulty tag |
| Extensions | data of other systems (combat, own) |
Difficulty
The agent’s difficulty is its own Difficulty, else the difficulty of the world (UPulseAISubsystem::SetWorldDifficulty, set for example by PulseAIDifficultyBridge from the difficulty of the game), else the settings’ default (Pulse.AI.Difficulty.Normal). The profile maps difficulty tags to FPulseAIDifficultyScaling:
| Field | Effect |
|---|---|
| Perception Scale | Sight and hearing ranges |
| Reaction Time Scale | Lower = notices faster |
| Aggression Scale | Aggression (conditions Chance, consideration Aggression, combat) |
| Speed Scale | Walk and run speed |
| Extensions | Extensions found before the profile’s own (e.g. a harder attack set) |
Missing difficulties fall back to the parent tag, then to a scaling registered for the difficulty (Pulse::AI::RegisterDifficultyScaling: a level a game adds, which profiles do not know), then to no scaling.
On top of that, four tuning knobs of PulseFoundation multiply the scales, so a difficulty or the server rules change every agent without touching the profiles: Pulse.Tuning.AI.Perception, Pulse.Tuning.AI.ReactionTime, Pulse.Tuning.AI.Aggression and Pulse.Tuning.AI.Speed. The context has the agent’s pawn as instigator, its profile as source and its roles as tags, so a value can change bosses or a role only (GetTunedScale). A knob that changes reaches the agents that already run at once (UPulseAISubsystem::RefreshTuning: senses, sight ranges and reaction time, the speed they move at); what they know stays.
In the editor
A profile opens in the config workshop. Its preview Perception shows:
- the senses from above on the chosen difficulty (buttons above the drawing): the sight cone with sight and lose sight radius, the hearing range, the leash and the alarm radius, scaled like
APulseAIControllerapplies them; - Difficulties: every difficulty with an entry of the profile, every difficulty a game or PulseAIDifficultyBridge registered a scaling for, and the default of the settings, with sight, hearing, reaction time, aggression and run speed, and where the scaling comes from;
- Levels of the game (with Pulse Difficulty): the tuning knobs
Pulse.Tuning.AI.*on each level, with the profile as source and its roles as tags, like an agent asks them; - Test: a target straight ahead at a distance you type: whether the agent sees and hears it on each difficulty and how long it takes until it is alert (without walls and perception modifiers).
Specs: PulseAI.Editor.ProfilePreview.
Extensions
Other systems keep their data in the profile:
USTRUCT(meta = (DisplayName = "Loot"))
struct FMyLootExtension : public FPulseAIProfileExtension
{
GENERATED_BODY()
UPROPERTY(EditAnywhere)
TObjectPtr<UMyLootTable> Loot;
virtual void OnAgentStarted(UPulseAIAgentComponent& InAgent) const override { /* set up components */ }
};
if (const FMyLootExtension* loot = Agent->FindProfileExtension<FMyLootExtension>()) { ... }
OnAgentStarted / OnAgentStopped run on the server when a controller starts or stops the agent. OnAgentStopped runs for the extensions of the profile (and difficulty) the agent started with, also when SetProfile restarts it with another one. The combat bridge uses this for its Combat extension.