Multiple AI using Behavior Tree

Hello everyone,

I was wondering what is the best way to create multiple AI in a game. Right now I have one AI Controller that is using one blackboard and running one bahavior tree. While creating another AI, I thought I could simply create a blackboard key of type ‘Class’ in my Blackboard, and using that value in my behavior tree to know which branch to use for the correct AI. But I can’t seem to find just how to do the simple check : is the key from class ‘A’, No?, is the key from class ‘B’, Yes?, then move the enemy this way. Even after reading countless time the behavior tree composite tutorial, seems like I’m having a hard time knowing the potential and use of each. So is this a viable method (if I get it to work), or should I be using different Behavior Tree / BlackBoard for each AI ?

Thanks

Whilst looking for info on AI for myself i came across this which might offer you some info part 2 especially
https://.youtube.com/watch?v=4H_1skacmXA

Thanks for the answer, I’m gonna check both video soon enough. Just to point something out though, I’ve seen people creating 3D games with mesh and like skeleton for the character, I don’t have that cause I’m doing a 2D game, so I’m using the paperCharacter class. I’m not sure if the technique differs then, but I forgot to say about it in my first comment. I’ll answer again after I’ve watched both videos to say if it helped !

I’d either design a different tree or make it generic enough to use as a blanket tree. For instance, you might have two sub-branches that get picked based off a boolean. You should be able to use the same blackboard, but then again not sure if you’d want to if you’re also using a different tree.

The video is more of a 3d AI using the NavMesh so, since I’m using only paper2d with papercharacters, I don’t think it really applies to me. I’m a beginner so I’m not sure if what I’m thinking is correct, but I thought of handling ALL of my AI in ONE behavior tree and ONE Blackboard. Having sub branches that get picked based off the class the enemy, so each enemy could have his own branch section. The two things I don’t know right now are : how to check if a blackboard key is from a certain class, rather than is SET. And finally, I don’t know if this is kinda good for the performance, having ONE big tree with a lot of branches for all the AI. I’m still heading in that direction, if someone have one or even better, two responses for these questions, that’d be really helpfull.

No one knows?

I have five different creature types which share the same blackboard but will use different behavior trees. They are all using the same AI controller.

You shouldn’t care about whether a blackboard key is used or not. Just create different behavior trees for characters which need different AI behaviors. If the behavior tree doesn’t use a particular key, no big deal. If you try to create a single behavior tree to drive the behaviors of multiple types of creatures and run it off of the same blackboard… I dare say that you’re doing it wrong and you’ll be over engineering/complicating things just to force it to work in a way its not designed to be used.

Yeah you don’t need to create multiple 1s, you spawn multiple AI controllers and they use the behaviour tree and create their own instance of it.

I got 4 NPC’s running the Same AI Controller and Behavior Tree.