Behavior Tree is good for a turn based rpg ?


New member

I just bought Behavior tree, I'm totally a newbie and I'm reading the documentation.

I think that I can use this asset in a lot of projects, it's a long term investment, but right now, I'm doing a turn based rpg like the a lot of JRPG and I'm asking : "it is good for theses kind of games?"
When is the AI turn, each characters must evaluate what they want to do. If they are strong, they must to attack the weaker enemy, If the are weak and have magic health, they use it, etc

I was thinking that a lot of "if" will be hard to code, so I bought this asset but I'm not sure if it's a correct use.

Thank you for reading.


Staff member
The short answer is yes, you can definitely use behavior trees for a turn-based JRPG game. There are a couple of different ways to make the behavior tree wait for their turn:

1. Only tick the tree when it is the AIs turn. This can be done by calling Tick on the BehaviorManager.
2. Create a new task which is reevaluated using conditional aborts and only returns success when it is the AIs turn.

You can mimic an if/else statement with the following setup:

                             Sequence     falseAction
                 ifCondition    trueAction