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