HTN Demo by dlrht - 4


Basic implementation of a Hierarchical Task Network (HTN) as a Unity minigame. The player races against the AI to collect items while avoiding enemies.

Unknown LicenseUpdated 130 days agoCreated on November 20th, 2018


Basic implementation of a Hierarchical Task Network (HTN) in the form of a Unity minigame.


The player plays against an AI-controlled Agent and controls the Blue circle, collecting the rotating items in the alcoves on the edge of the screen, while avoiding the patrolling enemy AI. The goal is to collect the most items while avoiding getting caught. Both players possess a Teleport Trap holding 2 uses, which can be used by pressing the ‘Space’ key. Doing so will teleport the closest enemy/agent


The opposing Agent is controlled by a basic Hierarchical Task Network. Implementation was based off of this section in Game AI Pro. The implemented pseudocode described in the paper can be found in the EnemyAgentPlanner class in the MakePlan() method.

The Enemy Agent AI has a HTN Domain as follows:

HTN Domain


All assets are made using default Unity components.

Show all projects by dlrht