Download

[Blueprint Youtube Tutorial] Multiplayer Lobby

Hi everyone :slight_smile:

I’ve been working on Networking / Multiplayer logic with Blueprint. I started to make a serie of tutorial videos about it.

The main purpose of the tutorial is to build a logic that allows 2 or more players to join a lobby and travel through different levels with each other.

That’s the first time I ever make a video like this. I’m French and my English is far from perfect, I make a lot of mistakes and I hope it won’t disturb you too much. I might not be the most cumfortable talker but I hope it will be a toughtful youtube playlist anyway. There are some microphone sounds popping from time to time, I’m trying to fix them asap.

I’m not a programmer. I have no programmer formation but my own through tutorials. I might not do things “the proper way”, but everything is running smoothly so far.

Any feedback appreciated, I’m wide open to criticism :slight_smile:

Cheers & enjoy !

The playlist: [UE4 - BP Tutorial] Multiplayer Session - Introduction [1/7] - YouTube

Video Sum Up
Part I - Introduction - Showing the goal of the tutorial serie
Part II - Setting Up Assets 1
Part III - Setting Up Assets 2 - Prepairing the assets we’re going to need with further detail about each of these assets
Part IV - Widget Menu - Obviously building the UMG Menu used to travel through levels and host / join game sessions
Part V - Create/Join Session - Actually coding the multiplayer logic that allows two or more players to join a game lobby
Part VI - Open Level & Server Travel - Coding the travelling logic that allows both client and servers to be teleported with each other through different levels
Part VII - Bonus Details - About Session Result properties, Multiplayer limits, Destroy Session and Packaged Build Test

Great Tutorials! Waiting for part 5 :smiley:

Full tutorial up !

Glad you liked it :slight_smile:

Hi is it possiable to edit the blueprints to make something similar to this. i havnt not watch the tuts yet because im waiting on my new pc

Seaching for a room to play
aa1c2ed5b6c632cb1f89829e98c0381096d17340.jpeg
Room lobby waiting for the host to start the game

Thanks you very much for your feedback.

Makes me remember to add a 7th video with several tips & tricks about the sessions.

Yes you can do what you ask. In my tutorials, there is a “Multiplayer Lobby” level. If you want to do what you’re asking you’ll have to replace this level by a full empty level with only a menu in it. The menu will handle everything about lobbies.

Blueprint Session Result Structure is an “Online Session” in Blueprint. It has several properties: ping, number of players and name of server. Right now the name of server is kind of useless (58425128425812852 something like this) but the ping and number of players can be used to show the kind of “lobby searching” you’re looking for.

EDIT: I’ll just write here a small reminder for the 7th video.

  • Destroy Sesssion
  • Session Result properties
  • Limits of Multiplayer Blueprint
  • Finding the Bugs
  • Client / Server Behaviour

The Name of the server is random as long as you don’t use an OnlineSubsystem. If you use Steam, it will give you the Steam UserName.

You can do this menu and i’m already doing things like this in my upcoming Multiplayer Project for the MarketPlace. You can choose one of
4 Characters in my Lobby and press ready as soon as you want to play. It is a bit complicated getting the chosen Character over to the next
map, but using the GameInstance or a SaveGame gives you enough space to handle this. You could also save the selection on the server if
you are using an OnlineSubystem, because then you would have a uniqueID and this ID would be the same after the Level change. So the server
knows who took which character. Without a unique ID you need to save this on the Client and give it back to the server after the map change.

Bonus details added !

About Session Result Properties, Multiplayer limits, Destroy Session and Packaged Project test !

will there be more parts?-

What would you like to see?

Nothing planned for now about Multiplayer Session.

not sure yet, i just got my new pc today so im about to try the tuts. ill let you know if anything pops into mind :stuck_out_tongue:

I just went through your tutorial from start to finish. Your voice at the beginning of each cracks me up.

Anyway, thanks a ton for these. Extremely helpful and good timing, because I just started down this road(session handling) last night and got stumped. I’m to try and integrate what I learned here into my game.

There’s two issues I have after finishing.

  1. Even though the server is creating the menu, once it’s created on the client. My client can open the menu and hit HOST LOBBY button, and it sends the host away to level2. Did I miss a step somewhere?

  2. Whoever initiates the switch, either HOST going to next, or Client joining, once I reach the next level, my mouse axis dont work. They will work if i continuously hold down one of the clicks…and move the mouse, but if I let go of a click the movement is disabled. I tried standalone game mode and get the same issue. All the other inputs work including running around.

If the Client sends the host to the next level, the hosts mouse axis arent affected and the Client stays in the current level with their mouse movement not functioning. It’s only the initiator.

Any ideas on that? (I’m still investigating, I literally just finished the tutorial so)

It would be helpful to post screenshots of each of the finished blueprints I think.
Saves from having to skim the videos to double check things

EDIT: Resolved point 2. The END EVENT node sequence. I didnt have reference to self on the “set input game mode only” =/

I haven’t seen his tutorial yet, and i guess he can help you better, but normaly the Server should open a new level after hitting “Host” or something.
Either it is the Game or a Lobby. This Level should have no way to interact with the normal main menu. Only if you click something like “Back”
it should disconnect you and return to the menu. So, maybe either he is opening the lobby in some kind of main menu (so you can still click on the main menu)
or you forgot an OpenLevel node on the Server.

But i guess he can answer your question better. Just wanted to drop in the some information to your resolved problem 2.

All the “Set Input Game/UI/Game and UI only” nodes need a reference to the PlayerController. Either by calling them inside the PlayerController and using “Self” or by just
getting “PlayerController 0”.

Thanks for the info eXi. I actually just watched the one video again… well the part where the end event is and he doesn’t actually add the input to game mode there. Maybe I added it trying to fix my issue.
I just tested again and for sure i lose mouse axis input when I don’t have it in there. In the video it shows only up to the remove from parent node.

I also learned about reroute nodes from this video, wish id known about them two months ago. You should see my MyChar blueprint. It’s so ugly I could probably sell it for millions as a piece of abstract artwork. :cool:

A little error from me.

I actually did not disable the “HOST” button for the client. He is not supposed to be able to host a session, only to join or leave one.

That’s what’s happening and that’s why the server is teleported to the level 2 (set to be the “lobby scene” in this tutorial).

Strong point! Do you think uploading the finished project might make this unnecessary?

Not for me. I don’t like downloading other peoples projects and trying to work with them. I like my own naming convention etc.
Your tutorial was good because you broke the videos up in a nice way. You were pretty quick and organized. (I still played them back at 1.5 times the speed) but that was nice. But either way it’s still just easier to see a screenshot of each blueprint
“playercontroller”
“gameinstance”
“widget”

and same name or not you can quickly see and make sure yours is correct. I’d actually probably have skipped the videos initially and built out my nodes based off the screens instead…(i learn better that trying to understand what each thing does as I do it). I like the unreal docs for this. If really stumped i’d watch the video.

This is all just feedback. I think this tutorial is a very needed and welcome addition to the community. Awesome of you to do it.

I’m on mobile and can’t watch them right now, but they look awesome. If you plan on making more tutorials, anything to do with networking is going to help me a lot. There aren’t to many tutorials out there that cover a specific concept from start to end. Usually they just go over the ins and outs of RPC’s.

I have some stuff in my pocket but nothing certain just yet.

If you have any particular topic in mind I’d be glad to hear it out, it might give me an idea or point me towards what the community needs.

Have a good day :slight_smile:

This is exactly what my tutorial is about.

Consider the “Level_2” as being the Multiplayer Lobby you want.

I do realize that if you didn’t get it I must be doing something wrong in my tutorial.

You don’t need a Default Pawn Class if you want to spawn them yourself. IF you set the DefaultPawnClass, UE4 will spawn that class and posses it anyway.
So if you have a “Spawn Actor from Class” and a possess by the Controller, then you don’t need the DefaultPawnClass.

Using OnlineSubsystems will make internet games possible. Steam offers you some kind of a master server. Servers that are hosted with an official Steam Account
will be listed online. Otherwise, no. You need to create your own Master Server that handles all the registration of servers and giving out the serverlist etc.

Nah you did a good job.
I did realize after two nights of recreating most of the stuff from the multiplayer shootout game that i ‘wasted’ a lot of time. I did learn stuff but most of what was in it I didn’t necessarily need.

Now I have so much stuff in my game, my brain is all confused about what I want to delete and what to keep.
I understand the moving all players to the main map once they’ve all joined the lobby. I need to analyze how to get the proper data into the lobby list. I’m not sure how they’ve populated the server list with number of players… mine always shows 0/8 regardless of how many players are there… I’ll integrate the non-steam OnlineSubsystem after. Need a menu that lets them check off what game type they want to host… etc.

I’d like it so that if the game type is 3v3… once both teams have 3 players, the game just launches automatically in 20 seconds or something… no real need for a “host”

Gonna go back at it tonight when im done at the office. I’ll update progress a bit later

I have a spawn actor and possess function. It works for player one when no default pawn class is set… the rest just spawn at 0 which is abyss… so… i donno about this one just yet.