AI: Single or multiple behavior trees?

This isn’t BP question per se, but I am wondering about pros and cons of using multiple behavior trees vs a single one.

Does it make sense to have 2 behavior trees, one for non-combat and for combat, and switch them (if possible) when appropriate, instead of having one massive behavior tree that incorporate both combat and non-combat behaviors ?

Thanks

The first cons thing that comes to mind with duplicate trees means duplicating code such as moving around or special situations and zero pros.

Th

These trees are not going to be duplicates. I am basically going to split current tree into separate ones, for easier management and organization.

I suppose that many actions happen in the two places, it all depends on how is your game of course.

You can run a behavior tree as a task inside another behavior tree. With this approach you have one top-level behavior tree that runs combat and non-combat sub behavior trees through a selector, thus keeping all AI logic in one place.

2 Likes

Amazing. Thank you this solves my problem.