[Solved]Online Multiplayer Lobby Character Selection

Hello everybody,

I’m currently learning how to do multiplayer in Unreal, and it’s quite tough so far. I’m going to try explaining what I want to do as clearly as possible, bare with me.

I made a multiplayer lobby with the Advance Session plugin, everything is working well, I can create a session, clients can join through steam and all, wonderful.

ISSUE: My problem is with the character selection. I have 4 characters on screen selectable by clicking on a button in the UI. I can’t update the UI for the current player and all the clients in the lobby.

GOAL: When selecting a character I would like to disable the associated button so that all the other clients can’t select the same character.

I have been reading a ton of documentation, the Unreal Documentation, the Network Compendium, and watched a ton of tutorials on the subject, I know this would be trivial with more experience but I’m completely lost at the moment.

Thank you in advance for your help, and please let me know if you have some good resources you think would help me.

When a player selects a character, send an RPC to the server with the selected character
On the server, add the selected character to a replicated array on the gamestate called “SelectedCharacters”
In your UI widget, create a binding for the buttons enabled state, which checks to see if that class already in the “SelectedCharacters” array on gamestate and disable if it is.

to be totally safe you need to check in the server rpc if the character has already been selected (if 2 players select the same character at the exact same time)

Hope this makes sense.

Thank you so much it works perfectly! One step closer to understanding this whole thing!
I adapted your solution to my needs, and it’s actually so simple. Here is the solution in practice for more visual people like me:

Hey man, thanks for your input! I though it mattered only for local multiplayer and not for online multiplayer. How would you go about it?

Hey bro, dunno how you’ll use it, but take care to not use Get Player Controller like this when you build a multiplayer game, because it will always return the same player of the session, the first one.

You need to get the actual player pawn / controller of the current client that is connected and doing things on your game.

It’s fine in this instance because that blueprint gets run on the client. Each client only has their own Player Controller so Getplayercontroller(0) will always get the local one. If you’re using a listen server, it’ll have all of them but the 0th one will be the local one.

This would be different if you were using split-screen