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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

OSS Steam SessionSearch->SearchResults.Num() == 0

Hi there!

I've got a problem with finding sessions that are created by OSS Steam Creation of the session by hosting player is as shown below:

 if (auto OSS = IOnlineSubsystem::Get("Steam"))
     {
         auto SessionsInterface = OSS->GetSessionInterface();
 
         if (SessionsInterface.IsValid())
         {
             FOnlineSessionSettings set;
             // set.bIsLANMatch(false)          ;
             // set.bIsDedicated(false)         ;
             // set.bUsesStats(false)           ;
             // set.bAntiCheatProtected(false)  ;
             // set.BuildUniqueId(0)            ;
             set.bShouldAdvertise = true;
             set.bAllowJoinViaPresenceFriendsOnly = false;
             set.bAllowJoinViaPresence = true;
             set.NumPrivateConnections = 4;
             set.NumPublicConnections = 4;
             set.bAllowInvites = true;
             set.bUsesPresence = true;
             set.bAllowJoinInProgress = true;
             set.Set(SETTING_MAPNAME, FString(TEXT("")), EOnlineDataAdvertisementType::ViaOnlineService);
             //set.Set(SETTING_CUSTOM, FString("MOJA_Mapa"), EOnlineDataAdvertisementType::ViaOnlineService);
 
             return SessionsInterface->CreateSession(0, SESSION_NAME, set);
         }
     }

After that the OnCreateSessionComplete callback is being fired with bWasSuccessful = true

 void AMyGameSession::OnCreateSessionComplete(FName LookingSessionName, bool bWasSuccessful)
 {
     UE_LOG(MyProjectLog, Log, TEXT("OnCreateSessionComplete SessionName: %s, bWasSuccessful: %d"), *LookingSessionName.ToString(), bWasSuccessful);
 
     if (bWasSuccessful)
     {
         GetWorld()->ServerTravel(TEXT("ThirdPersonExampleMap?listen"), true);
     }
 }

I'm assuming that the whole process of creating the session has run correctly. And when another person is trying to find sessions all callbacks are telling me that everything went right, however SearchResults.Num() is always 0.

 bool AMyGameSession::FindSession(FName SessionName, bool bIsLAN, bool bIsPresence)
 {
     if (auto OSS = IOnlineSubsystem::Get("Steam"))
     {
         auto SessionsInterface = OSS->GetSessionInterface();
         if (SessionsInterface.IsValid())
         {
             SessionSearch = MakeShareable(new FOnlineSessionSearch());
             SessionSearch->MaxSearchResults = 20;
             SessionSearch->PingBucketSize = 9999;
             SessionSearch->bIsLanQuery = bIsLAN;
             SessionSearch->TimeoutInSeconds = 120.0f;
 
             if (bIsPresence)
             {
                 //actually try to find anything
             //    SessionSearch->QuerySettings.Set(SEARCH_PRESENCE, bIsPresence, EOnlineComparisonOp::Equals);
             }
 
             //SessionSearch->QuerySettings.Set(SETTING_CUSTOM, FString("MOJA_Mapa"), EOnlineComparisonOp::Equals);
 
             return SessionsInterface->FindSessions(0, SessionSearch.ToSharedRef());
         }
     }
 
     return false;
 }

 void AMyGameSession::OnFindSessionsComplete(bool bWasSuccessful)
 {
     UE_LOG(MyProjectLog, Log, TEXT("OnFindSessionsComplete bWasSuccessful: %d"), bWasSuccessful);
 
     if (bWasSuccessful)
     {
         if (auto OSS = IOnlineSubsystem::Get("Steam"))
         {
             auto SessionsInterface = OSS->GetSessionInterface();
             if (SessionsInterface.IsValid())
             {
                 UE_LOG(MyProjectLog, Log, TEXT("OnFindSessionsComplete SessionsNum: %d"), SessionSearch->SearchResults.Num());
                 if (SessionSearch->SearchResults.Num() > 0)
                 {
                     UE_LOG(MyProjectLog, Log, TEXT("================= Sessions ==============="));
                     for (int32 SearchIdx = 0; SearchIdx < SessionSearch->SearchResults.Num(); SearchIdx++)
                     {
                         UE_LOG(MyProjectLog, Log, TEXT("Session Number: %d, OwnerName: %s "), SearchIdx + 1, *(SessionSearch->SearchResults[SearchIdx].Session.OwningUserName));
 
                         JoinSession(SessionSearch->SearchResults[SearchIdx]);
                     }
                     UE_LOG(MyProjectLog, Log, TEXT("========================================"));
 
                 }
             }
         }
     }
 }

My question is where I've made something wrong? The config file if someone is wondering if I've set up it correctly:

 [Core.Log]
 LogOnline=Always
 LogNet=Always
 
 [/Script/Engine.GameEngine]
 +NetDriverDefinitions=(DefName="GameNetDriver",DriverClassName="OnlineSubsystemSteam.SteamNetDriver",DriverClassNameFallback="OnlineSubsystemUtils.IpNetDriver")
 
 [OnlineSubsystem]
 DefaultPlatformService=Steam
 
 [OnlineSubsystemSteam]
 bEnabled=true
 SteamDevAppId=<my custom AppId>
 
 [/Script/OnlineSubsystemSteam.SteamNetDriver]
 NetConnectionClassName=OnlineSubsystemSteam.SteamNetConnection

Any help will be appriciated!

Product Version: UE 4.20
Tags:
more ▼

asked Aug 15 '18 at 02:10 PM in C++ Programming

avatar image

ekicam2
56 2 4 7

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

1 answer: sort voted first

Actually code was fine, there was little fuckup with blueprint implementation (missing checkbox).

more ▼

answered Aug 15 '18 at 05:09 PM

avatar image

ekicam2
56 2 4 7

(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