question

Kjartan Emilsson avatar image
Kjartan Emilsson asked

Problem creating session with Playfab in Unreal 5

I have been trying to integrate Playfab Party into Unreal 5 using the plugins available on Github (Playfab marketplace plugin and Online Subsystem Flayfab Party and Multiplayer). I manage to get connection to Playfab using my Steam credentials but when I do a CreateSession, I get the following sequence of events

LogOnline: PLAYFAB: FOnlineSubsystemPlayFab::CreateAndConnectToPlayFabPartyNetwork()
LogOnline: Verbose: PLAYFAB: FOnlineSubsystemPlayFab::OnCreateNewNetworkCompleted
LogOnline: Verbose: PLAYFAB: CreateNewNetworkCompleted: SUCCESS
LogOnline: Verbose: PLAYFAB: CreateNewNetworkCompleted: EntityId: C8A4A465B6977161
LogOnline: Verbose: PLAYFAB: FOnlineSubsystemPlayFab::OnConnectToNetworkCompleted
LogOnline: Verbose: PLAYFAB: ConnectToNetworkCompleted: SUCCESS
LogOnline: Verbose: PLAYFAB: FOnlineSubsystemPlayFab::OnAuthenticateLocalUserCompleted
LogOnline: Verbose: PLAYFAB: FOnlineSubsystemPlayFab::OnNetworkConfigurationMadeAvailable
LogOnline: Verbose: PLAYFAB: FOnlineSubsystemPlayFab::OnEndpointCreated
LogSockets: Warning: Unable to load SocketSubsystem module PlayFabSockets
LogOnline: PLAYFAB: FOnlineSubsystemPlayFab::LeaveNetwork()
LogNet: Warning: FOnlineSubsystemPlayFab::OnEndpointCreate: Created Party Endpoint: 5
LogOnline: Verbose: PLAYFAB: FOnlineSubsystemPlayFab::OnCreateEndpointCompleted
LogOnline: Verbose: PLAYFAB: FOnlineSubsystemPlayFab::OnInvitationCreated
LogOnline: Verbose: PLAYFAB: FOnlineSubsystemPlayFab::OnEndpointDestroyed
LogOnline: Verbose: PLAYFAB: FOnlineSubsystemPlayFab::OnEndpointDestroyed: Destroying endpoint 5 with reason code 0
LogSockets: Warning: Unable to load SocketSubsystem module PlayFabSockets
LogOnline: Verbose: PLAYFAB: FOnlineSubsystemPlayFab::OnInvitationDestroyed
LogOnline: Verbose: PLAYFAB: FOnlineSubsystemPlayFab::OnLocalUserRemoved
LogOnline: Verbose: PLAYFAB: FOnlineSubsystemPlayFab::OnNetworkDestroyed
LogOnline: Warning: PLAYFAB: FOnlineSubsystemPlayFab::OnNetworkDestroyed: PlayFab Party network was destroyed with reason code 0
LogSockets: Warning: Unable to load SocketSubsystem module PlayFabSockets
LogOnline: Verbose: PLAYFAB: FOnlineSubsystemPlayFab::OnLeaveNetworkCompleted

Any idea what is failing here?

unreal
5 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Kjartan Emilsson avatar image Kjartan Emilsson commented ·

Obviously some problems with the SocketSubsystem, but I can't find what is the problem here.

0 Likes 0 ·
Gosen Gao avatar image Gosen Gao Kjartan Emilsson commented ·

I will dig into it.

0 Likes 0 ·
Eric avatar image Eric Gosen Gao commented ·

Any progress on this? I have the same issue using 4.27. I have steam OSS set as native platform service and playfab as default platform service. After logging into playfab using steam credentials, and attempting to create a session, I get the same error above where it fails to load PlayFabSockets module.

0 Likes 0 ·
Show more comments
Greggory Addison avatar image Greggory Addison Kjartan Emilsson commented ·

Hey! Are you using the Lyra Starter Game or the CommonUser Plugin? If so I found a pretty annoying bug in the way the code is playing out. For me it was destroying my session after a player logged in, but in my system I have the player create a lobby with themselves as the owner. So I would successfully start a party and then it was already queued to be destroyed. I need to find a solution to avoid this. Not even sure I need the commonuser plugin to be honest since I'm creating my own plugin for this type of stuff

0 Likes 0 ·

1 Answer

·
Greggory Addison avatar image
Greggory Addison answered

Running into the same issue as the OP. Glad to know i'm not alone thought I was doing something wrong.

I got the session to create successfully by removing PLAYFAB_SOCKET_SUBSYSTEM from this function but the session still destroys and I get the "Unable to load SocketSubsystem module playfab" warning in my logs

void FOnlineSessionPlayFab::OnCreatePartyEndpoint(bool bSuccess, uint16 EndpointID, bool bIsHosting)
{
   if (OSSPlayFab)
   {
      OSSPlayFab->ClearOnPartyEndpointCreatedDelegates(this);
   }

   if (bIsHosting)
   {
      //PLAYFAB_SOCKET_SUBSYSTEM
      ISocketSubsystem* PlayFabSocketSubsystem = ISocketSubsystem::Get();
      if (bSuccess && OSSPlayFab && PlayFabSocketSubsystem)
      {
         UE_LOG_ONLINE_SESSION(Verbose, TEXT("SocketSubsystem: %s"), *PlayFabSocketSubsystem->GetSocketAPIName());
         bool BindAll = false;
         TSharedRef<FInternetAddr> LocalIp = PlayFabSocketSubsystem->GetLocalHostAddr(*GLog, BindAll);
         if (LocalIp->IsValid())
         {
            FString NetworkIdStr = OSSPlayFab->NetworkId;
            FString NetworkDescriptorStr = OSSPlayFab->SerializeNetworkDescriptor(OSSPlayFab->NetworkDescriptor);
            FString HostConnectInfo = LocalIp->ToString(false);

            PendingCreateSessionInfo.SessionSettings.Set(SETTING_NETWORK_ID, NetworkIdStr, EOnlineDataAdvertisementType::ViaOnlineService);
            PendingCreateSessionInfo.SessionSettings.Set(SETTING_NETWORK_DESCRIPTOR, NetworkDescriptorStr, EOnlineDataAdvertisementType::ViaOnlineService);
            PendingCreateSessionInfo.SessionSettings.Set(SETTING_HOST_CONNECT_INFO, HostConnectInfo, EOnlineDataAdvertisementType::ViaOnlineService);

            PendingCreateSessionInfo.SessionSettings.bIsDedicated = IsRunningDedicatedServer();
         }
         else
         {
            UE_LOG_ONLINE_SESSION(Verbose, TEXT("FOnlineSessionPlayFab::OnCreatePartyEndpoint: LocalHostAddr was invalid"));
         }

         if (!(InternalCreateSession(*PendingCreateSessionInfo.PlayerId, PendingCreateSessionInfo.SessionName, PendingCreateSessionInfo.SessionSettings)))
         {
            OnCreateSessionCompleted(PendingCreateSessionInfo.SessionName, false);
         }
      }
      else
      {
         OnCreateSessionCompleted(PendingCreateSessionInfo.SessionName, false);
      }
   }
}

1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Greggory Addison avatar image Greggory Addison commented ·

Commenting out this code in the Init function inside the OnlineSubsystemPlayFab.cpp file got rid of the error where the socket was not getting created

// TSharedPtr<IPlugin> SocketsPlugin = IPluginManager::Get().FindPlugin(TEXT("PlayFab"));
// if (!SocketsPlugin.IsValid() || (SocketsPlugin.IsValid() && !SocketsPlugin->IsEnabled()))
// {
   UE_LOG_ONLINE(Log, TEXT("Initializing PlayFabPartSocketSubsystem"));
   CreatePlayFabSocketSubsystem();
//}
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.