Download

Who what calls create session for a dedicated server?

For a listen server its trivial to create session via game logic following user input.

But on a dedicated server there is no user intervention once started so at what point create session is called and by what?

For dedicated server there is a method for creating the session provided in the GameSession class:



void ASwatGameSession::RegisterServer()
{
	TSharedPtr<const FUniqueNetId> UserId;

	auto OnlineSubsystem = IOnlineSubsystem::Get();
	if (OnlineSubsystem)
	{
		auto IdentityInterface = OnlineSubsystem->GetIdentityInterface();
		if (IdentityInterface.IsValid())
		{
			UserId = IdentityInterface->GetUniquePlayerId(0);
		}
	}

	CreateGameSession(UserId, SwatGameMode->GetClass(), GetWorld()->GetMapName());
}