x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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?

Product Version: UE 4.18
Tags:
more ▼

asked Jan 27 '18 at 04:08 PM in Blueprint Scripting

avatar image

Inconceivable
27 3 2 12

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

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.

more ▼

answered Jan 27 '18 at 04:25 PM

avatar image

xlar8or
6k 159 127 303

avatar image Inconceivable Jan 27 '18 at 05:04 PM

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...

avatar image xlar8or Jan 27 '18 at 05:14 PM

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.

avatar image Inconceivable Jan 27 '18 at 05:36 PM

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

avatar image xlar8or Jan 27 '18 at 05:49 PM

Let me know how it goes.

(comments are locked)
10|2000 characters needed characters left

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:

alt text

and this placeholder source:

alt text

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:

alt text

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:

alt text

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

more ▼

answered Jan 27 '18 at 08:14 PM

avatar image

Inconceivable
27 3 2 12

avatar image xlar8or Jan 28 '18 at 09:38 AM

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

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question