OnlineSubSystemSteam getting Server Name

Working with the shootergame example on the server browser and dedicated server, I have noticed it is showing the owning playerID in the browser, not the servername. I can change the servername there in the engine code, etc, but I don’t see where to get at the server name from the session object in the server browser code. Here’s the bit of code I’m talking about in the “ShooterServerList.cpp”:



for (int32 IdxResult = 0; IdxResult < NumSearchResults; ++IdxResult)
     {
      TSharedPtr<FServerEntry> NewServerEntry = MakeShareable(new FServerEntry());

      const FOnlineSessionSearchResult& Result = SearchResults[IdxResult];

      NewServerEntry->ServerName = Result.Session.OwningUserName;
      NewServerEntry->Ping = FString::FromInt(Result.PingInMs);
      NewServerEntry->CurrentPlayers = FString::FromInt(Result.Session.SessionSettings.NumPublicConnections
       + Result.Session.SessionSettings.NumPrivateConnections
       - Result.Session.NumOpenPublicConnections
       - Result.Session.NumOpenPrivateConnections);
      NewServerEntry->MaxPlayers = FString::FromInt(Result.Session.SessionSettings.NumPublicConnections
       + Result.Session.SessionSettings.NumPrivateConnections);
      NewServerEntry->SearchResultsIndex = IdxResult;

      Result.Session.SessionSettings.Get(SETTING_GAMEMODE, NewServerEntry->GameType);
      Result.Session.SessionSettings.Get(SETTING_MAPNAME, NewServerEntry->MapName);

      ServerList.Add(NewServerEntry);
     }
    }


You can see it is populating the “ServerName” with “Result.Session.OwningUserName” instead of the server name. Can anyone point me to the best way to get the server name? I don’t see it as a property of “FOnlineSessionSearchResult”.

Thank you!

Same problem, have you solved this ?

I know this is a bit of an old topic but posting anyways -

As of this writing (4.20.1) UE4 doesn’t by default have server names in OnlineSubsystems. For Steam in particular, it uses OwningUserName as the server name (see line 154 of OnlineSessionAsyncServerSteam.cpp). You’ll have to modify the engine to allow for custom Steam server names, whether that be adding in a method to set/retrieve the server name, or adding a custom session setting to populate it.

I know this is a super old post. But for those of you looking for the hook to importing your own custom session name support in OnlineSubsystemSteam is to use -SteamServerName=YourSessionName on the command line when starting your server.