x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Cannot find LAN Dedicated Server Session in PIE

So I specify PIE specifically because I am trying to test in the editor and I have set up my Editor Builds to Trigger the Session's RegisterServer Function which Creates the Dedicated Server's session. In Debug Mode I step through the code and all is successful. However when I go to Find Sessions I get no results. I am using the OnlineSubsystemNull currently as my default Subsystem.

My current Session Creation in my GameSession class looks like this:

  void AMyGameSession::RegisterServer()
 {
     IOnlineSubsystem * onlineSub = IOnlineSubsystem::Get();
     if (onlineSub != nullptr)
     {
         IOnlineSessionPtr sessionInt = Online::GetSessionInterface();
         AMyGameModeBase * gameMode = Cast<AMyGameModeBase>(this->GetWorld()->GetAuthGameMode());
         if (sessionInt.IsValid())
         {
             TSharedPtr<class FMyOnlineSessionSettings> gameHostSettings = MakeShareable(new FMyOnlineSessionSettings(true, false, 4));
             gameHostSettings->Set(SETTING_GAMEMODE, FString(*gameMode->GetName()), EOnlineDataAdvertisementType::ViaOnlineService);
             gameHostSettings->Set(SETTING_MAPNAME, GetWorld()->GetMapName(), EOnlineDataAdvertisementType::ViaOnlineService);
             gameHostSettings->Set(SETTING_MATCHING_HOPPER, FString("MyWorldGame"), EOnlineDataAdvertisementType::DontAdvertise);
             gameHostSettings->Set(SETTING_MATCHING_TIMEOUT, 120.0f, EOnlineDataAdvertisementType::ViaOnlineService);
             gameHostSettings->Set(SETTING_SESSION_TEMPLATE_NAME, FString("MyWorldGame"), EOnlineDataAdvertisementType::DontAdvertise);
             gameHostSettings->bUsesPresence = false;
             gameHostSettings->bIsLANMatch = true;
             gameHostSettings->bAllowInvites = true;
             gameHostSettings->bIsDedicated = true;
             gameHostSettings->bShouldAdvertise = true;
             gameHostSettings->bAllowJoinInProgress = true;
             gameHostSettings->bAllowJoinViaPresence = false;
             gameHostSettings->bAllowJoinViaPresenceFriendsOnly = false;
 
             this->hostSettings = gameHostSettings;
 
             this->OnCreateSessionCompleteDelegateHandle = sessionInt->AddOnCreateSessionCompleteDelegate_Handle(this->OnCreateSessionCompleteDelegate);
 
             sessionInt->CreateSession(0, NAME_GameSession, *this->hostSettings);
         }
     }
 }

My Find Session function in my GameInstance looks like this:

 void UMyGameInstance::FindSessions(TSharedPtr<const FUniqueNetId> userId, FName sessionName, bool bIsLan, bool bIsPresence)
 {
     IOnlineSubsystem * onlineSub = IOnlineSubsystem::Get();
     if(onlineSub != nullptr)
     {
         IOnlineSessionPtr sessions = onlineSub->GetSessionInterface();
         if (sessions.IsValid())
         {
             const FString gameMatch("MyGameWorld");
             this->SessionSearch = MakeShareable(new FMyOnlineSearchSettings(bIsLan, bIsPresence));
             this->SessionSearch->bIsLanQuery = bIsLan;
             this->SessionSearch->MaxSearchResults = 20;
             this->SessionSearch->PingBucketSize = 50;
             //this->SessionSearch->QuerySettings.Set(SEARCH_KEYWORDS, gameMatch, EOnlineComparisonOp::Equals);
 
             TSharedRef<FOnlineSessionSearch> searchSettingsRef = this->SessionSearch.ToSharedRef();
 
             this->OnFindSessionsCompleteDelegateHandle = sessions->AddOnFindSessionsCompleteDelegate_Handle(this->OnFindSessionsCompleteDelegate);
             sessions->FindSessions(*userId, searchSettingsRef);
         }
     }
     else
     {
         this->OnFindSessionsComplete(false);
     }
 }

Product Version: UE 4.21
Tags:
more ▼

asked Nov 29 '18 at 08:17 AM in C++ Programming

avatar image

ArcainOne
499 32 25 57

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

So here I am answering my own question again. The Answer to this is straight forward. Inorder to test your dedicated Server and Online Subsystem you must create a built Server and Packaged game. Then you can launch the server (with log preferably for testing) and then launch a client game to test your connection. For details on how to setup a dedicated server follow the link.

[Setup Dedicated Server][1] [1]: https://wiki.unrealengine.com/Dedicated_Server_Guide_(Windows_%26_Linux)

more ▼

answered May 16 '19 at 01:07 AM

avatar image

ArcainOne
499 32 25 57

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question