- Home /
Adapt a behavior tree graph structure to quest system
I came across an article about behavior trees (directed graphs) and would like to adapt that logic to a quest system.
My thoughts
Each quest is basically a decorator node that you attach a composite node to and quest steps are nested quest nodes with their own conditions and actions.
A manager that keeps a list of all quests the player currently has and can be queried by the game world.
Questions:
I am not sure when to evaluate the tree? Is it for every query against it? Unlike a BT which I read must be evaluated from the root every tick, I feel like I could cache the first quest step node that fails and just test that one until it passes and then evaluate the entire tree?
For the manager do I keep a list and make conditions specify the root and the step to query status or just append to a "master tree" data structure? I would think the list would help eliminate really deep trees.
Can anyone that has build a quest system like this point out any problems or things to consider with this approach or point me towards a better pattern?
This is similar to what I have been thinking of. Would be great to have some examples - even after 5 years of your question.