please help! multiplayer blueprint bugs that i cannot bug fix or find out why it's happening

I’ve finally finished the blueprint tutorials and i have some problems that i just cannot figure out why it is happening or what i did wrong. (https://youtu.be/dEg2czT0rzQ?list=PL…KsRg6fpxWndZqZ) i even downloaded the original project that was uploaded but could not find any mistakes that i made.
i’ve uploaded both my project and the original project to a gdrive if anyone wants to take a look.
my project is named myproject while the original’s is steamproject. ( https://drive.google.com/open?id=1fA…xLSdRoc34vs0T3 )
the first issue i have is that the client cannot leave the lobby once he gets in. i don’t know why this is happening. (the leave button does not work for the client and i have added a print string when it fails. i added a breakpoint and it just fails at the “destroy session” node without any reason as to why.

the other issue is that once the client joins, if the host leaves the lobby or quits (because the client can’t quit so the host has to leave) , the client cannot rejoin the lobby when the host creates another lobby and the client will gets stuck in the loading screen (with the main menu widget because the guy didn’t set it up so we get sent back to main menu map upon failure to join and only loads up the main menu widget)

edit: i have tried breakpoints event onpostlogin and he doesn’t even reach that part. he is just failing at the event joinserver (in gameinfoinstance) and then on fail, load the error message so it has nothing to do with the network code either.

but once he is in the loading screen map with the main manu widget, he can rejoin the host’s lobby again.

also a question
in the tutorial, he uses /servertravel to load the maps from the lobby but this doesn’t work in PIE. i tried using loadmap instead and it works in PIE but the clients will be kicked out once the host starts the game.
is there any way to make loadmap work so that i can test in PIE since i dont have a second computer to test things out?

also another bug that he did not address in the videos is that the “ready” status of a client/player does not matter because he didnt set it to matter (ie. the host can still start game even if everyone/a player is not ready)

Hi, first you can use servertravel only in standalone or in a packaged game not in PIE (here is described how you would run several games in standalone: Running Unreal Engine | Unreal Engine Documentation under “running an uncooked game from the command line”).

Second to disconnect the client from the server you would load the main menu level on the client then call destroy session from the clients player controller (then you also won’t have any problem rejoining), what specific problem do you have with that?

And third you could check on the server if all clients have set their status to ready before starting the game.

thanks for trying to help.

as mentioned above, i am following the blueprint multiplayer tutorial and i dont understand why i am having these issues when the project files of the tutorial does not seem to have the problems that i am facing. (the tutorial series is at https://www.youtube.com/watch?v=dEg2…KsRg6fpxWndZqZ )

i have compared the blueprints on my project and the tutorial’s and cannot find any difference yet i am having some issues.

the first issue is that the client’s “leave lobby” button does not work. it just failed to destroy the session

i am unable to find out why this is happening at all with breakpoints and i have no clue how to debug this.

the next issue is that when the client enters the lobby and leaves (either by getting kicked or the host leaving the lobby - the client cannot leave on his own because of the above problem) , he will fail to rejoin the lobby and get stuck on the loading screen (which leads to issue 3 but not really an issue because the guy who did the tutorial did not load the mainmenu map, but only the widget)

for the 2nd issue/bug

this one fails at the “join session” node in GameInfoInstance without any errors and i cannot find out what is causing this as well because even with breakpoints, it just fails with for no reason at all.

for both the first and second issue, they do not even get to the on post login or logout nodes so i cannot find out why this is happening at all.

finally, for the “ready” status, the “state change” of between “ready” and “not ready” was made, but the BP that determines if you can start or not is found in lobbygamemode.

like i said, the tutorial completely forgot to make the ready state matter but and he only did the code for when “a player did not select a character” = disable game start button

i can probably add my own code to make the ready status matter but i really need help to fix the first two issues that i have that i cannot bug fix…

i have given a link to my project (myproject) and the tutorial project (steamproject) if you can take a look and help me find out what i did wrong or why i am encountering these bugs

plz help! thx!

Sorry but I can’t watch a whole tutorial series or figure out what is wrong in a whole project.

Again your first and second problem is due to not disconnecting the client properly. The code in your image shown above should work (if you’re getting the correct player). So try printing the “get owning player” between On Clicked and Destroy Session and see if it returns the client.

thanks

it seems to be working right.

the owning player is client 1, while the host is server

i checked the on login and on logout events for my issues and it seems like it doesn’t even get there (for both issues - on trying to quit by pressing button or trying to rejoin after leaving the server)

Hmm interesting, what engine version are you using?

So basically is that what you’re doing right now?: the server opens the lobby -> client joins the lobby (that works fine?), lobby gets loaded on the client -> client wants to leave (On Clicked (LeaveLobby)) -> fail to leave, client stays in lobby not opening the main menu and the destroy session node executes “On Failure”, you’re printing the string “CLIENT CANNOT DESTROY SESSION”?

yes.

i did some breakpoints and stuff and found several things.

first is that these bugs can be replicated on the original project.

the bugs i encountered doesn’t reach onlogin/onlogout. so it’s not an issue with these

the leave lobby button is the easiest to replicable because the host just needs to quit the lobby he created, then recreated another lobby several times and get the client to join.
sooner or later, the client will connect but he will not load the “the mainmenu’s floor” and the leave button will not work. (the host will be on the ground while the client will be in the clouds). this usually occurs on the 3rd lobby for me

therefore i noticed that on my project, the client actually doesn’t completely loads the lobby map?
because the main menu doesn’t have a skybox, but the client will end up stuck in the clouds.

again, no idea why he loads the map halfway…

in the original project, the leave button happens to when the client does not “reach the ground” and gets “stuck in the clouds”, but the client’s in the original project does load the lobby map properly most of the time, while mine never does.

for the bug where the client cannot join upon the host leaving, i think on the original project files, the host has to recreate the lobby 3-5 times for me before i get the fail to connect issue.

as for this issue, i do not understand why this is happening…no matter how many breakpoints i add, it just doesn’t tell me why this is happening.

there are also some issues such as not getting sent back to the main menu upon error to connect and the ready status not matter at all but these aren’t really a problem right now.

looking over the entire project and comparing mine with the original’s project files

i came across this node

there is a create lobby menu widget with a owning player connection that is left unconnected.

this is also in the original project files and in the tutorial.

i am not sure if i should put a self here since it is a multiplayer lobby…

i am on 4.24 right now and i just updated to the latest version

i also looked at the project settings and i realized that he is using “gamestate” instead of “gamestatebase”

i tried swapping to “gamestatebase” but everything breaks. the widgets/menus dont show up, so it might be somethign that was changed in the newer UE

Widgets only exist on the client who created them, so when a client creates a widget the server and all the other clients will never know about it, widgets are purely local. Therefore they also never replicate. So the owning player input seems redundant to me (don’t know what its there for).

When the host wants to quit the lobby, first disconnect all clients, then close the session on the server.

If I understand you right, then the first time the client connects to the server the client loads the lobby correctly.

So as far as I understands it, it all comes down to disconnecting the client from the server. So this is what I use in my project for that (works in my project)

From the level blueprint I open the lobby widget from the gameinfoinstance (inherits from game instance). Then in the lobby widget
widget_leave_button.png

Calls this event in the gameinfoinstance

So it checks whether the server or the client wants to leave the game, if its the client, the session will be destroyed. If its the server then first all the client sessions will be destroyed then after a short delay (to make sure all clients have disconnected) the server destroys the session.

That’s inside the game state of the lobby (inherits from the game state base, and as far as I understands it the difference is that game state contains more stuff than game state base). And that’s all that is in that game state blueprint.

And you should read this carefully, its a summary about unreal engine and multiplayer (matchmaking starts at about page 80) http://cedric-neukirchen.net/Downloads/Compendium/UE4_Network_Compendium_by_Cedric_eXi_Neukirchen.pdf

And if the tutorial project works differently than your project you might wanna watch the series again and find out where the differences are (I would assume that an official unreal engine tutorial should work as it is supposed to work)

But this is about all I can do to help you (cause if the code I’m using in 4.24 is not working and the official tutorial series is not working then I don’t know what else to try) :slight_smile:

Ahh ok, that makes sense, thanks for the clarification!

the screenshots you provided are completely different from my project, the video’s and the project files that he uploaded

this is the part where he does the leavelobby with it’s timestamp, perhaps you can take a look?that part is only 2 or 3 mins long. https://youtu.be/fvD89wscBM8?list=PL…pxWndZqZ&t=608
unlike you he did not get a reference from game info instance, but instead he got it off the widget itself

this is what he has in his project and what i have

as mentioned above, the destroy session is from the widget itself

the events you have in gameinfoinstance and gamestate of the lobby are also not in his project.

i’ll add your part to my BP and check if it fixes the rejoining bug.

also like i mentioned above, the bugs i encountered seem to be in his project as well, just that in his project for some odd reason, it only happens after several rejoins while mine happens immediately

also as per my previous post, the bug where the leave button doesnt work has something to do with the level not loading correctly, although i am unable to find out why it is happening