What to use: Pawn+Controller, Character or LocalPlayer

Hi there,

I have an almost basic question I think but I can’t get a clue what’s best for my project. Let’s assume the following situation:

&stc=1

The LoginMap and the CharaterCreationMap are almost easy as there are no “playable” players. But when the user selects the character he want’s to play my confusion begins.

What is the best way to have a “character” (in the meaning of a playable guy in the world) that can draw to the HUD like health and is able to travel between the world-map (level) and some instance-maps (levels)?

As far as I can assume I have three options:

  1. Pawn with PlayerController
  2. Character
  3. LocalPlayer

So what is the best option?

Thanks in advance!

Those 3 options are basically the same. A Character is a subclass of a Pawn. The LocalPlayer is just a property of a PlayerController referencing either a local player or a net connection. A PlayerController is the base class for every player (human or bot) which can possess pawns (including characters). So you may try to use mainly the player controller while in the login and character select map. In the world map you can spawn your Character and let the PlayerController possess it.
For traveling see:
Travelling Documentation

Also take a look here:
Gameplay Framework Documentation

Thanks for pointing out that. I forgot to mention that I’m not using UE4 OnlineSubsystem. Instead I use a custom client-server solution. Does LocalPlayer exists independently of the OnlineSubsystem? And does seamless travel work only on the client side without OnlineSubsystem?

LocalPlayer exists for every Client and are part of the general system, not exclusively OnlineSubsystem (pretty sure on that).

The only time I’ve ever had to access the LocalPlayer is to create a Save System which loads data when the player logs in or first enters a game. You will need it for things like Xbox / PS4 Profile integration etc, but otherwise you probably won’t need to touch it. LocalPlayer is I think a sub-class of UPlayer, which is the UObject for an actual player - about as close to the player as you can get.

Seamless Travel is mainly part of the GameMode. I don’t think you need to use the Network system to use it since all it really does is copy the data in PlayerState and PlayerControllers from one level to another, and sets it all up again when you load into the next level. However, there might be some stuff happening in the Online system that keeps the connection open while that happens.

Most online stuff can be done through Interfaces (which is why you’re able to swap between different online systems). If you can make your system work with that interface, most things should work the same.

EDIT:

Btw to ‘Login’ and use HUD elements, you will have to have a PlayerController, which by default all players do anyway as soon as they login (see PreLogin and PostLogin in GameMode.cpp). Without a PlayerController, the player can literally see or do nothing.