Course contentsShow
← Unreal Engine Game Development
Lesson 429 of 8806. AI, Navigation, and Decision MakingFree lesson

Integrating EQS with Behavior Trees

Learners will combine Environment Query System results with Blackboard keys to enable intelligent tactical decision-making like finding cover.

In this lesson, you will learn how to bridge the gap between Environment Query System (EQS) spatial data and Behavior Tree logic to create AI that can react intelligently to its surroundings.

From Sensing to Selecting

While Behavior Trees handle the "what" (logic flow), EQS handles the "where" (spatial awareness). To make an AI perform a task—like finding cover—we need the Behavior Tree to trigger an EQS query and store the result in a Blackboard Key so the AI can navigate to it.

The Integration Workflow

To connect these systems, we use the Run EQS Query node directly inside our Behavior Tree.

  1. Define the Blackboard Key: Create a Blackboard Key of type Vector (e.g., TargetCoverLocation).
  2. Add the Run EQS Query Task: Drag a Run EQS Query node into your Behavior Tree Sequence.
  3. Configure the Node:
    • Query Template: Select the EQS asset you designed to find cover.
    • Blackboard Key: Select your TargetCoverLocation key.
    • This tells the Behavior Tree: "Run this spatial search, and once you find the best spot, save those coordinates into this Blackboard variable."
  4. Use the Result: Add a MoveTo node immediately after the EQS task. Set the Blackboard Key of the MoveTo node to the same TargetCoverLocation.

Because the MoveTo node is now reading the value stored by the EQS task, the AI will dynamically move to the specific location identified as the "best" cover in that exact moment.

// Logic flow inside the Behavior Tree Sequence:
// 1. [Run EQS Query] -> Finds best cover, writes to "TargetCoverLocation"
// 2. [MoveTo] -> Reads "TargetCoverLocation", paths to the result

This integration allows your AI to perform complex spatial reasoning on demand. If the environment changes, the next time the Sequence runs, the EQS will update the TargetCoverLocation with new data, and the MoveTo node will automatically path toward the updated, safer position.

Key Takeaway: Integrating EQS with a Behavior Tree allows the AI to translate spatial analysis into actionable movement by writing query results directly into Blackboard keys that are consumed by movement tasks.