When is PlayerController initalised?

A co-op game where each player is assigned a different pawn such that no pawn appears twice (Like in Left4Dead where the character assigned to the player is random, but not duplicated)

I imagine to do this, when the PlayerController is initialised (but before the pawn is spawned) it would query some kind of register in the GameInstance to ask “Is PawnA taken yet?” and if not, spawn and possess PawnA, otherwise ask “Is PawnB taken yet?” and so on.

Am I thinking along the right path here? If so, at which point in the game setup process do PlayerControllers get initialised? I’m looking at this flow chart but can’t quite work it out:

Thanks in advance.

I am unsure what you mean by pawnA or pawnB yet taken? PlayerController are initialized after the game mode, that’s all I know. But what I did instead of a player controller, I use the

virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;

within my APawn class to bind all the actions.

It looks like this:

void AMyPawn::SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) {
    InputComponent->BindAction("ZoomIn", IE_Pressed, this, &AMyPawn::ZoomIn);
    InputComponent->BindAction("ZoomIn", IE_Released, this, &AMyPawn::ZoomOut);

    InputComponent->BindAxis("MoveForward", this, &AMyPawn::MoveForward);
    InputComponent->BindAxis("MoveRight", this, &AMyPawn::MoveRight);

This way every pawn registers its own bindings and in the Tick method of the pawn I do the actual movement collision whatnot. So for me there is no Player Controller I care of. I do so for a 2 player split screen demo I did. Works very well had no issues.

Since you most likely do a multi client network based game, the server might be best to select which client has what pawn in the current scene but I never did it in the unreal engine up to now.

I just wanted to let you know that you can do the input mapping / setup inside the pawn class once it gets instantiated / spawned + using the pawns tick method for input handling. Works very well for me. You can also do something similar inside a component you attach to an actor / pawn / character which does the binding and input handling on its tick method.

In GameMode there is a function called GetDefaultPawnClassForController which you can override and return the Pawn you want for that particular Controller.