Summary

If you are choosing between behaviour-trees and goal-oriented-action-planning, the best default for most student Unity projects is behaviour trees first, GOAP second. Behaviour trees are usually easier to read, extend, and debug, which makes them the safer choice for enemy AI that must react clearly and predictably. GOAP becomes the better choice when the interesting part of the problem is not moment-to-moment reaction but multi-step planning: finding weapons, securing cover, flanking, healing, or otherwise assembling action chains from a changing world state. (Millington, Artificial Intelligence for Games, see source-artificial-intelligence-for-games; Prof Charles, CRE341 Wks 4.2 and 5.1, see source-cre341-lectures)

Summary verdict

Use behaviour trees when you want reactive, legible, designer-authored control over NPC priorities. Use GOAP when you want agents to construct plans from goals, preconditions, and effects, and you are willing to pay the extra authoring and debugging cost. If you are unsure, start with a behaviour tree.

Comparison table

DimensionBehaviour TreesGOAP
Core ideaTraverse an authored hierarchy of conditions and actionsSearch for an action sequence that reaches a goal
Decision styleReactiveDeliberative
Main strengthReadability and explicit priority controlEmergent multi-step planning
Main data modelTree nodes, selectors, sequences, decorators, blackboard/contextWorld state, goals, actions, preconditions, effects, planner
Designer controlHigh — structure is authored directlyLower — plans emerge from authored actions and costs
Runtime costUsually lower and easier to boundUsually higher because search/replanning is involved
Debugging styleInspect active branch and node resultsInspect planner state, failed preconditions, plan generation
Best fitCombat AI, patrol/investigate/flee logic, readable enemy behaviourResource gathering, tactical repositioning, multi-step objective pursuit
WeaknessDoes not naturally reason several steps aheadHarder to predict, tune, and explain
Best default for studentsYesUsually not first

When to choose behaviour trees

Choose behaviour-trees when:

  • the NPC must react quickly to changing conditions
  • you want priorities to be obvious in the authored structure
  • the team needs designers and programmers to read the same logic easily
  • the AI mainly switches among known behaviour families such as patrol, chase, attack, flee, and investigate
  • debugging clarity matters more than emergent tactical surprise

This is why behaviour trees are the canonical core in overview-cre341-agent-ai-route. They balance reactivity, modularity, and production legibility better than large finite-state machines, while staying much easier to reason about than planners. (Yannakakis and Togelius, Artificial Intelligence and Games, see source-ai-and-games; Prof Charles, CRE341 Wks 4.2 and 5.1, see source-cre341-lectures)

When to choose GOAP

Choose goal-oriented-action-planning when:

  • the agent should build a plan instead of only following a prioritised branch
  • actions have meaningful preconditions and effects that combine in many ways
  • the designer wants solutions to emerge from the action library rather than being fully scripted
  • the problem involves setup and payoff over several steps
  • the extra complexity is justified by the behaviour space

The classic GOAP case is an enemy that can decide to find a weapon, move to cover, flank, heal, or attack based on current world state and costs, rather than following one fixed authored tree. This is the architectural appeal highlighted by Millington and by the wider AI-and-games literature. (Millington, Artificial Intelligence for Games, see source-artificial-intelligence-for-games; Buckland, Programming Game AI by Example, see source-programming-game-ai-by-example)

The real trade-off

The core trade-off is legibility versus emergent planning.

  • With a behaviour tree, the designer can usually point to the exact branch that explains the NPC’s current behaviour.
  • With GOAP, the explanation lives in the planner’s state, action costs, and precondition/effect graph.

That makes behaviour trees easier to teach and easier to ship for many ordinary enemy-AI roles. GOAP can produce richer plans, but it also creates more ways for the system to surprise the developer in unhelpful ways. The CRE341 route therefore treats GOAP as the advanced planning contrast, not the starting point. (Prof Charles, CRE341 Wks 4.2 and 5.1, see source-cre341-lectures)

Hybrids and combinations

The choice is not always absolute.

  • A behaviour tree can control high-level reactivity while delegating one branch to a planner.
  • A planner can output a plan that is then executed by a behaviour-tree-like runtime layer.
  • Utility scoring can sit above either approach, selecting which branch or goal should currently dominate.

Game AI Pro 360’s architecture volume explicitly treats BTs, GOAP, utility systems, and HTN as tools on the same authored-control to emergent-planning spectrum rather than mutually exclusive camps. That means a hybrid is often the production answer once a team understands the simpler building blocks. (Dawe et al., Game AI Pro 360: Guide to Architecture, see source-game-ai-pro-360-architecture)

When to choose behaviour trees / When to choose GOAP

Choose behaviour trees when the main design problem is readable reactive behaviour, frequent interruption, and explicit priority control.

Choose GOAP when the main design problem is building valid multi-step plans from a changing world state.

Choose a hybrid when you need authored control at one layer and planning flexibility at another.

behaviour-trees · goal-oriented-action-planning · ai-state-machine-pattern · blackboard-architecture · ai-architecture-patterns · combat-coordinator-pattern · influence-maps · machine-learning-games · game-ai-agent-design · overview-cre341-agent-ai-route · utility-ai · squad-ai-patterns · source-artificial-intelligence-for-games · source-game-ai-pro-360-architecture