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?

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.

1 Like

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.