So trying to get my hands on the shiny EQS system, I know it’s still in experimental status, so it makes more sense to ask questions like this now.
It seems EQS query only do and set 1 blackboard key, even though the Context can return those initial candidate points/object back, I can only set to 1 key. And how do I say, shoot 3 closest enemy from a turret?
When I try PushPawnAction task, or simply create new Task blueprint using the shelf button, neither have override function that can let me pass over a blackboard key value. Does this mean everything have to be done from C++ side?(Like create a new base class like MoveTo task which let me pass over a location/object for my turrret to shoot?
If point 2 can’t be done, what’s the point or running a EQS query? Or what should be done in this case for best practice?(to choose best 3 targets)
yeah, if I can’t solve this properly, maybe I will try doing a double effort that also do a trace from with in the turret(or ai controller) blueprint. I’ll wait and see if Epic staff have a better answer.
While technically you shouldn’t store your top 3 closet enemies (in this example) outside of the generator context, it is possible (store them in a separate variable/array) if you make a custom Generator. However, doing this is sort of defeating the purpose of the EQS which is to get you a single best result based on your condition(s). You can create your own custom tests in C++ so that you can get your desired results but honestly I think you should just create a BT Task and Service.
Example:
You can put a collision sphere around your turret. When an enemy overlaps that collision, add them to an array somewhere (turret BP perhaps) until the array has 3 enemies in it. If there’s a possibility of multiple enemies overlapping simultaneously then incorporate some distance check functionality to determine which ones are closest and add only those top 3 to your array.
In your BT, use a service to determine if that array has enemies in it or not, if it does then trigger the service to run a branch of the tree that does your attacking so that it only attacks those 3 enemies that are in that array.
This is just a basic generalization of what to do but think it can help you to think outside the box on this. EQS is nice but unless you either create your own C++ tests, or only need 1 best returned value, this is a decent alternative - one I’ve had to use myself. If you don’t quite understand the concept I’ve suggested, let me know and I’ll try to clarify it a bit better.
Hope this helps!
Jesse
PS: If your turret is a Pawn or Character, you can use the Perception component(s) rather than using a collision sphere which is a little cleaner to use, can open the door for more possibilities in the future (like incorporating with EQS) but may also add more work/complexity than you really need. Again, just trying to provide you with some solid alternatives to EQS, choosing which is right for you will depend on your experience, project, and needs. Good luck!
I’m not sure of any historical significance although I believe the whole intent of the EQS is to return a single best choice given a set of conditions; I don’t think they ever meant, or do I think they plan to make EQS return multiple values. Part of this could be the lack of array support in BB’s but ultimately I think it was designed to just simplify your own code based environmental queries as well as make the process faster (internally.) With the power of perception components, and the ability to incorporate EQS into your perception (and vise-versa) lends itself perfectly for creating seemingly intelligent AI while keeping everything as object oriented as possible. I’m not 100% sure if what I say here is accurate, I can’t speak for the devs, but these are the conclusions I’ve come to when dealing with the EQS and perception components myself.
any historical reason for EQS to just return one best result for doing certain thing? For the flee example, you can run the pawn into a position so that there might be more than 1 candidate locations that are same score, if just setting 1 blackboard key, that would essentially prevent me from doing a secondary heuristic if there are more than 1 results.
I understand your answer perfectly, and it would be my go to solution if this can’t be done. Thanks for answering.
I know I’m, like, 7 years late, this thread is very much dead at this point. However, I just want to say that this thing @jtsmith wrote:
I’m not sure of any historical significance although I believe the whole intent of the EQS is to return a single best choice given a set of conditions; I don’t think they ever meant, or do I think they plan to make EQS return multiple values.
might have been true in 2016, but it’s not in 2023. Here is a snippet of a Behavior Tree I made:
In this Sequence, I applied a Service that regularly runs an EQS Query. The “Run Mode” parameter on the right shows that the Query can return more than just the best result. What is still not supported, and I am in shock about this, are “array-like” Blackboard Keys able to store multiple values, which makes the “Run Mode” parameter quite useless.
I might be missing something though, feel free to correct me about “Run Mode” if I got something wrong.