open level (by name) loads level for 1 second and then returns to previous level (menu world)

my game opens a level from a menu (BP widget) and does the open level (by name) bp node the level opens just fine in the editor (PIE) but not in a packaged build

using advanced steam sessions

My project in 5.1 is bare bones top down template, I have a level called Menu where I have the menu,


this calls the host session in the serverinfo advanced friends session

short video showing the problem:

you can download the project here (you will need to repackage it for windows the version in this folder is different I think)
https://drive.google.com/file/d/1UWUZbfTmLuaYD1Lk0wQQEDuFjy9gjzoE/view?usp=share_link

I think this is happening because you changed level, and your game session is destroyed. Therefore, game brings you back to main level. Because this is how engine behaves when Network Error occurs.

Can you try doing things other way around. Don’t HostSession, and then change level. Create PlayerController that is used in that GameMode for online game, and create session using it once the level is loaded. Just make sure you do it only for PlayerController that created the session, not the one who joined the session.

If you want to keep your logic, then read Traveling in Multiplayer.

Also, in your GameInstance::Init(), use this to get network error info when it happens.

GEngine->OnNetworkFailure().AddUObject(this, &YourGameInstance::NetworkFailureMessage);

Method format: void YourGameInstance::NetworkFailureMessage(UWorld* InWorld, UNetDriver* NetDriver, ENetworkFailure::Type FailureType, const FString& ErrorString)

Thanks for your help

I was able to get the original problem to go away by changing the build.cs and target.cs files with some things from the documentaton about steam online subsystem… copy and paste stuff into the defautlengine.ini, some other ini for windows…

I have a new problem where join session fails after 5-10 seconds of trying (time out?)

I tried rewiring some things to where you just start out already in the level and I add the widget buttons

the top down controller now has the client host / join session custom events which call the events inside the ServerInfo Advanced Friends Game Instance class…

(continued)

host session (ServerInfo game instance)

Join session (serverinfo game instance)

so these are called by the player controller… but join doesn’t work

I wonder if it’s a steam configuration problem or if it’s a session problem (the 2nd player can’t join a session as they already in one)

Btw this is a listen server setup so the first player is both host and player

edit:

join is successful, the session that joins sits at a black screen and does nothing for quite a while and then kicks back to the previous level (the menu) it takes a solid 1-2 minutes or so to do that.

I have it set up the original way I haven’t tried it the other way around yet.

logs from the session that joined:
logfromsess.txt (100.0 KB)

the log from the host session:
mptestt.log (206.2 KB)

You don’t need steam in order for this to work propelry. I tested this on my own game without Steam. Btw., are you testing this on the same computer, or you have two computers with two Steam accounts? If it’s the same, it cannot work. Try without steam.

It is hard to find cause of the solution like this. Why don’t you try to search for Unreal Engine Online Sessions on YouTube, and you should find tons of tutorials that should help you.