Buy on itch.io

Tuesday, July 16, 2013

Behavior Trees

I have spend some time thinking about the problems I face with the game AI. To this point my 'expert system' is crumbling under it's own weight and it's time to make it more robust. This became apparent when enemies started behaving strangely. They start twitching horribly and you know that an enemy is trapped in some decision loop. Then there is the next game/dev feature that I am planning for, which will be an editor. Eventually I want to be able to script event's in that editor as well as build maps. Having a behavior tree in place seems to be ideal for scripting events. 

I started looking into some resources and the best I could find was the one everyone's been talking about: Alex's presentation [requires free signup as of this writing]. It's really well explained and he goes on about the second gen. Behavior Trees. I think I will start of with my own implementation of using the first gen method. The second gen methods are mostly performance improvements which, apparently, can be implemented later.

This site (Introduction to Behavior Trees by Bjoern Knafla) is also a good resource and he also points to Alex's presentation

My plan is to roll in the behavior tree alongside my current decision manager, by starting with npc creatures like the boar's AI. This should be an easy starting point, boars are not particularly smart :don't run into a tree and that's it (ok they can fight too). Then, move on to implementing the spiders, enemies, then minions and the dungeon master. Working my way up from simple creatures to more complex ones could help identify what type of Nodes I will need in the tree. The two standard and essential nodes are are commonly referred to as Sequences and Selectors. Other specialized nodes include Concurrent/Parallel nodes, Decorator nodes, Looping nodes, Randomized nodes, Weighted Nodes using some Machine Learning result...  

No comments:

Post a Comment