Need Behaviours
Need behaviours define how agents recover something they are missing.
They are not limited to survival-style needs. You can use them for any recurring pressure that should compete for an agent's attention.
Creating need behaviours
Create need behaviours in CIVIL-AI-SYSTEM -> Behaviour Tree Editor.
Compared with work trees, need trees are simpler. They are about choosing the best available recovery method and performing the required actions.
Node types
Need trees use three main layers.
Need
The top layer defines the overall need.
This layer usually controls:
- the identity of the need
- the valid value range
- the weighting curve that influences urgency
Examples:
- Rest
- Hunger
- Warmth
- Entertainment
Method
Methods describe different ways to satisfy the need.
Each method can restore the need by a different amount, which makes some options better than others.
Example for Rest:
- sleep in owned bed
- rest on shared bench
- rest near a hearth
Action
Actions are the concrete scene steps required to perform the method.
Examples:
- move to bed
- claim a seat or bed
- play sleeping animation
- wait for completion
Best practice
Think in terms of quality tiers
Need methods work well when the agent has several levels of quality available.
For example:
- best option: owned bed at home
- acceptable option: bunk in workplace quarters
- emergency option: rest on a bench
This makes the simulation feel more resilient and more believable.
Use weighting to control urgency
If a need should interrupt almost everything when it becomes severe, make sure its weighting supports that.
If it is a softer need, keep its urgency lower so work and essential needs can win more often.
Medieval fantasy example: Rest
Here is a concrete need breakdown for a medieval town NPC.
Need
Rest
This represents tiredness building over time until the agent must recover.
Method 1
Sleep in owned bed
Why it is good:
- high fulfillment
- believable home behaviour
- strong identity for residents
Possible actions:
- move to house
- move to bed point
- play sleep or lie-down animation
- remain in state until enough rest is restored
Method 2
Rest on tavern bench
Why it is useful:
- fallback when home is unavailable or too far away
- lower fulfillment than a proper bed
Possible actions:
- move to tavern seating area
- claim a seat or valid point of interest
- play seated idle or resting animation
- restore a smaller amount of rest
Method 3
Warm by the hearth
Why it helps:
- suitable for short recovery
- good for scenes where agents do not fully sleep yet still reduce pressure
Possible actions:
- move to hearth point
- face the fire
- play idle warming animation
- restore a modest amount of rest
A useful design question
When creating a need, ask this:
What does the best version of solving this look like, and what are the believable fallback versions?
That question usually leads to better methods than thinking only about a single perfect outcome.
More medieval fantasy examples
These examples are intentionally compact. The goal is to help you quickly map a need to believable methods and action sequences.
Hunger
Need idea: a villager becomes hungry over time and needs to eat.
Possible methods:
- eat at home
- eat at the tavern
- eat carried food on the spot
Example action chains:
Location Entrance -> Locate -> Pick UpLocate -> Mount -> DismountPick Up -> Idle
How to think about it:
- home eating should usually be a stronger fulfillment option than improvised eating
- tavern eating is a good social fallback if home is unavailable or far away
- carried food is a useful emergency method when you want resilient NPC behavior
Warmth
Need idea: an agent becomes cold and seeks heat.
Possible methods:
- warm by home hearth
- warm by tavern fire
- warm by workplace furnace
Example action chains:
Location Entrance -> LocateLocate in Zone 1 -> IdleLocate -> Idle
How to think about it:
- warmth is often best represented as a short recovery need rather than a long occupation
- workplace warmth can be weaker than home warmth if you want home life to matter more
- tavern warmth is a strong fallback for shared village life
Entertainment
Need idea: an agent wants a break from routine and seeks light leisure.
Possible methods:
- sit in the tavern
- wander the market
- watch the hearth or village center
Example action chains:
Locate -> Mount -> DismountRandom Location in Zone 1 -> Idle -> Random Location in Zone 1Locate Random -> Idle
How to think about it:
- entertainment is usually a soft need, so let work and core needs outweigh it when necessary
- random or ambient movement works well here because perfect precision often looks unnatural
Social
Need idea: an NPC wants shared space or company.
Possible methods:
- sit at a tavern table
- gather near a market stall
- idle near the village square
Example action chains:
Locate -> Mount -> Await for Mount to be Filled -> DismountLocate Random -> IdleFollow Route
How to think about it:
- social needs are often less about a specific item and more about believable shared locations
- taverns, squares, and market routes are strong anchors for this kind of behavior
Cleanliness or washing
Need idea: an agent occasionally wants to wash or tidy themselves.
Possible methods:
- wash at home basin
- wash at shared trough
Example action chains:
Location Entrance -> LocateLocate -> Idle
How to think about it:
- this is a good example of a non-essential but world-building need
- keep the urgency below survival or work-critical pressures unless your game design says otherwise
Recommended pattern for need design
When designing a new need, it often helps to define:
- the premium solution
- the normal solution
- the emergency fallback
For a medieval town, that often maps well to:
- home
- shared public space
- improvised world interaction
Next step
Pair this with Work Behaviours so your agents have both duty and recovery.