0 votes
1 view
in AI and Deep Learning by (43.2k points)

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 found a single library that has implemented a "behavior tree" in C#, located here (http://code.google.com/p/treesharp/) but I cannot understand how to actually use it since there is no example code I can draw from. Could anyone here perhaps make some simple example code that shows how to actually use this framework.. or perhaps you know of another way to implement a behavior tree in C#?

Thanks so much!

1 Answer

0 votes
by (92.8k points)

Behavior trees(BT) are implemented from their hierarchical, branching system of nodes with a common parent, known as the root. Behavior trees try to mimic the real thing they are named after—in this case, trees, and their branching structure, it would look something like the following figure:


A basic tree structure

Behavior trees can be build up with any number of nodes and child nodes. The nodes at the very end of the hierarchy are referred to as leaf nodes, just like a tree. Nodes can represent behaviors or tests. Unlike the state machines, which rely only on transition rules to traverse through them, BT’s flow is defined strictly by each node’s order within the larger hierarchy. A BT begins evaluating from the top of the tree (based on the preceding visualization), then continues through each child, which, in turn, runs through each of its children until the leaf node is reached. BTs always begin evaluating from the root node.

You can refer the following link for the implementation in C#:https://forum.unity.com/threads/how-to-program-c-behavior-tree.526077/

If you wish to know more about AI Behavior Tree then visit this Artificial Intelligence Course.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !