Dealing with multiple threats in a BT framework

Started by
3 comments, last by IADaveMark 11 years ago

Btw, this is an FPS like sim.

I currently have a Behavior Tree decision system, that queries an agent blackboard (essentially a list of name value(any type) tuples with some optimizations) for looking up values in condition expressions evaluated by BT condition nodes. The blackboard is populated by a senor perception filer (which can generate derived values from the raw perception system) feed by a sensory perception system. Knowledge bits added to the blackboard are things like: player detected, player hostile, player distance, player position, player velocity, last known position of player, etc. Blackboard entries can also be written to by Set action nodes (I try to minimizes this to reduce side effects in my otherwise declarative structure). Blackboard entries are also queried for use as parameters to actions.

This is all well and good when there is only one threat/target to the be considered (e.g. one player). How do people typically deal with multiple threats in a BT like system.

Would a filter before the BT prioritize targets and threats and write info on the highest priority one to the blackboard?

If so how does one deal simultaneous pertinent actions by multiple threats/tragets?

Is this dealt with transient entries into the blackboard (one per perceived threat)? If so how does the BT know of the existence of these multiple entries?

My approach is naive (I think) in the sense that the BT is looking up very specific blackboard entries by name (or optimized key) for conditions and the like. Is there another way to approach this?

Should it be looking up entries by wildcard, then managing a list (I am unclear how this would work)?

Thanx for any input.

Advertisement

Hi,

Good question!

In general this problem is independent of how you execute the behaviors. Most often, there's a separate system for picking the highest risk target and engage a single behavior to deal with that, there's a separate system for picking positions according to that primary target (and possibly a secondary one), etc.

I've rarely seen production systems take into account more than two threats for position picking, and even in the cases you have two threats, the second tends to be weighted a bit lower than the first to prevent indecision problems and static/boring gameplay.

Alex

Join us in Vienna for the nucl.ai Conference 2015, on July 20-22... Don't miss it!

Sifting and sorting through a list of targets by some manner of scoring system is the purview of utility-based algorithms. In this case, you can build your BT selector use any scoring system you like to rate the targets and then select the highest scoring one (or use a weighted random to provide variety). Additionally, you can extend the use of the utility stuff to higher areas of the tree to dynamically decide if you want to attack or do another action rather than using the hand-authored priorities that are inherent to BTs.

For more on utility, there are two videos and an article that I have written on my blog.

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!"

Alex, Dave, thanx for the insight.

So typically a BT system would only deal (encode logic) for 1 target/threat at a time.

Where an external to BT system would be picking what that 1 threat/target is.

Something like a cover picking system can consider more than 1 threat, when picking a cover position, but only communicate its top choice to the blackboard where the BT would look it up. Or possibly more than 1 cover point can be chosen, where the other cover choices (valid but maybe not optimal) could be weighted lower, for a weighted random selector to pick between them.

This prioritizing choice could be done in a number of ways, one being using marginal utility (constructed by some multiple consideration formula adjusted by possibly some graph primitive, like a Logit function, etc.)

I guess this could be done in what I am calling the perception filter, that is feed by the perception system then generates derived perceptions and writes them into the agent blackboard.

So we would typically want to keep that logic out of the BT, and let the BT worry about other things.

Am I understanding that right?

Are there situations where some of that threat/etc prioritization might need to exist in the BT, in some fashion. I am thinking about flanking sub behaviors that need to understand the geometry of the battle and therefore its participants and what they are doing?

In a general sense, you have the right idea. BTs are good for considering things in a very explicit hierarchical structure and order. Utility systems are good at letting things sift themselves out. A hybrid system is good for keeping some things in order, but then reasoning about pieces and parts as necessary.

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