Goal-Oriented Action Planning
Command Hierarchy
&
Engine: TGE

What is GOAP?
This project is a tactical AI system built using Goal-Oriented Action Planning (GOAP) layered with a Command Hierarchy. At its core, GOAP allows the AI to dynamically plan a sequence of actions based on their current world state and desired goals. Instead of using predefined behavior trees, the AI intelligently choose actions like attacking, healing, or reviving based on real-time data. The Command Hierarchy introduces a leadership structure where a Leader oversees one or more Squads, each composed of multiple Agents. The leader also monitors the global world state and assigns desired goals to squads, which then evaluate their internal aggregated state, then plan and coordinate their agents to act accordingly. This demo will showcase the system in a relatively simple environment where the AI plays tower defense against each other.


Why use this system?
​
-
Flexible Decision-Making: Agents choose optimal actions at runtime rather than following predefined behavior.
-
Dynamic Coordination: Squads make decisions as a unit, leading to more intelligent and coordinated behavior.
​​
-
Realistic Group Tactics: Whether attacking, retreating, reviving, or regrouping, the system simulates battlefield decision-making.
-
Easily Extendable: New actions, goals, or world states can be added without restructuring the entire system.
This system is designed for adaptive, squad-based AI in strategy or combat-focused games. Some key advantages are:
​
How does it work?
The system combines real-time tactical decision-making with squad-level coordination by layering GOAP on top of a command structure.
​
​
Leader: Evaluates global conditions from a Blackboard (e.g., proximity to enemies and resource access) and assigns the most relevant goal to each squad using weighted evaluations.
​
Squad: A container for multiple agents. Plans optimal action sequences based on the current most important goal and delegates actions to each agent.
​
Agent: Represents an individual soldier. Holds available actions and executes plans based on current world and agent state.
​​







Architecture
​​
Blackboard: A centralized system that holds all global world data:
- Team data
- Static positions (healing wells, ammo boxes)​
- Global world states​
- Event-driven triggers for GOAP replanning
​
Goals: Represents a desired state for the AI to reach. The priority is dynamically altered depending on the current world state and internal state of each squad/agent.
​
Actions: The actions represent each step required for the AI to reach its current goal. Each action has a dynamic cost and required precondition(s) to be executed.


Planning Loop

​
1. Blackboard Updates World State
Calculates global data that the leader uses to evaluate goal modifiers. These are essentially just fancy booleans.​
​

​
​2. Leader Suggest Squad Orders
Leader receives a message and evaluates the world state, then dynamically alters goal modifiers (priority) and sends an order to each squad.​
​

​
​​
3. Squad Plans Optimal Strategy
The squad calculates its aggregated state based on the internal states of each alive agent and chooses its highest-priority goal. It then uses the planner to find an optimal sequence of actions to reach its desired goal. The planner utilizes an A* pathfinding algorithm to evaluate the most optimal sequence of actions. In the example above, the optimal sequence would be the green path.



​
​​
4. Agents Execute Strategy
Using a finite state-machine, each agent receives the current available action in the sequence and executes them sequentially until either the goal is reached or the world state has changed. The agents notify the squad if they’re successful or not. The squad then requests a new order from the leader.