skip to content

As AI lead, how would you choose between behavior trees, a GOAP or HTN planner and utility scoring as the standard decision architecture for a game with combat NPCs and simulated villagers?

level: principalimportance: should knowfreq 42%

answer

  1. who authors, who debugs
  2. reactive, deliberative or needs-driven
  3. layers are common
  4. cost per agent per frame
  5. tooling decides adoption

basics

~20 s

Choose by the behaviour each cast needs and who will author and debug it: behavior trees for authored, predictable reactions, planners for multi-step goals that must adapt, and utility scoring for many competing needs. Large games often standardise a layered hybrid.

solid answer

~50 s

No single architecture wins; the decision is about the behaviour, the team and the tools. **Behavior trees** give designers explicit, debuggable control and suit reactive combat, but every contingency must be authored. **Planners** (GOAP, HTN) let the assault NPC find a route through key, door and attack when the world changes, at the price of search cost and, for GOAP especially, behaviour that is harder to predict and tune. **Utility scoring** suits the villager balancing hunger, firewood and sleep, but needs curve-tuning skill and score-inspection tools. A common standard is layered: utility or a goal selector picks *what* to pursue, and a tree or HTN executes *how*. I would prototype the hardest behaviour in each candidate, measure per-agent cost, and weigh the debugger and editor support the team must build, because tooling decides whether designers can own the AI.

go deeper

for a junior

Recall the three families and one strength each: behavior trees for authored reactions, planners for adaptable multi-step goals, utility scoring for competing needs.

for a middle

Explain how each family decides on one update and what a designer edits to change behaviour, so you can predict where each becomes hard to maintain.

for a senior

Match a concrete cast to a model with reasons: per-agent cost, how often plans break, how much behaviour must adapt and how bugs will be diagnosed.

for a principal

Own the standard: weigh designer ownership, tooling cost, predictability and run-time budget, define the layer boundaries, and state the evidence that would justify changing course.

## What the decision is about Choosing a game's standard **decision architecture** is a lead's call because it shapes far more than the AI code: what designers edit, which tools must be built, how bugs are found and what the frame budget must hold. There is no single right answer, so the useful work is naming the criteria: - **Who authors behaviour**, and how comfortable they are with trees, with actions and costs, or with curves. - **How much behaviour must adapt** to a changing world without new authoring. - **Predictability**: whether designers must be able to say exactly what an NPC will do in a given moment. - **Run-time budget**: how many agents are active and what each may spend per frame. - **Debuggability and tooling**: the visualisers, logs and editors that must be built and maintained. ## The three families | | Behavior tree | Planner (GOAP or HTN) | Utility scoring | |---|---|---|---| | What designers author | A tree of conditions, composites and actions | Actions with preconditions and effects (GOAP) or task methods (HTN) | Considerations and response curves per action | | Strength | Predictable; easy to step through | Adapts multi-step plans to a changed world | Weighs many competing needs smoothly | | Weakness | Every contingency is hand-authored | Search cost; GOAP plans can surprise designers | Hard to predict; tuning needs inspection tools | | Run-time cost | Usually low per update | Spikes when planning or replanning | Grows with actions times considerations | | Main debugging view | The active branch | The plan and the precondition that failed | The per-consideration score breakdown | ## Matching each cast to a model - The **survival villager** juggles hunger, firewood and sleep, needs whose urgency changes continuously. Utility scoring expresses that directly; a tree needs a fixed priority order that cannot trade needs off smoothly, and a planner needs goals that are really just scores. - The **assault NPC** that must fetch a key and open a door before attacking needs a multi-step route that changes when the key or the door changes. A planner finds that route; a tree can hard-code it but needs a hand-written branch for each way it can break. - **Split-second reactions** in combat, such as diving away from a thrown explosive, need speed and predictability, so a tree or a small reactive layer beneath the planner is usually cheaper than replanning. ## Layered hybrids - **Utility on top, trees beneath**: utility chooses the activity, and a behavior tree per activity runs it. - **Planner for goals, authored behaviours for steps**: each plan step runs as a small tree or script. - **Utility inside a tree**: a choice node that picks its child by score instead of a fixed order. Standardising a hybrid means defining the boundary between layers, so each layer can be debugged on its own and designers know which layer to edit. ## Making the call 1. List the hardest behaviours the game needs and which casts need them. 2. Prototype the hardest one in each candidate architecture, with the people who will maintain it. 3. Measure per-agent cost at the expected crowd size, including replanning spikes. 4. Cost the tooling: a tree visualiser, a plan inspector, a score-breakdown overlay. 5. Decide the layering, write it down, and record the evidence that would justify revisiting it. The output is a written standard, not a verdict on algorithms: which layer owns goal choice, which owns execution, what tools ship with each and what per-agent budget each layer gets. A standard that names its own review triggers, such as trees passing a size the team agreed on or replanning spikes showing up in profiles, can be revisited on evidence instead of being re-argued on every project. ## Costs and risks a lead owns - Planners can produce behaviour nobody authored, so designers need time to learn to steer them through costs and preconditions. - Utility systems need curve-tuning skill, and without inspection tools they are hard to reason about. - Trees are easy to start and prone to sprawl, so structure and review rules matter early. - Switching architecture mid-production is expensive, so the choice should rest on prototypes and measurements, not on preference or fashion.

  • Why do many teams combine utility scoring with behavior trees instead of picking one?
    They answer different questions. Utility scoring is good at deciding which goal or activity matters most right now across many needs; a behavior tree is good at executing that activity as a reviewable sequence with reactions. Utility as the selector on top and a tree per activity keeps the choice graded and the execution debuggable.
  • What evidence would justify moving a team from behavior trees to a planner?
    Trees growing large because designers keep hand-authoring alternative routes to the same goal, frequent bugs where NPCs fail to adapt when a door, item or ally disappears, and behaviours that chain several steps through conditions the world sets. If a prototype planner covers those cases within the per-agent budget and designers can read its plans, the switch is justified.

  • There is one best architecture, and serious games all use planners.
  • Behavior trees cannot express priorities or interruptions.
  • Utility AI needs no tooling because the scores explain themselves.
  • The architecture choice is purely a performance decision.
  • Mixing decision models in one game is always a design smell.