I have been working on getting sessions working with Steam.
I followed the following tutorial
I am testing this with 2 different steam accounts and computers. I can successfully see and join sessions that I create.
However, when I join a session it takes me to my MainMenu map instead of my Foo map.
And then shows the connection getting TIMED OUT.
I have attached the server and client logs to this post.
So within the client log I see the following
Browse: 192.168.1.129//Game/Maps/MainMenu
LogNet: NetworkFailure: ConnectionTimeout, Error: 'UNetConnection::Tick: Connection TIMED OUT. Closing connection.
However, the server travels to the correct map, “Foo”.
My c++ code looks just like the tutorial for this
SessionSettings->Set(SETTING_MAPNAME, FString("Foo"), EOnlineDataAdvertisementType::ViaOnlineService);
UGameplayStatics::OpenLevel(GetWorld(), "Foo", true, "listen");
As you can see the server is calling OpenLevel with the “Foo” map and the “listen” parameter.
Within OnJoinSessionComplete I am calling ClientTravel. Which to my understanding should open the “Foo” map now that the server is on that map. However, as you can see from the logs it opens MainMenu.
void UFPSGameInstance::OnJoinSessionComplete(FName SessionName, EOnJoinSessionCompleteResult::Type Result)
{
GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::Red, FString::Printf(TEXT("OnJoinSessionComplete %s, %d"), *SessionName.ToString(), static_cast<int32>(Result)));
// Get the OnlineSubsystem we want to work with
IOnlineSubsystem* OnlineSub = IOnlineSubsystem::Get();
if (OnlineSub)
{
// Get SessionInterface from the OnlineSubsystem
IOnlineSessionPtr Sessions = OnlineSub->GetSessionInterface();
if (Sessions.IsValid())
{
// Clear the Delegate again
Sessions->ClearOnJoinSessionCompleteDelegate_Handle(OnJoinSessionCompleteDelegateHandle);
APlayerController * const PlayerController = GetFirstLocalPlayerController();
FString TravelURL;
if (PlayerController && Sessions->GetResolvedConnectString(SessionName, TravelURL))
{
GEngine->AddOnScreenDebugMessage(-1, 10.f, FColor::White, TravelURL);
PlayerController->ClientTravel(TravelURL, ETravelType::TRAVEL_Absolute);
}
}
}
}
The TravelURL is being output as the following, which is my server’s IP address.
192.168.1.129:7777
Does anyone know why it is going to the WRONG map? And why I’m getting the timeout?
Will OpenLevel and ClientTravel work like this? Or do I need to use ServerTravel instead of OpenLevel?
Edit:
I tested this against the NULL subsystem instead of Steam and it all works correctly. The client doesn’t timeout and is put into the correct “Foo” level.
Edit2:
I tried replacing
UGameplayStatics::OpenLevel(GetWorld(), "Foo", true, "listen");
with
GetWorld()->ServerTravel(TEXT("/Game/Maps/Foo?listen"));
But I get the same behavior as before.
Also, I should note that when using Steam I get 9,999 for the PingInMs session property. But when I use NULL I get correct ping results. I’m not sure if this is related.
I am able to ping the server from the client via cmd just fine. (and the other way around)
As well as run a tracert both ways.
Thank you!