• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Ender1618

Dealing with a large number of events in a BT system

11 posts in this topic

So I'm working with my BehaviorTree implementation as part of my Sim AI (FPS like Sim, but alot of social interaction).

I keep coming to the issue where I am at a particular node of my BT (say part of the idle subtree), but at that point there are a large number of things the player can do that an observing AI agent(s) needs to respond to (gaze zones, (non)aggressive postures, picking up various object in the scene, shooting at, dropped a grenade, all the things you can can say, gestures, and many more).

Another instance where this type of thing happens is player to NPC dialogs.

This need to respond to a large number of things (at any time), quickly really complicates the BT (at least the way im constructing it). Also my BT visual editor becomes a mess that is dificult to navigate and understand. With BTs I was trying to avoid the mess that happens with a visual HFSM editor.

How do people usually deal with this in a BT framework? Lots and lots of monitor nodes high up in the tree (or a high up active selector with MANY children)? Also if a monitor picks up a specific event, that event needs to be handled with respect to previous context (where you were in the tree before the event), how is that usually accomplished?

Is it a common practice for the BT to have a more DAG like structure, where nodes lower in the tree have children that are higher up in the tree (multiple parents for that node), potentially causing cyclical references? Dialogs seem to potentially need something like this.

Thanks for any advice?

Edited by Ender1618
0

Share this post


Link to post
Share on other sites
From your description, it seems that this large amount of events and rules is desired and working well, and the only trouble is with representing and editing a complex rule system. The first suggestion that comes to mind is better encapsulation, like "macros" that can be referenced multiple times without cluttering nodes with excessive numbers of children and abstractions (e.g. a "change feelings depending on gestures and gaze zones etc." black box, decoupled from acting upon the changed feelings) to limit node fan-out.
0

Share this post


Link to post
Share on other sites

How do people usually deal with this in a BT framework? Lots and lots of monitor nodes high up in the tree (or a high up active selector with MANY children)? Also if a monitor picks up a specific event, that event needs to be handled with respect to previous context (where you were in the tree before the event), how is that usually accomplished?

What's the point of placing nodes in such unnatural places that they execute with a wrong context?
0

Share this post


Link to post
Share on other sites

What I meant by nodes executing with respect to the right context is if for example, I placed many monitor nodes (or an activeselector with condition controlled subtrees) higher up in the tree (would only have to that once) that would respond to all the events that I could be looking for. 

 

One of those monitors might fire, while I am lower in the tree somewhere, but that monitor at a higher level wouldn't know where i was in the tree previously (at least the way I implemented my monitor/activeselector), and just switch out to the tree under the monitor, loosing the context of what was going on.

 

If every node in the tree that would be considered a special context for an event, were to have the all the monitors duplicated there, that would be ALOT of monitors. 

 

I must be thinking about this in the wrong way.

0

Share this post


Link to post
Share on other sites

Already have alot invested in my BT system, works well for many things the AI does.  I guess I need to try to see how I can adapt/extend/wrap it for encompassing my new need.

 

Anyone have an opinion on that?

0

Share this post


Link to post
Share on other sites

Apoch, I believe I understand your point.

 

Its not so much a matter of time investment of building up my current framework (although emotionally i guess it irrationally factors in), its that the method (BT) is working for me in a myriad of ways that HFSMs failed me or over complicated things.

 

The goal is that the AI is almost completely data driven, and there is visual tool, that a semi-layman can use for authoring. I have worked with HFSMs (with a visual tool) this way and found it could be pretty awkward expressing things (that I care aboutfor my AI) that are easy to express in BT.

 

The many context event problem. may be one of those problems expressed in a BT would be just as cumbersome or even worse. Square peg, round hole.

 

Every method has its pros and cons. I need to consider other methodology maybe for this type of problem.  I just would like to try to continue using BT for most things and another method for this issue. Yet mixing things is often harder than it seems.

 

Thanks for the input.

0

Share this post


Link to post
Share on other sites
I am a big fan of utility-based architectures. You list the available actions, compute a function that maps action to a real number and pick the action for which the number is highest. The real number you compute is an indication of how happy the agent is with the action (technically it should be the expected value of the agent's utility function). The actions of any rational agent can be expressed in this framework (for some definition of "rational" that I happen to like).

For a video game, you can probably get away with your utility function being just a sum of terms that indicate features that make an action desirable or undesirable. In some situations there is a natural scale for measuring utility (e.g., dollars), but sometimes it is tricky to balance terms that are very different in nature. Most of the terms in the utility function can simply be one-variable functions: One for health, one for health of my allies, one for health of my target (if I have one), one for how much money I have, one for obeying an order... The exact shape of those functions could be data driven.

It might take a bit of work to get used to expressing behavior as maximization instead of more direct commands, but I have had very good experiences with these systems. In particular, they are easy to tweak when agents are not behaving as desired (especially if you build some dumping mechanism for debugging), and they prioritize desires extremely well in unusual circumstances (so they don't try to finish their coffee when someone walks into the room with a gun, because the satisfaction of having coffee is dwarfed by the desire to be safe).

I expect it would be relatively easy to integrate BTs and utility-based decisions, for instance by having some action-selection node in the BT that evaluates a utility function to decide which plan to take. I have no experience with these mixed systems, and I prefer to keep things uniform. But if you are heavily invested in BTs, you might want to consider this option.
2

Share this post


Link to post
Share on other sites

Sounds like you need to break your AI logic into two parts :

 

1) a goal selection system that analyses the current situation and picks the highest priority goal.+ solution  (evaluation of this is often the most difficult to come up with equivalency metrics for situational factors)

 

2) an executor for that goal+solution which is specific to the solution - you could continue to use your Behavior Tree method here - just one 'tree' for each specific solution

 

Effectively you break up you one ginourmous tree to mutliple specific use trees  - with one run when its matching goal+solution is active  (this  gets rid of excess logic outside its own domain)

 

The (1) analysis + goal selection does not have to run each cycle, though you may need to do so when certain significant events happen (triggering a general reevaluation...)

 

If the same goal+solution is selected again it should be resumed (to restore the progress made)

 

Each BT should have 'cut' checks that would be reevaluated frequently to see if the current solution is still valid (situation hasnt changed) which on failing would push execution back to the goal selection (1) stage

Edited by wodinoneeye
1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0