One Character with two AI Layers?

Hi everyone,

I have the following situation, and I’m not quite sure how to solve this problem properly:

I have a tactical RPG battle system, kind of similar to the ones the Final Fantasy games have: The player controls a hero party via a battle menu to fight a party of foes. Via the menu, the player can choose between commands like “attack”, “magic”, “defend” and so on.

All characters on the battle field move on their own, heroes as well as enemies. Their movements are mainly “eye candy” to make the battle field more interesting, and they are dependent on several parameters, like how the other party moves, as well as on the actions they are asked to perform. To manage this, a behavior tree would be a good choice. All combat members’ movements are rather similar, so everyone’s AI can get the same behavior tree with a few minor parameter changes.

However, it gets tricky when I need to add a second “layer” of AI, namely the brain of the foes.

The enemies should act like enemies usually do in RPGs like this: They should attack from time to time, cast spells, maybe heal themselves when their HP sinks below 25%, counterattack, etc. - all the stuff the player uses his battle menu for. So a behavior tree would be great for this as well! However, every enemy acts differently, so they would need different trees.

I would love to give everyone two behavior trees, one “movement tree” and one “action tree”. However, it is known that you can’t run two trees on one AI.

I know this is a rather complex problem, but anyone of you got an idea how to solve this? Maybe you have had a similar problem and can hint me in the right direction?

Thanks,
Jonas

PS: I’d like to solve this inside the editor, if possible, because our programmer has little capacity at the moment.

I believe you can execute a behavior tree from within a behavior tree providing the Blackboard is the same.
There is also capability via an available open source plugin that offers more flexibility in this regard if you search for that.

So I would propose you have the capability to enter into a new behavior tree in some condition and then the plan should be to exit that tree, but I have not played with nested behaviors yet myself, seems feasible.

You can easily reuse BT assets inside other BTs by using RunBehavior and RunBehaviorDynamic tasks.

Cheers,

–mieszko