Online Subsystem Steam - Can't find created lobbies/sessions

I have setup an empty project with a minimal Steam integration: one button to host a game which creates a session, one to find existing sessions. I am using the IOnlineSubsystem session interface in C++ but I have tried also using the default Blueprint Create/Find Sessions nodes.

Generally speaking the Steam integration seems to work fine (the overlay pops up in game and I can see the OnlineSubsystemSteam being initialized properly from the logs). Create Session seems to work as I get a valid LobbyId. Finding the session, on the other hand, fails miserably (over the Internet). I can see a lot of Lobbies being found but not the ones created using my game instance. I have been testing using 2 different Steam accounts on 2 different computers running the same build, connected to different networks in the same country.

The issue seems not related to my network setup. The reasons I state this are the following:

  • I managed to create and find lobbies using the Steamworks Example, even cross-country
  • I tested connection from outside to a custom server running on port 7777 inside my home network and managed to reach it both using UDP and TCP.

These are the session settings I use:

	FOnlineSessionSettings SessionSettings;
	SessionSettings.bAllowJoinInProgress = true;
	SessionSettings.bIsDedicated = false;
	SessionSettings.bIsLANMatch = false;
	SessionSettings.bShouldAdvertise = true;
	SessionSettings.bUsesPresence = true;
	SessionSettings.NumPublicConnections = 5;
	SessionSettings.bUseLobbiesIfAvailable = true;
	SessionSettings.bAllowJoinViaPresence = true;

these are the search parameters

	SessionSearch = MakeShareable(new FOnlineSessionSearch());
	SessionSearch->bIsLanQuery = false;
	SessionSearch->MaxSearchResults = 10000;
	SessionSearch->QuerySettings.Set(SEARCH_PRESENCE, true, EOnlineComparisonOp::Equals);

I have added the necessary configuration to my DefaultEngine.ini as documented here and in fact the steam integration works. Also, when the lobby is created, I can see this in the logs:

SteamNetDriver_2147482483 bound to port 7777
[...]
GameNetDriver SteamNetDriver_2147482483 IpNetDriver listening on port 7777

After looking at the OSS-Steam source code I thought the problem might be due to the BuildUniqueId so I tried to set it to a fixed number of my choice but that did not work. I am still unsure if the issue is related to the creation or the finding part. Or both. And I am running out of ideas.

What else can I be missing?

Random stuff I am seeing in the logs that might be relevant:

  • LogOnline: STEAM: Missing P2PCleanupTimeout key in OnlineSubsystemSteam of DefaultEngine.ini, using default
  • SessionInfo: HostIP: INVALID SteamP2P
2 Likes

Did you modify the steam subsystem plugin?

How I managed to make it work is: you actually have to slightly modify the OnlineSubsystemSteam plugin. I don’t know if it’s possible to do it in the engine folder, but you can always copy it to your project instead of the engine (just make sure it doesn’t exist in the engine folder anymore; just back it up somewhere).
Just go to your engine folder → /Engine/Plugins/, cut the OnlineSubsystemSteam, paste it to some safe location, then copy it you your project’s /Plugins/ folder (create one if it doesn’t exist);
Then open /OnlineSubsystemSteam/Source/Private/OnlineSessionInterfaceSteam.cpp and somewhere around line 240 add “Session->SessionSettings.bUseLobbiesIfAvailable = true;” Recompile and it’s done. UE now finds Steam sessions.

2 Likes

Hi @Tuerer, thanks for your feedback!

I am pretty sure I am already using bUseLobbiesIfAvailable when passing the FOnlineSessionSettings as parameter to the IOnlineSession::CreateSession method (see my SearchSettings above). I cannot check the OSS source code at the moment but from what you are saying it seems you are overwriting the defaults which in the end should lead to the same result… unless there is some other arcane magic done in the Subsystem…

Yes, you did that for CreateSession; but in the plugin it’s for FindSessions. I’m not sure if you can specify this parameter for FindSession in your code, but it works in the plugin code.

1 Like

Ha, interesting, didn’t know that was a thing in the FindSessions method as well. Will check tonight, thanks!

Hi! I have just peaked at the code and the lines you are mentioning are related to the creation of the session, I do not see anything related to Lobbies on the FindSessions side of things.

Anyway the thing that confuses me is that I am already finding a LOT of Lobbies created by other developers but not the ones I create!

1 Like

Ok, so I rechecked what I have. And yes, it’s about creating lobbies, you were right; anyway, I added:

Session->SessionSettings.bUseLobbiesIfAvailable = true;

at line 241

Right after the line

// Create Internet or LAN match

And it works. Even though you’re setting this in your own class, for some reason it doesn’t work unless you set it in the plugin.

1 Like

So what I ended up doing was to try the Advanced Sessions Plugin. And that worked flawlessly. Was able to find sessions created by a friend also cross-country. And he was able to find mine.

I am not yet sure what exactly is the difference between the creation/search done there and the one I was doing. One thing that is starkly different is the fact they have a built-in mechanism to try a search two times. It’s a bit curious, but maybe that is doing the trick…