Download

Steam Dedicated Server GameDescription

Hi,

I’m trying to add a description field that can be as long as practical for our dedicated servers. I’ve found in the engine the server description:

SteamGameServerPtr->SetGameDescription(STEAMGAMEDESC);

But I see no easy way to read that back out in the shootergame server browser. I see it in the Unreal server browser under “game”, but I don’t see a easy way using the onlinesubsystemsteam to get at it. How can I access that field from the server browser/client using onlinesubsystem? Is there another field/method anyone would recommend I use for this?

Thanks!

-Shawn

Hey, why do you need to read it back? As far as I understand it’s just mean to be a static description which is identical for every game server. If you are looking to have a custom field or description for every server I suggest using the online subsystem which has a key value system for sessions which Steam supports. Looks something like this:



IOnlineSubsystem * OnlineSubsystem = IOnlineSubsystem::Get();
        if (OnlineSubsystem)
        {
            IOnlineSessionPtr SessionInterface = OnlineSubsystem->GetSessionInterface();
            if (SessionInterface.IsValid())
            {
                FNamedOnlineSession * OnlineSession = SessionInterface->GetNamedSession(GameSessionName);
                if (OnlineSession && OnlineSession->SessionInfo.IsValid())
                {
                    OnlineSession->SessionSettings.Set(SETTING_MAPNAME, UGameplayStatics::GetCurrentLevelName(this), EOnlineDataAdvertisementType::ViaOnlineService);
                }
            }
        }


But what I’m looking for is a way to add a “description” field that shows up in my game’s server browser. I don’t really care how, but I’m trying to add a “keyvalue” pair and that is making the server not even show up in the browser (even though I have no filters in my server browser) or in the Steam browser. When I remove the keyvalue pair I was adding, it shows up again. Basically, I just want to add a field that allows a server owner to put a description about his or her server. Can this be done through the onlinesubsystem steam? If so, how?

This is what I have tried so far:

/**

  • Get all relevant FSession data as a series of Key,Value pairs
  • @param Session session data to get key, value pairs from
  • @param KeyValuePairs key value pair structure to add to
    /
    void GetServerKeyValuePairsFromSession(const FOnlineSession
    Session, FSteamSessionKeyValuePairs& KeyValuePairs)
    {
    FUniqueNetIdSteam* SteamId = (FUniqueNetIdSteam*)(Session->OwningUserId.Get());
    FString OwningUserIdStr = SteamId->ToString();
    KeyValuePairs.Add(STEAMKEY_OWNINGUSERID, OwningUserIdStr);
    KeyValuePairs.Add(STEAMKEY_OWNINGUSERNAME, Session->OwningUserName);
    KeyValuePairs.Add(“SERVERDESCRIPTION”, *GetServerDescription());
    //KeyValuePairs.Add(STEAMKEY_NUMOPENPRIVATECONNECTIONS, FString::FromInt(Session->NumOpenPrivateConnections));
    //KeyValuePairs.Add(STEAMKEY_NUMOPENPUBLICCONNECTIONS, FString::FromInt(Session->NumOpenPublicConnections));
    }

When I comment out the “SERVERDESCRIPTION” line, it works fine. Am I missing something about how to add a description field to the serverlist results?

Thank you!

Check your logs, maybe there is a limit that prevents you from adding a description that is too long. I am doing a similar thing where players can enter a custom server name using the generic online subsystem interface (with the steam online subsystem backend). If you don’t have a specific reason as to why not to use the interface, you can look at CreateSessionCallbackProxy.cpp around line 60 how to set such a key value pair, in your case probably:


Settings.Set(FName("Description"), GetServerDescription(), EOnlineDataAdvertisementType::ViaOnlineService);

Well, I’ve tried the line of code you suggested (not in CreateSessionCallbackProxy.cpp, but in the OnlineSessionAsyncServerSteam.cpp. Same result, the server does not register with steam (or at least, it doesn’t show up in the shootergame server browser) if I have the line of code in, and it does if I don’t. I don’t see any errors in the server or client logs relating to Steam, it just doesn’t show up.

I just stuck it at the end of the UpdatePublishSettings() function:

Session->SessionSettings.Set(FName(“SERVERDESCRIPTION”), GetServerDescription(), EOnlineDataAdvertisementType::ViaOnlineService);