Multiplayer Genders

Having an issue figuring out how to do genders. I have the thirdperson character with setup on it to get the players stats on the servers side from a database then populate those variables to the players. I have a male child and a female child with different setup for different animation graphs. In the game mode when someone connects i create a pawn and posess it with the associated player controller. This all works, however i have no idea how to tell the game mode which gender to spawn when someone connects, right now gender is a int, 0 is male 1 is female, so currently no matter what a male is spawned. The player has a permanent ID that is used to differentiate the different players in the DB. The ID is stored in the GameInstance at login. I dont know how to either get that ID to the game mode to figure out gender or how to get the gender to the gamemode, so that it spawns the right player character for gender.

Game mode where actor is spawned and possessed.

So, if the player doesn’t get to choose if they are a boy or girl, “flip/flop” instead of “branch”. This will make every other player a boy/girl.

they do get to choose, the issue is how to tell the server what choice they made when they created the character. Its mmo style where you create a character and you play that character persistantly. im thinking i need to use the game state possibly somehow to feed the info back to the game mode but im still working that out.

It’s been awhile since I did a multiplayer game. But the on post login is a custom event isn’t it? You can add a bool, or whatever. Also, the PlayerController is persistent so anything you set in it will carry over to the next level; pawns will not.

Thanks. Maybe I will work it in controller then. The post login is a game mode function called by ue4 when someone logs in.

Figured it out. Player controllers appear to not be persistant. So i had to alter my checkuid script to include gender grab from DB.

I cast both those variables from the UI to the gameinstance.
When the player then transits to the server the gamemode is put on a small delay while the playercontroller that is being recreated immediately calls to gameinstance for the saved gender and uid variable
Then makes a call to a run on server event to the player controller to set the server version of the players controller to the same gender and uid.
Then in game mode i cast to the player controller get the variables and spawn/possess based on the gender variable.

Working 100% without the need to spawn a holder character into a debug zone, destroy the player and recreate based on gender and possess. Dont know if its the preferred method but its what i came up with.