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"

Do I have to modify the source to make a custom FOnlineSessionSettings? C++

I want to add extra settings and other stuff to the FOnlineSessionSettings, I know that I can just add them to the Settings array, but I was thinking of making a child class of it and add the new settings there to make it cleaner, but as far as I can tell, there is no option to derive a class from it in the editor, do I have to modify the source to add things there?

Product Version: UE 4.13
Tags:
more ▼

asked Dec 10 '16 at 01:20 PM in C++ Programming

avatar image

aa1000
25 11 11 15

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

1 answer: sort voted first

Depends on what you mean by "source". If you mean, "Do I need to modify the C++ code of the project to make a custom FOnlineSessionSettings?", then the answer is yes. If you mean, "Do I need to download the source engine and modify the c++ code to make a custom FOnlineSessionSettings?", then the answer is no; you can, but not required. You can not customize or create custom session settings in Blueprints alone.

Here is an incomplete block of code I have for customizing only the SessionSettings of my project:

  bool UNWGameInstance::HostSession(TSharedPtr<const FUniqueNetId> UserId, FName SessionName, bool bIsLAN, bool bIsPresence, int32 MaxNumPlayers)
     {
         // Get the Online Subsystem to work with
         IOnlineSubsystem* const OnlineSub = IOnlineSubsystem::Get();
     
         if (OnlineSub)
         {
             //Get the Session Interface so we can call the "CreateSession" function on it
             IOnlineSessionPtr Sessions = OnlineSub->GetSessionInterface();
     
             if (Sessions.IsValid() && UserId.IsValid())
             {
     
                 SessionSettings = MakeShareable(new FOnlineSessionSettings());
     
                 SessionSettings->bIsLANMatch = bIsLAN;
                 SessionSettings->bUsesPresence = bIsPresence;
                 SessionSettings->NumPublicConnections = MaxNumPlayers;
                 SessionSettings->NumPrivateConnections = 0;
                 SessionSettings->bAllowInvites = true;
                 SessionSettings->bAllowJoinInProgress = true;
                 SessionSettings->bShouldAdvertise = true;
                 SessionSettings->bAllowJoinViaPresence = true;
                 SessionSettings->bAllowJoinViaPresenceFriendsOnly = false;
     
                 SessionSettings->Set(SETTING_MAPNAME, FString("MapName"), EOnlineDataAdvertisementType::ViaOnlineService);
     
                 // Set the delegate to the Handle of the SessionInterface
                 OnCreateSessionCompleteDelegateHandle = Sessions->AddOnCreateSessionCompleteDelegate_Handle(OnCreateSessionCompleteDelegate);
     
                 // Our delegate should get called when this is complete
                 return Sessions->CreateSession(*UserId, SessionName, *SessionSettings);
             }
         }
     
         else
         {
             GEngine->AddOnScreenDebugMessage(-1, 20, FColor::Red, TEXT("No OnlineSubsystem found!"));
         }
     
         return false;
     }


You can check out this article for more information.

more ▼

answered Jul 18 '17 at 05:12 PM

avatar image

ENiari Games
66 4 8 12

(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