Hey, I’m currently working on dedicated server.
There are two maps : severlobby and actual playmap.
In server lobby, the server nominates one player as a session admin.
Which has a authority to start game, kick player, select rull etc.
I want server to save “who is the admin” in gameinstance so that same player to be nominated as admin,
even after server traveled to play level.
I’m currently saves the custom user ID of admin as FString, and uses it to specify certain player.
But, aren’t there any better way to recognize and save certain client?
I don’t think there is a better way. Each time a map loads, all users will be disconnected and reconnect. There is no way to guarantee players will have the same unique id between levels.
What you could do is set a boolean on the PlayerState something like bIsAdmin. The PlayerState has a special function called copy properties which can transfer data between levels. Basically, the new PlayerState is created before the old one is destroyed, during this overlap period, the old PlayerState can hand off the required properties.
However, this DOES require seamless travel.
When the new level loads and players start “rejoining”, you can use the PostLogin event in the GameMode to validate which player has the bIsAdmin flag set TRUE and hand the unique ID back to the GameInstance.
Thar was a quick, perfect answer. At least, now I know that I’m not going to totally wrong direction.
Thanks for kind answer. I think i should learn more about seamless travel.