AI Behavior Tree Design Considerations

Hey, so I’m almost done programming my AI Patrol Bot in C++. It’s been a great learning experience.

Everything was working fine till I made 10 instances of my bot to populate the level: I noticed massive performance drops (and frame drops) while playing the game. This was mainly because of the behavior tree being processed for each instance of the bot every 0.5s.

What I wanted to know is: Is it possible to somehow have a global Behavior Tree? I can’t seem to find any material in this regard.

Right now, in my current implementation, each bot is getting a separate instance of the Behavior Tree at runtime. This seems to increase the performance overhead (My PC is running on an i7, so I don’t think a slow processor is the problem). Or perhaps, is my approach to designing the bots faulty?

Any help would be greatly appreciated.
Thank You

BTs in UE4 are not by default instantiated per AI using it. We use skeletal design, meaning everybody (interested) is using the same skeleton of the BT, and is storing only instance-specific runtime data in the BT component (via the node memory). Having said that BT nodes have an option of being instanced, and BP-implemented nodes are always instanced (mostly for compatibility with BP environment). On top of that all if you create your own BT nodes, and make them tick, you’re asking for trouble.

In short, BTs can be very efficient, or can be very inefficient, and it all depends on how you use them.

Cheers,

–mieszko