Multiple AI types workflow

Hi!

I’ve been trying to create AI for my 2D game and I’ve planned to have 3-4 different versions of AI characters in my game. I’ve already created a simple patroling AI, but when I started to think about the remaining 3 AI character types, I’ve been stuck understanding the flow of the logic how I should be able to control multiple AI characters with different behavior.

I’ve created my first patrol AI (follows path actors) using C++ and behaviortree/blackboard. I only set the behaviortree for my character and the overall blackboard variable setup is done in the controller. Here’s the controller logic:

ABasicAIController::ABasicAIController()
{

	BB_Component = CreateDefaultSubobject<UBlackboardComponent>(TEXT("BB_Component"));
	BT_Component = CreateDefaultSubobject<UBehaviorTreeComponent>(TEXT("BT_Component"));

	AIPerception = CreateDefaultSubobject<UAIPerceptionComponent>(TEXT("PerceptionComponent"));
	SightConfig = CreateDefaultSubobject<UAISenseConfig_Sight>(TEXT("Sight Sense"));

	AIPerception->ConfigureSense(*SightConfig);
	SightConfig->DetectionByAffiliation.bDetectEnemies = true;
	SightConfig->DetectionByAffiliation.bDetectFriendlies = true;
	SightConfig->DetectionByAffiliation.bDetectNeutrals = true;
	SightConfig->PeripheralVisionAngleDegrees = 65.f;
	SightConfig->SightRadius = 500.f;
	SightConfig->LoseSightRadius = 700.f;

}

void ABasicAIController::Tick(float DeltaSeconds)
{
	Super::Tick(DeltaSeconds);
}

void ABasicAIController::BeginPlay()
{
	Super::BeginPlay();

	AIPerception->OnPerceptionUpdated.AddDynamic(this, &ABasicAIController::SenseUpdated);
	BB_Component->SetValueAsObject(BlackBoard_Key_DesiredPathNode, Cast<ABasicAICharacter>(GetPawn())->DesiredNode);

}


void ABasicAIController::Possess(APawn* InPawn) {

	Super::Possess(InPawn);
	ABasicAICharacter* Character = Cast<ABasicAICharacter>(InPawn);
	
	if (Character && Character->BehaviorTreeAsset) {
		UE_LOG(LogTemp, Warning, TEXT("POSSESSING"));

		BB_Component->InitializeBlackboard(*Character->BehaviorTreeAsset->BlackboardAsset);
		BT_Component->StartTree(*Character->BehaviorTreeAsset);

		RunBehaviorTree(Character->BehaviorTreeAsset);


	}

	BB_Component->SetValueAsObject(BlackBoard_Key_DesiredPathNode, Character->DesiredNode);
	BB_Component->SetValueAsObject(BlackBoard_Key_SelfActor, Character);


}

void ABasicAIController::SenseUpdated(TArray<AActor*> Actors) {
	UE_LOG(LogTemp, Warning, TEXT("test"));
}

My question: When I want to create, for example, chasing enemies, would I have to create a new AIcontroller class for this type of enemies?
It might be a dumb question, but I am not sure if I do this in right workflow nor I did not find much information how to separate the logic when creating multiple AI types (especially when using C++).

With regards