Problem on Creating/Finding Session using the Steam OSS

Hello everyone!
I spent the last couple of days trying to setup the creation and the finding of a session with no luck.
Current setup:

  • Unreal Engine 5.3
  • Host: My own PC
  • Client: My SteamDeck with another Steam Account
DefaultEngine.ini:
___________________
// Other configs
...

[/Script/Engine.GameEngine]
+NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")

[OnlineSubsystem]
DefaultPlatformService=Steam

[OnlineSubsystemSteam]
bEnabled=true
SteamDevAppId=<my_app_id>
bInitServerOnClient=true   // This will use Steam game servers instead of lobby

[/Script/OnlineSubsystemSteam.SteamNetDriver]
NetConnectionClassName="OnlineSubsystemSteam.SteamNetConnection"

After hours of testing, I found something really odd.
Even if I set bIsLANMatch = false (in create session settings), in the game server list (under LAN section) my session shows up and I’m able to find my session if I use “sessionSearch->bIsLanQuery = true;”
If I set bIsLANMatch = true (in create session settings), in the game server list my session doesn’t show up and I’m not able to find my session if I use “sessionSearch->bIsLanQuery = true;”
(Nope, I didn’t mess with writing down the boolean flags, this is how it works on my pc aha)

Of course this is not a suitable solution for possible release of a game.
From my understanding, to rely on Session, I should use this configuration:

Host() {
    if (sessionInterface.IsValid()) {
		FOnlineSessionSettings sessionSettings = FOnlineSessionSettings();
		sessionSettings.bIsLANMatch = false;
		sessionSettings.NumPublicConnections = 2;
		sessionSettings.bShouldAdvertise = true; 

		sessionInterface->CreateSession(0, SESSION_NAME, sessionSettings);
	}
}

____

FindSessions() {
    TSharedPtr<FOnlineSessionSearch>sessionSearch = MakeShareable(new FOnlineSessionSearch);
	
    sessionSearch->bIsLanQuery = false;
	sessionSearch->MaxSearchResults = 20;
	if (sessionInterface) {
		sessionInterface->FindSessions(0, sessionSearch.ToSharedRef());
	}
}

From my understanding I should use “sessionSettings.bUseLobbiesIfAvailable” and “sessionSettings.bUsesPresence” only on Lobbies, that’s why I’m not using this.
The last part of the code I would say it’s higly important to understand the code, is the callback for my CreateSession:

	if (successful) {
		findSession(); // I added this just for debug, to see if I'm able to find my session after creation
		GetWorld()->ServerTravel("Path/To/Map?listen");
	} else {
		// Print failure to create session
	}

The last part I’d like to share is this:

  • I create a session
  • I try to look for my session
  • With “FNamedOnlineSession* namedSession = sessionInterface->GetNamedSession(SESSION_NAME);” I find my session
  • With the search results, there is no session
  • In my second device, FNamedOnlineSession nor FindSession() are able to find my sessions

I believe I wrote up a lot of details, hopefully you’re able to help me, since I’m not able to spot the problem at all.
Thanks a lot for your help in advance

The problem is actually quite simple and that is UE5.3 has issues with Steam and the only way I’ve been able to get things to work is to use a packaged build.

Also, I assume you are trying this on 2 separate computers? You cannot run 2 steam instances on the same computer.

Hi, and thanks a lot for your answer.

Yes, I’m using 2 different devices, otherwise I wouldn’t be able to test it since, as far as I know, you can only have 1 steam user on 1 device (unless you use VMs but that’s another story).
May I ask you to elaborate a bit more?
Is there any known issue on 5.3?
Also, I’m using standalone builds already, so I believe this is not the case, or maybe I misunderstood?

I can try to package my build again, but I’m pretty sure I already tested it.
I’ll write up a follow up answer as soon as I get the build finished and tested

By stand-alone you’ve created a packaged build that has an executable?

try running with -WINDOWED -log and see if you can see the OSS as steam in the log window

Oh, you’re using a SteamDeck. That is a whole other complication - for that to work you need to create a Linux build for that device.

I’m not sure about that at all. With the steam deck you can use windows builds using Proton. Also, I’ve been able to make it working, at the moment only with LAN query = true, but it should be able to work perfectly as I’m working on windows.
Of course I’m not an expert and I could be wrong

I’ve been through this with a number of students, all argued the same thing. They then tried a linux build and it worked. The issue is it fails to find the Steam OSS libraries. If you take a look at the logs, you’ll see this.

So you’re saying the problem is the SteamDeck.
That’s weird, because I’m able to log the “Found Subsystem: Steam”, but maybe there are other libs it’s not able to process properly, I’ll definetely give it a shot, thanks!
In the meanwhile I made a new packaged build and in the logs I found something interesting:

LogOnline: Warning: STEAM: AUTH: CreateServerSteam is calling the depricated AdvertiseGame call

I believe the steamworks SDKs used by UE 5.3 are too old. It’s running steamworks 1.53 instead now the latest version is 1.58.

The version in the engine is what is supported and while you can upgrade it, you have to build the steamworks yourself and risk breaking engine integration. Ironically, 1.53 is one of the versions that is actually easy to build and later ones are a nightmare. Also, normally when you do this, you would build the engine from source which takes a few hours to compile and a few more to get building. Not for the faint of heart.

Now honestly, I’ve never tried any of this with a steam deck mainly because I don’t have one and I have access to two PCs to do any testing. What I can tell you is that most people I’ve encountered who try this usually get around issues by using a Linux build. They encountered a number of errors often where trying to do things generate errors by being unable to find .so files (linux shared object libraries) which lead me to suggesting linux builds.

Aside from all of this, this particular course has since been left as a UE 4 course (mostly it works for UE5 with cavaets, including the issues with UE5.3 in particular) and there is a course specific to UE5.2 which is where I encountered SteamDeck issues and Linux fixed it every time for the student in question.

Aside from that, refer to the docs here:

Online Subsystem Steam Interface in Unreal Engine | Unreal Engine 5.3 Documentation

I recommend checking all the logs for errors in the build you have (use LOG=filename.log I think, see Command-Line Arguments | Unreal Engine 4.27 Documentation ) and hopefully this will help with searching them. It may be trying to successfully use Steam.

Going back to your code, you need to use the following or at least something similar. Presence is an absolute must:

    FOnlineSessionSettings SessionSettings;
    SessionSettings.bIsLANMatch = IOnlineSubsystem::Get()->GetSubsystemName() == "NULL";
    SessionSettings.NumPublicConnections = 4;
    SessionSettings.bShouldAdvertise = true;
    SessionSettings.bUsesPresence = true;

I’m pretty sure there are a couple of other settings that are required. by UE5

I’ll work definetely more on logging, especially on my Steamdeck since apparently it could create some problem thanks a lot for all details.

From the documentation I understood that bUsesPresence is required if I’m creating a lobby, but this shoulnd’t be the case since I’m creating a game server locally, that was my understanding.
I’m asking this just because I also tried your configuration with no particular luck.

Steamdeck aside, if I create a session (on windows), onSessionComplete I try to look for my created session and I get 0 sessions found, it means that there is still a problem on my regular build also.
The Steamdeck could add a layer of complications and problems, but I should be able to find my session once I create one.

Do you agree on what I’m saying or am I wrong?

I think you’re right in what you’re saying. Getting steam to work is complicated.

The presence is required to actually advertise a session which is why you need it along with advertise. I know from experience that without this line (required from 4.27 onwards) that you cannot establish a connection or create sessions correctly. We had a world of hurt with that one when 4.27 launched and changed the defaults (presence was on by default in 4.26)

There is another way of testing and this is a little more complicated. If you are using a Windows PC, you can install Windows sandbox. The thing to note is you need to install C++ runtime libraries and Steam and then sign in with a unique account. This can help with debugging. Note that closing the window wipes it clean which is both good and bad, bad mainly because the setup has to be repeated. Worth a try if you need more info from logs and eliminates SteamDeck from being an issue.

First of all, thanks a lot for the Windows Sandbox suggestion!
I never heard of that before.
I tried to work with Virtual Machines, but I couldn’t test my game because by default it’s no able to access the GPU so I needed to setup the GPU passthrough, but with no luck and I gave up on that.
This for sure can help me to test that the code works, and only after that I can start testing my SteamDeck.

Now I try to move back to the previous implementation to use only lobbies using Windows Sandbox.
I’m not really confident at the moment since I’m unable to find my own session once I create it, but at least I can test on the same environment, which will save me a lot of problems.

Now I’ll run different tests, packaging the build and relying on Lobbies only.
I’ll check the logs and let’s see if I’m able to find something

I tried to play around with the logs but I didn’t find any error except this one:

LogOnline: Warning: STEAM: Failed to obtain steam user stats, user: <My_user> [0x11000014CB24647] has no stats entries

From my understanding this is a problem related to the Leaderboard system, which I’m not working on at the moment.

When I create a session, in the logs there are all my infos:

[2024.01.11-18.27.33:002][479]LogOnlineSession: Verbose: OSS: dumping NamedSession:
[2024.01.11-18.27.33:002][479]LogOnlineSession: Verbose: OSS:   SessionName: Test_Session_2
[2024.01.11-18.27.33:003][479]LogOnlineSession: Verbose: OSS:   HostingPlayerNum: 0
[2024.01.11-18.27.33:003][479]LogOnlineSession: Verbose: OSS:   SessionState: Pending
[2024.01.11-18.27.33:003][479]LogOnlineSession: Verbose: OSS:   RegisteredPlayers:
[2024.01.11-18.27.33:004][479]LogOnlineSession: Verbose: OSS:       0 registered players
[2024.01.11-18.27.33:005][479]LogOnlineSession: Verbose: OSS: dumping Session:
[2024.01.11-18.27.33:006][479]LogOnlineSession: Verbose: OSS:   OwningPlayerName: <My User>
[2024.01.11-18.27.33:006][479]LogOnlineSession: Verbose: OSS:   OwningPlayerId: <My User>[0x11000014CB24647]
[2024.01.11-18.27.33:007][479]LogOnlineSession: Verbose: OSS:   NumOpenPrivateConnections: 0
[2024.01.11-18.27.33:007][479]LogOnlineSession: Verbose: OSS:   NumOpenPublicConnections: 1
[2024.01.11-18.27.33:008][479]LogOnlineSession: Verbose: OSS:   SessionInfo: HostIP: INVALID SteamP2P: 76561198066263816:7777 Type: Lobby session SessionId: Lobby[0x1860000675CEC14]
[2024.01.11-18.27.33:008][479]LogOnlineSession: Verbose: OSS: dumping SessionSettings:
[2024.01.11-18.27.33:009][479]LogOnlineSession: Verbose: OSS:   NumPublicConnections: 2
[2024.01.11-18.27.33:010][479]LogOnlineSession: Verbose: OSS:   NumPrivateConnections: 0
[2024.01.11-18.27.33:010][479]LogOnlineSession: Verbose: OSS:   bIsLanMatch: false
[2024.01.11-18.27.33:011][479]LogOnlineSession: Verbose: OSS:   bIsDedicated: false
[2024.01.11-18.27.33:014][479]LogOnlineSession: Verbose: OSS:   bUsesStats: false
[2024.01.11-18.27.33:014][479]LogOnlineSession: Verbose: OSS:   bShouldAdvertise: true
[2024.01.11-18.27.33:015][479]LogOnlineSession: Verbose: OSS:   bAllowJoinInProgress: false
[2024.01.11-18.27.33:015][479]LogOnlineSession: Verbose: OSS:   bAllowInvites: false
[2024.01.11-18.27.33:015][479]LogOnlineSession: Verbose: OSS:   bUsesPresence: true
[2024.01.11-18.27.33:016][479]LogOnlineSession: Verbose: OSS:   bAllowJoinViaPresence: false
[2024.01.11-18.27.33:016][479]LogOnlineSession: Verbose: OSS:   bAllowJoinViaPresenceFriendsOnly: false
[2024.01.11-18.27.33:017][479]LogOnlineSession: Verbose: OSS:   BuildUniqueId: 0x01d33bca
[2024.01.11-18.27.33:017][479]LogOnlineSession: Verbose: OSS:   Settings:

This seems a proper configuration, and I’m running a FindSession with these settings:

	sessionSearch = MakeShareable(new FOnlineSessionSearch);
	sessionSearch->bIsLanQuery = false;
	sessionSearch->MaxSearchResults = 20;

Maybe the first log I shared means something I don’t know?

Did you notice this?

I did noticed that but I’m guessing it’s because it’s using the lobbyId:7777:

SessionInfo: HostIP: INVALID SteamP2P: 76561198066263816:7777

If this is not the case, I need to investigate further

I am not sure why it is using lobbies to be honest. I’ve not seen this before either. It does point to a blocked IP Address - firewall or VPN related possibly.

I’m almost sure it needs to pass through lobby.
I also checked another post here that suggested to add:

sessionSettings.bUseLobbiesIfAvailable = true;

without this I’m not able to host a game. Maybe I can share the log if I remove this setting.

Current settings:

		FOnlineSessionSettings sessionSettings = FOnlineSessionSettings();
		sessionSettings.bIsLANMatch = false;
		sessionSettings.NumPublicConnections = 2;
		sessionSettings.bShouldAdvertise = true;
		sessionSettings.bUsesPresence = true;
		sessionSettings.bUseLobbiesIfAvailable = true;

Now that does in fact sound familiar. This was something also added from 4.27 and later which makes sense since UE5 is basically UE4,27 with a few new major features like world partition and nanite.

Yes, without that flag I’m not able to make it running:

LogOnlineSession: Warning: STEAM: Failed to initialize game server with Steam!

And the only way to fix this, without relying on lobby, is to use game servers, adding to the DefaultEngine.ini this property:

bInitServerOnClient=true

But from my understanding, it’s better to use these with dedicated servers.
I’ve no other ideas on how to debug this to problem

No, According to the UE docs, you need that flag if you are using sessions.

Privacy & Terms