Download

Whats the concept behind dedicated Server with Onlinesubsystem

I’m having problems to the get the concept of Dedicated Server especially with Steam.
I’ve created a very simple Create and Join Game.

I’ve then replaced the OnlineSubsystem with the Steam. After starting the game steam shows up.
The question here is, if I start the editor with -SERVER it is basically a dedicated server, is it?
I wanted to test it like that to avoid having to have a source build, is that possible?

If I now try it with Steam, using LAN it finds and joins the session successfully, but then it gets a timeout when the client tries to connect to the server map. The public session crashes the server, is it even possible to make those real dedicated server tests with the public app ID, as in the documents it states that it offers only basic functionality and I guess many people use this open session here or do I have to pay to steam for those just for fun projects?

When Server now startsup, it can register itself using the registerServer. I create here a session, what is the HostingPlayerNumber here? Or I mean what is it used for at all? Can I just set player 0 here?

	IOnlineSubsystem* OnlineSubsystem = IOnlineSubsystem::Get();

FOnlineSessionSettings SessionSettings;
SessionSettings.bIsLANMatch = false;
SessionSettings.NumPublicConnections = 2;
SessionSettings.NumPrivateConnections = 0;
SessionSettings.bAllowInvites = false;
SessionSettings.bAllowJoinInProgress = true;
SessionSettings.bShouldAdvertise = true;
if (OnlineSubsystem)
{
IOnlineSessionPtr SessionInterface = OnlineSubsystem->GetSessionInterface();
if (SessionInterface.IsValid())
{
SessionInterface->OnCreateSessionCompleteDelegates.AddUObject(
this, &ATestSession::OnCreateSessionCompleted);
OnlineSubsystem->GetSessionInterface()->CreateSession(0, FName(“Session”), SessionSettings);
UE_LOG(LogTemp, Error, TEXT(“Session Created”));
}
}

In the Code, bUsesPresence seems to switch between a LobbySession and a InternetSession, what is the difference here?

Is it even a good idea to use a steam server best practice? In my mind this is a very simple process and I was thinking of creating a custom REST API. On Startup the server registers itself. The clients send a request to get a session. The REST API matches the players according to their steam stats and returns the URL with port to their session. Would that be a viable option or am I missing major complexity here?

Thank you very much for helping here with any of those points.

YES -SERVER
-SERVER or ?Server IS = TO A DEDICATED SERVER.
-listen or ?listen IS = TO A LISTENING SERVER.

1 Like

Thank you for your answer.
So there is no need to have a source build? It should work like that.
Can you help with the other questions as well?

I’m not familiar with dedicated servers, but I am familiar with the online subsystem and listen servers.

Your AGameSession class is what handles the actual connection requests. By default, it is set to 16 players I believe. You can override this number either in AGameSession::InitOptions, or add: ?MaxPlayers=4 to your option string when opening a map (InitOptions reads this value). Also, the online subsystem should stop you from joining a full session as well. Maybe you haven’t registered players with the session?

AFAIK you can’t create server builds without a source engine build.

AFAIK if you are using the IOnlineSessionInterface with SteamOSS configured, you’ll have to use presence sessions for stuff to work properly. This has its limitations. Max 50 search results can be returned when searching for sessions, and max 250 players can be present in a session.

You should think about sessions as an online match. You shouldn’t create a “master” session. When a player wants to play, you either find and join a session, or create one and wait for players.

1 Like