What's the purpose of a PlayerController?

Heyo fellow devs,

i’m just struggling a little with understanding the concept behind controllers. So i’ve got a few questions regarding that topic.

  1. Why shouldn’t i handle my input events in the Character blueprint?
  2. What’s the best way to communicate between Controller and Character? Does the Character listen for events defined by the PlayerController or does the Controller call functions defined by the Character?
  3. Does using a controller simplify multiplayer development?
  4. Whats the relationship between the Player, PlayerController and Character? How many Controllers can a Player have? How many Characters can a Controller control?
  5. Why does a PlayerController have a Location / Rotation? I thought of it merely as an abstract object rather than a manifested object in my world.

I’d love to hear your thoughts about this topic :slight_smile:

Quite interested in this subject as well; will answer something i know.

  1. AFAIK, it’s not stated anywhere and that’s exactly how you do that.
  2. It has nothing to do with multiplayer directly, but it supports it of course.
  3. Player represents player :slight_smile: Player controls PlayerController, PlayerController controls Character. Character/pawn is possessed by single controller and only, AFAIK.
  4. PlayerController is an invisible entity, what you actually control is PlayerController, it represents camera rotation, player location in the world and much more. Notice, it uses first camera found from ACharacter actually.

That’s what i know more or less, interested in other answers as well :slight_smile:

There’s also AIController, which controls NPCs in the game, it fully drives controlled pawn associated with it, but instead of getting input from player it analyzes world and accepts various commands(though it depends on AI implementation).

Thanks for sharing your knowledge :slight_smile:

Currently i handle all of my Input Actions in the PlayerController and fire off specific events like a “DirectionDoubleTapped” event for the character to listen for and let’s say switch to sprint mode. Is it okay to still handle standard actions like “InputAxis MoveHorizontal” or plain key events in the character blueprint? Or should i offload these to the controller as well? Is it “allowed” to change the velocity or any other properties of the character from within the controller? Maybe you can give me a hint on best practices?

edit: There might be a reason for the “Consume Input” property being On by default when handling an input event in the Controller. I have a bad feeling about turning it off ^^

that actually makes sense ^^. Thanks :).
And then what’s the controller for? xD

Input should be processed in pawn directly.

For example you have character pawn, vehicle pawn, and helicopter pawn. Controls may and may not differ for every pawn, but still you do various stuff on input triggers.

So for example character is default pawn, if you enter vehicle, all you’ll have to do is change possessed pawn to this vehicle and nothing else, input then will be processed accordingly.

Pretty much :slight_smile:

But well, actually it handles a lot of other stuff.

You’re welcome. GamePlay framework documentation does not cover these aspects pretty much, but if you have knowledge in programming, you could get pretty much info on how thing works just having a quick look at sources, indeed :slight_smile:
I recommend you to create topic on forums for this type of subject, they’re discussion oriented, unlikely to answerhub.

I might need to take a closer look at the PlayerController and perhaps the source code as well. Thanks for your patience and answering all these questions :). You helped me a lot already!!

My main programming language is C# but i always wanted to get deeper into C++ as well. So here’s my chance i guess ^^.

You’re absolutely right. Will move this to the forums. And thanks again :slight_smile:

I see that you also asked this in the forums. I’ll cut and paste the response given by Jeff Farris just in case others are looking for it.

Forum link : What's the purpose of a PlayerController? - Blueprint - Epic Developer Community Forums

To represent an agent in the world we typically use 2 objects, a Pawn and a Controller. Think of the Pawn as the in-world representation of the agent and the Controller as the “will” or the “brain” that drives it. The Pawn is kind of like a sock puppet, with the PlayerController being the person whose hand is inside. A Controller can possess/unposses a pawn to take/release control of it. A Pawn doesn’t always have to have a Controller, and a Controller doesn’t always need to be possessing a Pawn.

Controllers come in 2 flavors, the AIController and the PlayerController, representing an artificial will and a human will respectively.

So in short, the PlayerController is the code representation of a human player’s will in the game.

To address your specific points…

  1. It’s fine to handle input in the Character. It’s a natural way to think of things, especially for less complex cases, so we made sure to support it. If you have more complex needs though, like multiple players on one game client or the ability to change characters dynamically at runtime, you might be better off keeping your input in the PlayerController.

  2. I’ve typically followed a marionette-style model, where the PlayerController decides what to do and just issues commands to the Pawn (e.g. “start crouching”, “jump”)

  3. For some things, it’s necessary. In MP, the Controller persists throughout the game while the Pawn can be transient (e.g. you die and respawn, you get a new pawn but your controller is the same).

  4. By default the possession/control relationship is 1:1. So a Controller can control at most a single Pawn, and a Pawn can be possessed by at most a single Controller. You could change that with the source though.

  5. This is something we’ve talked about internally several times. A PlayerController has a ControlRotation that’s useful for capturing rotation inputs. The actual position and rotation aren’t particularly useful themselves.


The questions from faselbaum are really helpful in educating new users of UE4. Glad to have you around mate.