top of page
Hemsida.png

Faction Behaviour AI

By Marcus Bildtgård & Lucas Nordström

Capture2.PNG

There are 5 built-in relationships, prioritized from lowest to highest:

Neutral, Friendly, Suspicious, Aggressive, Fearful

How the dev wants their NPCs to act due to these relationships is up to the dev. This Blueprint collects actors, prioritizes them, and triggers an event according to their faction settings.

You can also add a specific relationship towards a specific actor with a single event, so for example, you can set an NPC to be aggressive to anyone who attacks it.

How to use

Capture5.PNG
Capture6.PNG

Add the Behaviour blueprint and the interface to the NPCs.

If you want to rename or create more factions, use the ENUM_Factions file.

Note: New Relationships cannot be created, but can be renamed.

Capture4.PNG

In the Behaviour blueprint's purple box, set up your factions to have specific relationships to all other factions.

In the example above, a Human Civilian is fearful of AngryLoners, suspicious of Aliens, Neutral to ScaredPacks, etc.

Note: You can also change relationships later through scripting.

Capture7.PNG
Capture.PNG

In the NPC's blueprint, you then set up its faction, a couple of ranges and what you want to happen when your NPCs finds someone to react to.

You can also choose to use a personal space. For examply, if the other NPC is outside my personal space, I'll take cover and use a ranged attack. If they're within my personal space, I'll rush in and melee attack them.

Download

Unreal Project

In-depth

how to

Description

 

This is a modular Blueprint for game devs who want their NPCs to react to each-other according their factions.

For a savanna, the lions might be aggressive towards gazelles, friendly to one-another and scared of elephants.

This Blueprint lets the NPCs automatically sense one-another in a modular radius, and set a relationship to the other actor.

Capture3.PNG
bottom of page