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"

What should be a pawn and what shouldn't?

We're making a pretty simple top down twin stick shooter in Unreal 4. Right now, a couple of us are working on enemies, and I'm a bit confused about what type of actor they should be. Right now we have a turret that inherits from actor. It pops up if the player is close enough, rotates to them and fires. Right now, it's all in the Turret actor class. Should this be a pawn possessed by an AIController, separating the AI from the turrent's functionality? Since instigator has to be a pawn, this would make the most sense.

Should I be careful using a new AIController for every enemy? Or is that the idea? Should stuff like this be a pawn? What separates a pawn from an actor?

Product Version: UE 4.9
Tags:
more ▼

asked Sep 17 '15 at 01:36 PM in Using UE4

avatar image

Bonnnnnn
135 8 15 23

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

What seperates a pawn from an actor? Not much. A pawn is just an actor with a few stock components added.

You can "duplicate" a pawn by creating an actor class and adding those components and its essentially the same thing.

The core thing to know here is class inheritance and inheritance in genreal. A character class inherits from the pawn class. A pawn class inherits from the actor class. An actor class is the lowest down in blueprints, but technially it inherits from "UObject"

If your actors are working just fine, stick with them however it cant be setup to be controlled by an AiC.

Generally I create character classes for anything that needs to move like a human, and pawn for those that dont, but thats just prefernce. You can acheive almost exactly tyhe same things in character and pawn classes because they can both be controlled by an AiC and cause character inherits from pawn.

As to the AIC question. Its probably technially best to have one AiC per "type" of AI but what you can do is create a "base" AiC class which holds everything that ALL AiC's will share, lets say a interger variable called health. Then you can right click on the AiC parent class (lets say you called it AiC_turrentsMaster) and click "Create Child Blueprint Class". The child class you created (by stock should be named AiC_turrentsMaster_child I think) will do everything and have everything that the master does, but can have unique properties. You can go a step further even and create a child class of the child class.

So you could go like this.

AiC_base :: All AiC's. Holds a health variable. AiC_base -> AiC_NPCs :: All NPCs Inherits the health variable and adds a mesh component AiC_NPCs -> AiC_villagers :: All NPCs that are villagers. Inherits the health and mesh comp variables and adds a dialog system that constantly checks if the player is trying to talk to them. AiC_villagers -> AiC_femaleVillagers alll NPC villagers that are female Inherits the health and mesh comp variables and the dialog system runs constantly.

Of course I probably wouldnt go like that, but it shows you how class inheritance and inheritance works.

Generally like I said. Actors are most versitile so use them when you can, but if its a character generally pawn is suggested and if its a complex character generally character class is suggested.

Hope this helps Don't forget to accept an answer that best clears your question up or answers it so when the community finds your question in the future via search/google they know exactly what you did to fix it/get it going.

more ▼

answered Sep 17 '15 at 04:18 PM

avatar image

Nsomnia
1.8k 67 27 137

avatar image Bonnnnnn Sep 18 '15 at 05:06 AM

Yeah, I'm fine with having many different TYPES of AIControllers, but worried about having MANY instances of AIControllers. Since our game will have tons of tiny enemies at once, they will all need an AIController in theory. However, I think the auto possess AIController option in pawns kinda implies this is intended. You'd almost never have a PlayerController live only as long as it's pawn, so I figured you wouldn't do the same with an AIController.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
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