There is a book, Game AI Pro, in which one chapter explains and creates the code found in the link above. It is the Behavior Tree Starter Kit (BTSK). The book explains the difference between behavior and actions. Behaviors are the set of logical expressions deciding what the AI does, in other words; what action it takes. An even more formal description is that Behaviors are the nodes in the tree who are parents. The leaf nodes either checks the status of the AI’s surroundings(conditional child) or makes the AI perform some action or task(action child and/or task child).
Among the Behaviors there are different types of specialized classes or data types. Those are the composite, sequence, decorator. All the behaviors can be connected and tweaked to lead towards the desired action in any given time. I am not going to explain this now, I will try to blog about my own implementation and explain as I learn.
There are also the first and the second generation of BTs. First generation are traversing every node from the root and is polling the different conditions among the behaviors. The second generation use event driven traversal which is faster. There are also optimizations in memory storage, instead of allocating the new nodes in a random place you can instead allocate them in a designated place in memory, this is very interesting to me and I need to read more about this. Or perhaps I should implement it just to learn this way of storing data. There are many more and different optimizations, these are just examples which I could think of from the top of my mind after having read the chapter in the book about this BTSK.
I am not sure if I should use the second or first generation. I am not going to actually need the second generation optimizations to begin with so maybe I should start doing a first generation tree and then upgrade it later, but then again why do the slower version if I think I might need to upgrade later? it is more work. besides, I do want to learn the second generation of BTs and I have no deadlines. Yes I think I will do a second generation BT, there are examples in the BTSK of second generation BT optimizations.
I can only read so much, it is time I start practicing. But I am not ready to start programming yet because I need a plan. I am going to describe what I want to do first, depending on what I want perhaps also write a diagram and then I can finally start implementing it.
Next time I will show you what I want my agent to do and how I mean to do them, possibly also why. I will keep it simple.