Questions tagged [behavior-tree]

Use the [behavior-tree] tag when referring to the model of plan execution used in computer science, robotics, control systems, and video games. Behavior trees describe switchings between a finite set of tasks in a modular fashion. Their strength comes from their ability to create very complex tasks composed of simple tasks, without worrying how the simple tasks are implemented.

Definition:

A Behavior Tree is a tree of hierarchical nodes that control the flow of decision making of an AI entity. At the extents of the tree, the leaves, are the actual commands that control the AI entity, and forming the branches are various types of utility nodes that control the AI’s walk down the trees to reach the sequences of commands best suited to the situation.

Behavior trees describe switchings between a finite set of tasks in a modular fashion. Their strength comes from their ability to create very complex tasks composed of simple tasks, without worrying how the simple tasks are implemented.

enter image description here

Some Relevant Questions

Questions that should have this tag could include (but are not limited to):

  • Chaining libraries of behavior
  • Running state of the nodes in the tree
  • Behavior tree traversal or flow
  • Queries about behavior tree specific nodes. Eg. selector nodes, sequence nodes, etc

Links to learn more

40 questions
9
votes
3 answers

Creating an AI Behavior Tree in C# - How?

I am attempting to create a "behavior tree" using C#. For anyone who doesn't know, a behavior tree is basically a framework that you can construct an AI around. There are Sequencers, Selectors, Decorators, composite actions, and other things. I have…
Jason
  • 2,445
  • 3
  • 17
  • 17
7
votes
2 answers

Top down Game AI

I'm creating a game that requires the units onscreen to fight eachother, based on teams and designated enemies for each team. The player doesn't control any of the tanks or teams. The issue is that the battle between the units (tanks at the moment)…
Daniel G. Wilson
  • 14,955
  • 2
  • 32
  • 39
6
votes
3 answers

Does Model-View-Controller Play Nicely with Artificial Intelligence and Behavior Trees?

I come from an MVC background (Flex and Rails) and love the ideas of code separation, reusability, encapsulation, etc. It makes it easy to build things quickly and reuse components in other projects. However, it has been very difficult to stick…
6
votes
3 answers

Best Practice for Transitioning From Nested State to Nested State (see diagram)

I am trying to wrap my mind around the best way to implement nested state transitions in a single threaded programming language (Actionscript). Say I have a structure like this behavior tree: Now imagine that each leaf node is a destination point…
Lance
  • 75,200
  • 93
  • 289
  • 503
4
votes
1 answer

Translating a declarative DSL into nested function calls

I have a python library which builds special iterators (a behavior tree) out of nested function calls. While the API has a fairly nice and light-weight syntax (due to it being python), it could really use a declarative DSL. Here's a rough sketch of…
David Eyk
  • 12,171
  • 11
  • 63
  • 103
4
votes
3 answers

Behavior Tree versus State machine

I want to implement a complex branching logic Android business application to be used as a marketing questionaire tool with lots of questions and branching among them according to what the user responds. I'm confused whether to implement the dialog…
iceman
  • 4,211
  • 13
  • 65
  • 92
4
votes
2 answers

Behaviour Trees and canceling running events

I'm having issues implementing my behaviour tree. I think I understand the basics, but I am stuck with running events and specifically how to stop them (or rather how not to stop them) Assume the following simple tree: Tree while "talk_to_lady" …
cboe
  • 469
  • 1
  • 9
  • 25
4
votes
2 answers

Calling child's method from parent's implementation method in golang

I'm trying to implement a behavior tree in go, and I'm struggling with its composition features. Basically, I need Tick() implemented below to call the method defined by wherever it was embedded. Here is behavior.go: type IBehavior interface { …
Felipe Rocha
  • 127
  • 8
4
votes
1 answer

State Like Action In Behavior Tree

From what I understand on Behavior Trees, each Behavior should be a short goal oriented Action that could be done in a few iterations. So for example, below is an image of a Behavior Tree: Now let us assume that the Drive To Enemy behavior takes…
Free Lancer
  • 1,000
  • 2
  • 16
  • 33
3
votes
2 answers

How good is the idea to use behavior tree for player movement?

I develop a game with Unity. Now I implement a player parkour (movement) system, so I try to choose pattern that will help me to keep architecture clean in the long term and easily add new states. I tried to use state machine pattern, but I…
3
votes
3 answers

Can I use Lua's require to set environment of the calling file?

Is there a way to call require in a Lua file, and have the module set the environment of the file that calls it? For example, if I have a DSL (domain specific language) that defines the functions Root and Sequence defined in a table, can I have…
Azure Heights
  • 271
  • 2
  • 8
3
votes
6 answers

Behavior Tree Implementations

I am looking for behavior tree implementations in any language, I would like to learn more about how they are implemented and used so can roll my own but I could only find one Owyl, unfortunately, it does not contain examples of how it is used. Any…
Hamza Yerlikaya
  • 49,047
  • 44
  • 147
  • 241
3
votes
3 answers

Determining what action an NPC will take, when it is partially random but influenced by preferences?

I want to make characters in a game perform actions that are partially random but also influenced by preferences. For instance, if a character feels angry they have a higher chance of yelling than telling a joke. So I'm thinking about how to…
lala
  • 2,052
  • 6
  • 24
  • 33
3
votes
2 answers

Alternative to enumerators in AI

I'm working on a server for a multi-player game that has to control a few thousand creatures, running around in the world. Every creature has an AI with a heartbeat method that is called every few ms/s, if a player is nearby, so they can…
Mars
  • 912
  • 1
  • 10
  • 21
3
votes
2 answers

Game AI - Behavior Trees

How do you make a robust AI/scripting system for a game? 1) For all NPC's/environment/entities do you give them a SEPARATE single behavior tree (etc. patrolBehavior, allyBehavior, vendorBehavior, doorBehavior)? If there are 500 units on the screen,…
Exegesis
  • 1,028
  • 1
  • 18
  • 47
1
2 3