HTN Planner AI decision making

Dawn Engine HTN Planner is a hierarchical task network (HTN) AI planning system: you author task-decomposition knowledge as a Domain, the planner solves a Plan against the agent’s WorldState, and HtnAgentComponent executes that plan with automatic replan on failure or environment change. Decisions are deterministic, explainable, and replayable.

Maturity: shipped. Provided by the HtnPlanner Gem (Code Gem; no hard Gem dependencies). After enablement, HtnSystemComponent mounts automatically; you still add HtnAgentComponent on AI entities and assign a compiled Domain asset.

It does not replace animation, navigation, or combat systems: operators call those capabilities. It also does not replicate WorldState over the network—authority usually owns the agent and runs planning locally.

What problem it solves

Game AI and simulation agents need goal-driven behavior that stays readable as tactics grow. Hand-rolled state machines and opaque ML policies become hard to explain (“why did it do that?”) and hard to author with designers. HTN Planner provides:

  • A Domain graph of compound tasks, methods, and primitive operators;
  • Deterministic planning (same Domain + same WorldState → byte-identical Plan);
  • Per-entity plan execution with continuous mode, opportunistic replan, and failure backoff;
  • Three extension channels (C++ operators, .htnnode presets/macros, script operators) without forking the Gem;
  • HTN Canvas (standalone node editor), compile-time V1–V18 validation, ImGui live panel, and offline decomposition-trace replay.

With the Gem disabled, projects have no HTN planning path; O3DE itself ships no AI decision framework.

How it works

.htndomain (HTN Canvas graph)
AssetProcessor / HtnDomainBuilder ──► .htndomain_compiled (flat HtnDomainAsset)
sensors / game code / scripts ──► WorldState │
 HtnAgentComponent → FindPlan (DFS) → HtnPlanRunner
 IHtnOperator Begin/Tick → nav / anim / script / …

Two rules run through the Gem:

  1. Model vs view: Domain data never depends on Qt/GraphCanvas; the editor graph is an authoring view; the builder flattens it to a read-only runtime asset shared by agents.
  2. Extend via data/reflection: new tasks and operators register through C++, .htnnode JSON, or BehaviorContext—do not fork HtnPlanner for gameplay content.

Planning runs on a WorldState snapshot; effects are simulated during search, then committed at runtime by phase (PlanOnly / ApplyOnStart / ApplyOnSuccess). Decomposition is time-sliced across agents under a global per-frame step budget; results match one-shot FindPlan byte-for-byte.

In this section

ChapterContents
Getting startedEnable the Gem, add HTN Agent, run the guard sample end to end, verify it works
Core conceptsWorldState, Task, Method, Condition, Effect phases, Plan, MTR, and the planning→execution data flow
HTN Agent componentAll configuration fields, the Idle/Planning/Executing/Failed state machine, request and notification buses, Domain hot reload
WorldState and scriptingThe eight HtnValue types, C++ and Lua/ScriptCanvas read/write, script value boxing pitfalls, script operator completion tokens
Authoring DomainsHTN Canvas workflow, source vs compiled assets, Domain Import, .htnnode files, V1–V18 validation rules
Extending operatorsThe three extension channels with copyable examples, built-in operator reference, predicate contract
DebuggingConsole commands, ImGui live panel, offline trace replay in Canvas, global statistics
ReferenceSettings Registry keys, capability limits, troubleshooting, programmatic API overview
  • Navigation3D HTN integration: optional Nav3D.* operators when both Gems are enabled; HtnPlanner itself has no hard dependency on it.
  • Dawn Stream: remotely review levels that include HTN-driven agents.

Copyright © 2026 DawnEngine. All rights reserved.

DawnEngine is a commercial 3D engine distributed under the DawnEngine end-user license agreement. Engine binaries and source are proprietary and are not covered by the licenses below.

Documentation only: the prose and templates on this site are a derivative work of Open 3D Engine (O3DE) documentation by the O3DE Contributors, used under CC BY 4.0 (documentation content), Apache 2.0 (site code), and the MIT license (inline code samples).

The open-source 3D engine that DawnEngine is built on top of is Open 3D Engine . DawnEngine is not affiliated with, endorsed by, or sponsored by The Linux Foundation or the O3DE project. “O3DE” and “Open 3D Engine” are trademarks of The Linux Foundation.