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?
asked Jan 27 '18 at 04:08 PM in Blueprint Scripting
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.
answered Jan 27 '18 at 04:25 PM
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:
and this placeholder source:
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:
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:
I'm pleased with this, it seems like a good starting point. I'm certainly open to any comments/suggestions/criticisms!
answered Jan 27 '18 at 08:14 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here