Description

EQS places a cheap filter as the last step of a query when using auto-sort for single item results if there is only one filter.
 
Found via [Link Removed] which is quoted below:
 

Environmental Query system (EnvQuerySystem) not running all filters before scoring.
According to the documentation: https://docs.unrealengine.com/4.27/en-US/InteractiveExperiences/ArtificialIntelligence/EQS/EQSNodeReference/EQSNodeReferenceTests/
"Filtering is done before scoring to avoid calculating the score on filtered out items."
But in changelist:
https://github.com/EpicGames/UnrealEngine/commit/4f632f9aeaededbad3217c16ea8f363b4ab12a3c#diff-4ee0472dc63aa767380b5e[…]0197051d5317a28987475229b453
The code was changed to run trying to run the most expensive filter last after scoring (the changelist says its fixing jira ticket (jira UE-69990), but I dont think there is any way for me to get visibility into that issue).
 
In our game we have some eqs that look as follows:
GenerateActorsOfClass.
GameplayTagFilter (cost low) PathfindingScore (cost high)
When auto sorting is enabled, the order of tests becomes
PathfindingScore (cost high) GameplayTagFilter (cost low)
Because there is only one filter and the code now has no consideration for cost of scoring.
I've solved it in the short term by authoring the eqs as:
PathfindingScore (cost high) GameplayTagFilter (cost low) GameplayTagFilter (cost low)
So the ordering becomes:
GameplayTagFilter (cost low) PathfindingScore (cost high) GameplayTagFilter (cost low)
But that is less than ideal because it requires custom eqs authoring and its wasted work.
It would be useful to understand the original bug that was trying to be solved, and then we can author code to support both cases (probably by not setting a HighestFilterCost if all the filtering costs are low).

[Link Removed] that was used as basis for [Link Removed].
 

Steps to Reproduce
  1. Create EQS query
  2. Set it to use auto-sort (should be enabled by default)
  3. Set generator to Points: Grid
  4. Add Pathfinding test and use it only for scoring
  5. Add Distance test and use it only for filtering
  6. Run EQS using Single Best Item as the querying mode and step through its tests

Have Comments or More Details?

There's no existing public thread on this issue, so head over to AnswerHub just mention UE-137553 in the post.

0
Login to Vote

Unresolved
ComponentUE - AI - EQS
Affects Versions4.25plus
Target Fix5.3
CreatedDec 14, 2021
UpdatedJan 5, 2022