AI Tree
  • 🏡Home
  • ⭐Getting Started
  • Basic
    • Behaviour Tree
      • Node
      • Decorator
      • Service
    • Blackboard
      • Key (Variable)
    • Perception System
    • Environment Query System
    • Quick Start
    • User Guide
    • Shortcuts
  • Navigation
    • Building a NavMesh
  • Nodes
    • Composite
      • Sequencer
      • Selector
        • Selector
        • Random Selector
      • Parallel
        • Parallel
        • Parallel Selector
        • Parallel Complete
    • Tasks
      • Animator
        • Cross Fade
        • Cross Fade in Fixed time
        • Set Bool
        • Set Float
        • Set Integer
        • Set Trigger
      • Audio
        • Audio Mute
        • Audio Pause
        • Audio Play
        • Audio Stop
        • Play Random Sound
        • Play Sound
        • Set Audio Clip
        • Set Audio Loop
        • Set Audio Pitch
        • Set Audio Volume
      • Audio Source
        • Play Clip At Point
      • Debug
        • Debug Log
        • Debug Draw Line
        • Debug Draw Ray
      • Common
        • Wait
        • Set Key
        • Run Behaviour
        • Wait Blackboard Time
        • Finish With Result
      • EQS
        • Run EQS Query
      • Game Object
        • Activate
        • Add Component
        • Create Object
        • Destroy Component
        • Destroy Object
        • Destroy Self
        • Detach Children
        • Find
        • Find Child
        • Find Closest
        • Get Child
        • Get Child Count
        • Get Distance
        • Get Parent
        • Get Root
        • Get Tag
        • Get Name
        • Set Parent
        • Set Tag
      • Math
        • Bool Flip
        • Bool Operator
        • Float Abs
        • Float Clamp
        • Float Operator
        • Int Abs
        • Int Clamp
        • Int Operator
        • Random Bool
        • Random Float
        • Random Int
        • Sample Curve
        • Get ACos
        • Get ASin
        • Get Atan
        • Get Atan2
        • Get Atan2 From Vector2
        • Get Atan2 From Vector3
        • Get Cos
        • Get Sin
        • Get Tan
      • Movement
        • Move Towards
        • Way Point
      • NavMesh
        • Move To
        • Random Position
      • Object
        • Destroy
        • Instantiate
      • Perception System
        • Detection Signal
      • Physics
        • Box Cast
        • Capsule Cast
        • Line Cast
        • Ray Cast
        • Sphere Cast
      • Physics2D
        • Box Cast 2D
        • Capsule Cast 2D
        • Line Cast 2D
        • Ray Cast 2D
        • Sphere Cast 2D
      • Player Prefs
        • Delete All
        • Delete Key
        • Get Float
        • Get Int
        • Get String
        • Set Float
        • Set Int
        • Set String
      • Quaternion
        • Angle Axis
        • Euler
        • From To Rotation
        • Get Euler Angles
        • Inverse
        • Multiply
        • Multiply By Vector
      • Rigidbody
        • Add Explosion Force
        • Add Force
        • Add Force At Position
        • Add Relative Force
        • Add Relative Torque
        • Add Torque
        • Move Position
        • Move Rotation
        • Sleep
        • Wake Up
      • Rigidbody2D
        • Add Force 2D
        • Add Force At Position 2D
        • Add Relative Force 2D
        • Add Torque 2D
        • Move Position 2D
        • Move Rotation 2D
        • Sleep 2D
        • Wake Up 2D
      • Transform
        • Get Angle To Target
        • Get Position
        • Get Rotation
        • Inverse Transform Direction
        • Set Scale
        • Inverse Transform Point
        • Transform Direction
        • Transform Point
      • Vector2
        • Add
        • Add XY
        • Clamp Magnitude
        • Get Length
        • Get XY
        • Invert
        • Select Random
        • Set Value
        • Set XY
      • Vector3
        • Add
        • Add XYZ
        • Clamp Magnitude
        • Get Length
        • Get XYZ
        • Invert
        • Select Random
        • Set Value
        • Set XYZ
      • Unity
        • Debug
        • Send Message
        • Find Transfrom
    • Decorators
      • Blackboard Condition
      • Compare Blackboard Keys
      • Conditional Loop
      • Cone Check
      • Inverter
      • Is At Location
      • Loop
      • Has Path
      • Object Tag Condition
      • One Time Execution
      • Succeeder
      • Time Limit
  • Perception System
    • Quick Start
    • Useful Components
      • AI Perception Blackboard
      • AI Perception Source
    • Useful Nodes
  • Environment Query System
    • Quick Start
    • Items
    • Useful Components
      • EQS Tester
    • Useful Objects
      • Environment Query
        • Generator
          • Circle
          • Cone
          • Donut
          • Grid
        • Trace Mode
          • Layer
          • NavMesh
        • Tests
          • Distance
          • Dot
          • Has Path
          • Overlap
          • Slope
          • Trace
    • Useful Nodes
  • API
    • Overview
    • User Scripting
      • Custom Task
      • Custom Key
      • ToolbarItem attribute
    • Runtime
      • BehaviourTree
      • BehaviourRunner
      • Blackboard
      • Key
      • Key<T>
      • KeyQuery
      • KeyQuery<T>
      • KeyReceiver
      • KeyReceiver<T>
      • Task Node
      • Decorator Node
      • Condition Decorator
      • Observer Decorator
      • Service Node
      • Interval Service Node
      • NodeContentAttribute
      • AIPerceptionConfig
      • EQGenerator
      • EQTraceMode
      • EQTest
  • INTEGRATIONS
    • Adventure Creator
    • A* Pathfinding Project Pro
      • Move To
    • Dialogue System for Unity
      • Lua Condition Decorator
      • Lua Run
      • Dialogue Behaviour Handler
      • Blackboard Saver
      • Lua Functions
    • Mirror Network
      • Quick Start
      • Network Instantiate
      • Network Destroy
      • Network Play Clip At Point
      • Network Debug
    • Photon Network
      • Quick Start
      • Network Instantiate
      • Network Destroy
      • Network Play Clip At Point
      • Network Debug
    • PlayMaker
      • Set Runner Active
      • Set Perception Active
      • Get Blackboard Key
      • Set Blackboard Key
    • Sensor Toolkit 2
      • Sensor Config
    • Ultimate Horror FPS KIT
      • Quick Start
      • Apply Damage
      • Animator Event Disabler
    • Odin Inspector
Powered by GitBook
On this page
  1. Basic

Environment Query System

Basic info about Environment Query System in AI Tree

Last updated 6 months ago

is a powerful tool for AI, enabling it to dynamically gather information from the environment and make decisions based on this data. EQS is designed to execute queries that identify the most suitable locations or objects in the world based on specified conditions and criteria. It's useful for tasks such as finding the best cover positions, identifying optimal paths, or determining the nearest targets.

Key Aspects of the Environment Query System:

  1. Query in EQS consists of a set of tests and conditions applied to various objects or points in the game world. Each query returns a list of suitable objects, sorted by how well they match the given criteria.

  2. Generators define which points or objects will be evaluated in the query. Examples include:

    • Points around the character: Points can be generated around the AI to find suitable spots for cover.

    • Actors within a radius: EQS can generate a list of actors (characters, objects) within a certain radius from the AI for further evaluation.

    • Random points in space: The system can generate random points within an area to check their suitability.

  3. Tests in EQS are used to evaluate each generated point or object. Examples of tests include:

    • Distance: Checks the distance to a point or object (e.g., to find the nearest cover or target).

    • Line of Sight: Tests whether the AI can see the point or object directly, without obstacles.

    • Height or position: Evaluates the height of the point relative to the AI, which can be important for choosing a position with tactical advantage.

  4. Scoring: Each point or object is scored based on the tests, and this score determines how suitable the option is for the current query. For instance, higher priority can be given to points that are closer or hidden from enemy view.

  5. Filtering: After running the tests, EQS filters out unsuitable points or objects. For example, it can remove points that are too far away or obstructed by barriers.

  6. Context in EQS queries can be the AI itself, surrounding objects, or other elements of the game world. Context is used to define what the tests will be based on. For example, the AI might search for cover points around itself or around allies.

  7. Integration with Behavior Tree: EQS integrates seamlessly with Behavior Trees. You can set up an EQS query within the behavior tree, and the AI will dynamically choose the best action or position based on the results of the query. For instance, AI can use EQS to find the nearest cover or attack the nearest target.

  8. Flexibility: EQS allows you to set up queries for any scenario, from target selection to finding the best position.

  9. Automation of Complex Decisions: EQS simplifies decision-making for AI by automatically checking multiple factors and selecting the best option.

  10. Scalability: The system can handle queries with many points or objects, making it useful for complex game scenarios.

Example of Using EQS:

Imagine an AI character that needs to find the best cover during a firefight. EQS can generate points around the AI and then run tests such as checking the distance to each point, visibility relative to the enemy, and whether there is an obstacle between the point and the enemy. EQS will then return the most suitable cover spot, and the AI will move there.


The Environment Query System is a powerful tool for creating dynamic and adaptive AI in AI Tree. It allows AI characters to make decisions based on complex conditions and factors, such as distance, visibility, or the position of objects. EQS makes AI behavior more realistic by enabling them to find the best locations for actions or to choose optimal targets in the game world.

EQS (Environment Query System)