Warning: STEAM: Unknown session name (GameSession)

Hello Everyone,
I want to make a multiplayer game in ue5.5 . I added uselobbiesif availabale, I added steam subsystems into default engine.ini . After that I added some other assets into my project. Actually it is connecting to the steam and I can create a session. but when I click to join button it just waits and nothing happening. I looked to the logs to see what is wrong with it and I see that steam has a problem with my game session;

Warning: STEAM: Unknown session name (GameSession)

After find the session, it sends this warning and joining process fails. I have added some additional debug messages into different delegates and I see that my Address which we created at here;

FString Address;

SessionInterface->GetResolvedConnectString(NAME_GameSession, Address);

is null.

After this point to control I have a session at this point, I added this line;
FOnlineSession* CurrentSession = SessionInterface->GetNamedSession(NAME_GameSession);
and I see that current session is also null.

So before whole process It thrown me an error related to SEARCH_PRESENCE is not found when tried first and I included Online/OnlineSessionNames.h library to fix it. After that there is a warning;

warning C4996: ā€˜SEARCH_PRESENCE’: SEARCH_PRESENCE (ā€œPRESENCESEARCHā€) is deprecated and will soon stop being a valid UE-defined key. Please consult upgrade notes for more details Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.

Whole Steam Logs after trying to join;
LogOnlineSession: STEAM: Found 1 lobbies, finalizing the search

LogOnlineSession: STEAM: Search result 0: LobbyId=Lobby[0x18600004Bsfrsd46], LobbyId.IsValid()=true, CSteamID(LobbyId).IsLobby()=true

LogOnlineSession: Warning: STEAM: [FOnlineSessionSteam::JoinSession] The values of FOnlineSessionSettings::bUsesPresence and FOnlineSessionSettings::bUseLobbiesIfAvailable are treated as equal and have to match

LogOnlineSession: Warning: STEAM: Unknown session name (GameSession) specified to GetResolvedConnectString()

LogOnlineSession: Warning: STEAM: Unknown session name (GameSession) specified to GetResolvedConnectString()

By the way to be sure there is no issue related download region or something else I tried a basic game builded with ue5.2 and there wasn’t any error.

Hey,

I don’t know if you found the issue or not but I found something. If you have a better solution please write it down because my two options are very hacky.

In OnlinessionInterfaceSteam.cpp inside the Online Subsystem Steam engine plugin there is a new piece of code in JoinSession :

// In Steam, bUsesPresence and bUseLobbiesIfAvailable have equivalent meaning and should have the same value
	if(DesiredSession.Session.SessionSettings.bUsesPresence != DesiredSession.Session.SessionSettings.bUseLobbiesIfAvailable)
	{
		UE_LOG_ONLINE_SESSION(Warning, TEXT("[%hs] The values of FOnlineSessionSettings::bUsesPresence and FOnlineSessionSettings::bUseLobbiesIfAvailable are treated as equal and have to match"), __FUNCTION__);
		TriggerOnJoinSessionCompleteDelegates(SessionName, EOnJoinSessionCompleteResult::UnknownError);
		return false;
	}

For some reasons that I still don’t quite understand the SearchResultcoming from Steam does not have bUsesPresence equals to bUseLobbiesIfAvaiable.

Option 1 : very hacky const_cast

For now my VERY DIRTY HACK to fix this is the following piece of code inside you code called when a session is found, just before your call to JoinSession:

FOnlineSessionSearchResult* SearchResultPtr = const_cast<FOnlineSessionSearchResult*>(&SearchResult);
	SearchResultPtr->Session.SessionSettings.bUsesPresence = true;
	SearchResultPtr->Session.SessionSettings.bUseLobbiesIfAvailable = true;

Word of caution : this is a hack for now to unblock you while I understand why the Steam Search Result does not have the same value for those two booleans.

Option 2 : Less hacky but engine modification

A better solution if you can change the engine code in the Online Subsystem Steam plugins (located into Engine/Plugins/Online/OnlineSubsystemSteam) is to remove some of the code I showed earlier so at the beginning of the JoinSession method the code should look like that :

	if(DesiredSession.Session.SessionSettings.bUsesPresence != DesiredSession.Session.SessionSettings.bUseLobbiesIfAvailable)
	{
		UE_LOG_ONLINE_SESSION(Warning, TEXT("[%hs] The values of FOnlineSessionSettings::bUsesPresence and FOnlineSessionSettings::bUseLobbiesIfAvailable are treated as equal and have to match"), __FUNCTION__);
	}

It is still not ideal but better than a const_cast.

Cheers while I find a better solution

1 Like

(post deleted by author)

I think I’ve found why this is happening.

In the plugin’s code, there is a function that parses the data from the steamworks backend into session settings. Specifically:

/Engine/Plugins/Online/OnlineSubsystemSteam/Source/Private/OnlineSessionAsyncLobbySteam.cpp:228

/**
 *	Populate an FSession data structure from the data stored with a lobby
 * Expects a certain number of keys to be present otherwise this will fail
 *
 * @param SteamSubsystem the online subsystem to use
 * @param LobbyId the Steam lobby to fill data from
 * @param Session empty session structure to fill in
 * @param SearchData if this is provided and the Steam session supports SteamSockets, the ping for the lobby will be written into the search result data.
 *
 * @return true if successful, false otherwise
 */
bool FillSessionFromLobbyData(FOnlineSubsystemSteam* SteamSubsystem, const FUniqueNetIdSteam& LobbyId, FOnlineSession& Session, FOnlineSessionSearchResult* SearchData)

Between lines 273-289, the plugin parses the session settings data from steam:

...
else if (FCStringAnsi::Stricmp(Key, STEAMKEY_SESSIONFLAGS) == 0)
{
	int32 BitShift = 0;
	int32 SessionFlags = FCString::Atoi(ANSI_TO_TCHAR(Value));
	Session.SessionSettings.bShouldAdvertise = (SessionFlags & (1 << BitShift++)) ? true : false;
	Session.SessionSettings.bAllowJoinInProgress = (SessionFlags & (1 << BitShift++)) ? true : false;
	Session.SessionSettings.bIsLANMatch = (SessionFlags & (1 << BitShift++)) ? true : false;
	Session.SessionSettings.bIsDedicated = (SessionFlags & (1 << BitShift++)) ? true : false;
	Session.SessionSettings.bUsesStats = (SessionFlags & (1 << BitShift++)) ? true : false;
	Session.SessionSettings.bAllowInvites = (SessionFlags & (1 << BitShift++)) ? true : false;
	Session.SessionSettings.bUsesPresence = (SessionFlags & (1 << BitShift++)) ? true : false;
	Session.SessionSettings.bUseLobbiesIfAvailable = (SessionFlags & (1 << BitShift++)) ? true : false;
	Session.SessionSettings.bAllowJoinViaPresence = (SessionFlags & (1 << BitShift++)) ? true : false;
	Session.SessionSettings.bAllowJoinViaPresenceFriendsOnly = (SessionFlags & (1 << BitShift++)) ? true : false;
	Session.SessionSettings.bAntiCheatProtected = (SessionFlags & (1 << BitShift++)) ? true : false;
	KeysFound++;
}
...

As you can see, it never sets bUseLobbiesIfAvailable and it does not even have a value stored in the flag. What I did for a fix, and in-fact that is what epic should’ve done, is I added this line after the existing code sets bUsesPresence:

//...other settings..
Session.SessionSettings.bUsesPresence = (SessionFlags & (1 << BitShift++)) ? true : false;
//Force set the lobby flag to the presence flag.
Session.SessionSettings.bUseLobbiesIfAvailable = Session.SessionSettings.bUsesPresence;

I tested it, and it works. Already made a pull request on GitHub It is already updated on the ue5-main branch, so it might be fixed in the next couple of updates. I’ve found several other issues with the OnlineSubsystemSteam plugin, and I’m currently working on an alternative plugin, with all these issues fixed. :smiley: