Should behavior score evaluator iterate through all possible targets?

Started by
3 comments, last by IADaveMark 5 years, 9 months ago

I was experimenting with Apoch's curvature project and everything made sense, until I got to the point where I had to think about how it automatically chose the target for behavior.

The code fragment in question is the ChooseBehavior method here:

https://github.com/apoch/curvature/blob/master/Scenarios/ScenarioAgent.cs#L86

That got me thinking if that's what I want and how to deal with it in cases when automatic target choice is not appropriate.

On one hand, it makes sense to iterate over all possible targets and evaluate scores and then pick not only the winning behavior but also the winning target for the behavior.

On the other hand, there might be a huge number of possible targets even for a simple "MoveTo" behavior. I definitely would want to somehow filter them, but the filter criteria cannot always be strictly defined. Sometimes I might want an NPS to consider MoveTo for visible targets only. Sometimes I might want it to consider moving to its home location, which might happen to be on the other side of the game world.

And sometimes a behavior might be executable even without any target at all (for example, some Idle activity), but Curvature for this case gets stuck with "Stalled" message because it expects to always receive the winning context from ChooseBehavior.

For example, if I try to implement GoHome behavior as a MoveTo behavior using some IsHome flag as an input, it would be very inefficient to run MoveTo behavior on every target to find if the target is marked as a IsHome for the NPC. After all, the NPC might have a property HomeLocation which could be immediately used as an input for MoveTo. But there is no way to pass it as an input for consideration (and it makes no sense - HomeLocation is a vector pointer and not some numeric value to use for consideration and scoring).

So, my guess is that abstract MoveTo with automatic target choice might be appropriate when choosing among multitude similar items. But in cases when I want my NPC to navigate to some special or unique object, I have to create a very specific behavior (GoHome instead of MoveTo) which contains the logic for extracting the HomeLocation form the NPC agent.

Or is there any other elegant way to solve target (context) filtering for behaviors without getting too specific and creating lots of behaviors like GoHome, GoToWork, GoToEnemy ... but without evaluating every possible item in the world?

Advertisement

Have you watched our GDC AI Summit lecture on that architecture?

http://www.gdcvault.com/play/1021848/Building-a-Better-Centaur-AI

The short answer is that any behavior that is targeted is scored on the behavior+target basis. Anything that is standalone is scored on only the behavior basis.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

Thanks, yes, that makes sense. So, one solution for unique targets might be to treat their behaviors as standalone because there is no need to evaluate GoToWork for other targets if the agent has only one unique workplace to go to.

Correct.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

This topic is closed to new replies.

Advertisement