Squad AI Manager

I want to create a manager who directs commands to multiple actors in the scene. The manager is not going to have a mesh or be rendered, it is strictly a manager class that makes decisions and gives commands to the members of the squad. I would prefer to do this with C++, as that’s where I’m most comfortable.

I’m not sure how to go about this conceptually. Should I make the team comprised of classes that inherit from UActor, and expose functions that the manager can call? Should the manager be a class that inherits from UObject? If so, how do I instantiate a UObject and communicate with it via Blueprints / Behavior Trees?

Hey there, i would probably make the manager as an actor that has references for all of the squad members (which should be characters i would say). From that you need to expose information from the squad members to the manager so that he can issue the commands to each individual behavior tree, stuff like what state is he in, what enemies does he see, etc. I’m giving general advice since i don’t really know what type of game you want to make and what the squad is supposed to do.

I thought about that, but it seems like it’s not correct to make the manager an actor. I don’t want to render the manager, he just needs to exist conceptually. That’s why I asked about inheriting him from UObject. But then I don’t know how to instantiate him and communicate with the characters…

Being an actor doesn’t mean that you need to render anything, it’s just an instance in the world. You can make it an uobject and instance it using NewObject and store in a variable in your custom game mode. Dont forget to set that variable as UPROPERTY so it’s not GC’d.

Ah, very interesting. I’m pretty new to the engine, so thank you for pointing me in this direction.

Let me know how it goes.

Okay so I think I have a decent base for this. I created the following class, which inherits from Object, to act as the boss for the squad:

https://i.imgur.com/28zVxZa.jpg

and this placeholder source:

https://i.imgur.com/x1CcVaN.jpg

Then I made a GameInstance. I read for awhile about GameMode, GameState, and GameInstance, and I actually think this should live in a GameState. But for now (because it was easier…), I went with a GameInstance. I made a variable called “BossInstance”, with the type being “Boss”. In the Event Graph for the GameInstance, I instantiated the BossInstance variable like so:

https://i.imgur.com/4XFjzUt.jpg

And then I called the test function on a keypress. This is just a placeholder for now, to verify that the class is accessible and capable of being manipulated when the engine is running:

https://i.imgur.com/KLwVrMU.jpg

I’m pleased with this, it seems like a good starting point. I’m certainly open to any comments/suggestions/criticisms!

When you define a uobject there is no visual representation, is that what you want?