Multiplayer - carry over playername and teamname through sessions

First off let me explain what I got so far:

Menu level: Has its own "menu" gamemode

A button that hosts a game - creating a session loading up a player lobby widget showing player names and team names next to them with the ability to click on them to change team color (wich currently happens only in the widget - so no impact on the game)

Lobby has a play button that calls a server travel command loading up a level

Theres also a serverbrowser looking for sessions to let players join the session

game level:

has its own state , hud, pawn, playercontroller and gamemmode.

a bunch of assets and game logic.

Id like to know a few things:

what would be a good way to carry over information about teamsides from the playerlobby widget to the actual game map (since all default blueprint classes that the level has are different from that one in the lobby [except state wich i now made this way])

The other thing is about playernames. I discovered gamestate has a nice array of playernames. I wonder tho how I could access them in a way so I can set the player name to a different one. Or is it better I set a variable for name on the playercontroller - if so how do i correctly transfer this “name” value over to a new session (first from menue to joining a game lobby [again - the new session starts in lobby] where i could “set” the name in the menu already, and then from lobby to game when theres other default playercontrollers) does the game remember

Another very different thing I noticed is the differences that happen when I want to test things. It seems when I go to test the level through “new editor window” all players are always present - even if I go to host a game and create its own session the other client IS already joined - that seems to be different from what I experienced after packaging. how does the editor testing behave in regards to sessions?

I dont even think I asked everything I wanted to know in the last few days.

I also kinda thought about that for simulating an online game the (or a) session should already start when I open the game right? - and - before that - look for an existing session so all players are connected up already in the menu (with their names and all that acesssible for everyone - so I could handle player invites, chat and that kinda stuff right?) To take this further - lets say the lobby doesnt start with a new sesssion - a new session is only started by clicking “START” in the lobby, taking all people in the lobby with them - so now the server handles all the menu things that happen before a player gets into the game. Can the session for players that have not been in this lobby (The main - menu session so to say) still persist=? - can there be multiple sessions on one server so to say? (I guess yes if I dont destroy it right?)

I’m unsure how to do this in BP, but in C++ one method to transfer data between levels is to make use of tokens in the travel URL. Its very similar to how you can add arguments to a PHP link. Here is an example of how I can join someone’s game and pass my player name and team ID:


The arguments are received in C++ in the AGameMode::Login function as Options, so the content of Options would be name=NisshokuZK?team_id=1. From there on you can parse and apply the options, for example to retain the same team ID from the previous level. I’m not sure if this is possible in BP, as the Login function itself is not exposed to BP as of 4.7.

the comment u wrote seems to be about passing arguments upon connecting (or I am bad at interpreting this code) I dont even need that too bad, i just thought it would be nice.

As I wrote, I am connecting to the server. Then I put people in teams - then theres a mapchange (servertravel) [with seamless travel active on every single thing I have.] thats the most important thing and the only reason why i made this whole menu thing so i can already let players start correctly and in their respective teams etc

Since im 3 days working around with this stuff I made a few changes. Ill see if it works soon

PS: about the Login function - theres the “event post login” node called on the gamemmode when someone joins a server (and has been given a player controller) with a pin to his player controller reference.

From what I’m reading and I think NisshokuZK read the same thing, you’re trying to figure out how to make sure that you can pass the lobby information to the game server, right?
What NisshokuZK gave you is the best way that he (and I at the moment cause I’m just starting my networking) can think of in order to pass information.
You would pass that string to the game server from the lobby menu and when the player connects the AGameMode::Login function can process that string and set up the correct information.