How to send data to server and clients

For my multiplayer game I’m using Advanced Sessions plugin for connecting the clients.

Now I need to be able to send info the the server (maybe player nickname, some numbers/strings and other variables based on what they are doing on the map) and when the players let’s say presses “Tab” they can see a list with all the player names, numbers of items collected, number of kill… and so on.

What should I use to be able to send all the data I need to the server and from there to each player that ask for it on a key press or maybe the server will automatically send it to all players to let them know something important happened, like a player finished a certain objective?

Normally I was thinking you would have an Array on the server, and each element is a player where all the info you need is stored about it, and when a players does something that needs an update, like picked another item, it would send to the server it’s id and the value that need to be changed.
And then the player say pressed “Tab” he will get from the server that array with the players and in the background the information is filtered to what it needs to be shown.
Now the problem is that I don’t know how to send that data. Or maybe there is an even better way to do all that.

A little insight…
The level loads the Game Mode. Game mode creates the Game State which creates the Player state. Said specific classes are defined in the Level’s World Settings panel.

A Player Controller is created for the player when he/she “connects” to a server . A player state is also created and stored in the Game State → Player Array. The Game State and the Player Array are fully replicated to all connected clients.

Typically your “Tab/scoreboard” would read the Game State Player Array. looping through the array to display pertinent information for each player.

A custom Player State would be needed to add the additional data… values like items picked up etc.

Updating the Player State for “game play actions” should be handled by the game mode.

You’ll be best served by creating custom classes for each of the primaries. Controller, Game mode, Game State, Player State etc.

2 Likes

I’ve seen something about them, but I’m really new to Unreal Engine, and now that you mentioned them as well I took a more in depth look at them, and yeah, they are exactly what I need.
Thank you!