Lobby system character selection

Hi there!

I am trying to make a lobby system, just to learn. I’ve managed to setup everything correctly and a player can connect to a session successfully and gets to the Lobby level where he/she gets assigned a default pawn.

What I want to do is, I want to provide the players a character selection system. The player can select a character and then spawn as the selected character class. I managed to do that, I made a simple UI with 2 buttons and each button is basically a character to select.

When a button from the UI is pressed, AssignSelectedCharacter is called which sets the SelectedCharacterID which then I use to pick a character class from my array of character classes. Afterwards, character gets changed from the gamemode and then in the player controller, I save that class as a variable in the game instance.

Everything works in the lobby, the server/client can swap characters and all is replicated correctly without any errors. However, if I start the game as the host, a simple servertravel happens. Then, in the first level, both characters get set to the character class which was selected by the last client. I cannot wrap my head around the issue. I followed the original Unreal Multiplayer tutorial and copied some logic from it. I believe it has to do with saving, do I need to try this out with different machines?

If anyone can help me out I’d really appreciate it! Here are some screenshots:

Lobby player controller:

Lobby Gamemode:

First level gamemode:

First level player controller:

Thanks a ton.

OK, so I tested with multiple platforms and it seems to work as intended. However it doesn’t load correctly if I’m testing on the development PC. I believe its because it creates one save game file. Any way around this? A better way to do what I want? Thanks :slight_smile:

Take a look at player state’s CopyProperties. If you are using seamless travel when transitioning from lobby to game, then you can copy variables from the old lobby player state (lobby) to the new one (game).

1 Like

Thanks for the tip! I’ll check it out. Appreciate it!