[Networking] Spawning players on specific player starts

Okay so I am currently working on a small game to play for me and my friends.
Assigning teams is the same logic as in the ShooterGame template.
Now I found out that the way it is programmed in the shootergame template it does not work. This is because the moment a playerstart is chosen the playercontroller doesn’t know yet on what team it is. I also found a really old bug pointing to this.

If somebody would be so nice to point me into the right direction. Preferable someone with networking experience.
I already found the GameMode call logic which is: PreLogin -> ChoosePlayerStart -> Login -> PostLogin
So the moment my playercontroller is assigned a team at the moment is in the PostLogin method which I think is the correct method to put such logic in.
I don’t understand why ChoosePlayerStart is called before the Login method because that one creates the PlayerController.

For custom spawning conditions, I 'd suggest spawning your players manually after they have succesfully logged in. Before Login is called is indeed too soon to try and retrieve any custom information.

What you can do is, set the team on the player controller (or even the player state), have a custom player start class that has some sort of selecting a team logic to it and then after a player successfully logins, call a SpawnPlayer() method on your gamemode in which you will select a player start depending on your player’s team of choice. The way you can choose one or more “team” player starts is by making 2 or more arrays (depending on the number of teams in the game) our of them by using the world actor iterator . It is the C++ equivalent of the blueprint node “Get All Actors Of Class”.

Got it working by override on FindPlayerStart, ChoosePlayerStart and RestartPlayer.