Networking: GameMode, PlayerController; connection

Recently i am trying to translate what is written in my custom Player Pawn Class to be used with a PlayerController.
Because i was struggling with all the pawn-copies every single player had, i tried using Gamestate with no success.

I found out about player controllers:
My goal is to get a list of all playercontrollers that are currently connected to the gamemode. So if there is a key wich is pressed by a player, the gammode can process its logic and send 1 array of player positions to each gamestate, wich then further processes the new positions to transition with what the player actually sees.

Even better would be for the playercontroller to actually have the gamemode included so i can run functions instead of checking for what has changed! my approach is something like this:

//AServerState* Gamemode = (AServerState*)GetWorld()->GetAuthGameMode();
//if (Gamemode)
//	Gamemode->keyPress(...);

my solution would be to use that code sample above in my playercontroller class and maybe even: Gamemode->AddPlayerToArray((ASpherePawn*)GetPawn()); right at begin play to get a reference array of all players in game.
in a 3 player example i am assuming the following: 2 players dont know about Gamemode so they simply do nothing. 3 More Playercontrollers do exist on the server and would know about inputs wich can be processed.
i would have less fancy struggle by that approach, wouldnt i? what is the usual way of doing this when i need to have an update every frame?

Im just asking if im on the right way: Player Pressing Key. Instead of using clientside logic it sends the key to be processed to the single existing gamemode. the server updates his own gamestate logic. gamestate is replicated so everybody is seeing whatever was pressed simultainiously.

does the gamestate only require the DOREPLIFETIME_CONDITION or also the other functions? when the (dedicated) finishes its Tick(delta) it calls the gamestate and sends a whole player array.

thing is my game is like a simulation with physics. maybe garrysmod + 8balls is similar. and im planning on having max 16 players or maybe 2-8. so the server needs to be authoritative

this is how i connected my gamemode with its gamestate
MODE.H

AOverallState* gamestate;

MODE.CPP

void AServerState::BeginPlay()
{
	gamestate = GetWorld()->GetGameState<AOverallState>();
}

wich also has an array of all pawns and should update them accordingly to what is replicated

thanks for your advice. im really not sure if gamestate.array = pawnArray would be enough to keep all clients on current state and not just the server

turned out more long than i expected. but hey its networking :wink:
i have some experience in this but im only 4 months into UE4 and came from NO IDE → javascript, made my own thing with it. and also ive never posted a question :wink:

GameState has a TArray called PlayerArray, which contains an array of all the player states. If you want to access a player controller from a player state you can do something like

auto currentPC = Cast<MyPlayerControllerClass>(currentPS->GetOwner());

You should set the pawn ownership to be the player controller that is caught on post login and then send an rpc to the server and then You can replicate the key presses as you wish!