AI Controller

Hello everyone.
I have a quick question about the AI Controller.
I’m currently working on a project that has multiple types of enemies, some with different behaviours (some run from you, some chase you). Although most of them have many things in common like player location, health, damage, etc. I came to the conclusion that there’s some ways on how I could approuch this.
1- Each enemy type would have their own AI Controller;
2- Create one Parent AI Controller and Child Controllers for each Enemy;
3- One Controller for all enemies;
Although, so far, I only tested the second option, Parent-Child controllers. But I’m somewhat unsure if this is the best approuch.
Could someone tell me which one is the best approuch to handle this and why?

Sounds like you are not using behavior trees? In that case you can implement your logic either in controllers or in pawns I guess. I usually have one controller for ai that defines stuff like detouring and one for player pawn. Rest of ai logic is in behavior trees with some being shared between different enemy pawn types that implement common interface to handle calls from BT tasks in their own way.

1 Like

@Aethernum25
My best approach usually comes from a tandem of Behavior Trees and using the Parent-Child relationship. I typically make a base class for the enemies, and then with each new type, change the class and add functionality. Behavior Trees can make this really easy because they can give the AI a lot to process.
I hope this can help,
-Zen

Sorry forgot to mention that, yes I’m using behavior trees and Blackboards

Thank you for the reply.
Not sure if is the same of what I’m doing. I have the parent controller that has the blackboard and behaviour tree, the blackboard holds the variables that all AI will have in common (health reference, damage, player location, etc) although the BT is completly empty. On the child Controllers I run the behaviour trees that I create for every enemy. So enemy A will have BT_A, enemy B will have BT_B and so on. But I feel like the parent controller is not really doing anything besides holding common variables but at same time I didn’t want to create new variables or anything that the enemies will share. Hope that makes sense.

@Aethernum25
Definitely makes a bit of sense! The parent class is only “doing nothing” in the sense of external feeling of the gameplay, just because this first controller is such a key one to have for so many NPC’s, i.e., the ability to move and interact.
The point is really just to take stress off the developer, finding these common backbones in order to streamline later implementation. You’ll code a lot less with the Parent-Child order, because if you can make it comprehensive enough, you should be able to code onto the child the things that truly make the enemy unique. I think you’re on the right track with blackboards for sure!
-Zen