EOS-services: no player in found ISession after calling ISessions::FindSessions, but it exists

djchase
Thu, 05 Dec 2024 18:06:58 +0000
Multiplayer & Networking

Hello,

I am trying to get the list of all players in a recently created EOS-session, but the list is empty after searching.
For simplicity, I am only adding the hosting-player to the session first, which I want to use later after calling FindSession

1. Host creates session

TSharedPtr<IOnlineServices> OnlineServices = GetServices(EOnlineServices::Epic);

UE::Online::FCreateSession::Params CreateSessionParams;
CreateSessionParams.SessionName = TEXT("Test");
CreateSessionParams.LocalAccountId = AccountID; // AccountID is set earlier
CreateSessionParams.bPresenceEnabled = true;
CreateSessionParams.bIsLANSession = false;
CreateSessionParams.SessionSettings.SchemaName = TEXT("Test");
CreateSessionParams.SessionSettings.NumMaxConnections = 32;
CreateSessionParams.SessionSettings.JoinPolicy = ESessionJoinPolicy::Public;
CreateSessionParams.SessionSettings.bAllowNewMembers = true;

OnlineServices->GetSessionsInterface()->CreateSession(MoveTemp(CreateSessionParams))
 .OnComplete([OnlineServices,this](const TOnlineResult<FCreateSession>& Result)
     {
         if (Result.IsOk())
         {
             //   2.  Add the local player to the session

             UE_LOG(LogTemp, Log, TEXT("Host discussion successful"));
             UE::Online::FAddSessionMember::Params AddSessionMemberParams;
             AddSessionMemberParams.LocalAccountId = AccountID;
             AddSessionMemberParams.SessionName = TEXT("Test");

             OnlineServices->GetSessionsInterface()->AddSessionMember(MoveTemp(AddSessionMemberParams))
     .OnComplete([this,OnlineServices](const TOnlineResult<FAddSessionMember>& Result)
         {
             if (Result.IsOk())
             {
                     // at this point, I can use OnlineServices->GetSessionsInterface()->GetAllSessions() to
                     // iterate over all local sessions, where a player still exists, but if I use ISessions::FindSessions, the player will be deleted async later, but why ?

More info:

It seems that “FSessionCommon::SessionMembers” is cleared out after calling “ISession::FindSessions”.

Why would “FSessionCommon::SessionMembers” not be persistent ?

For simplicity, I am using only one player and add the host to the created session with ISessions::AddSessionMember.

That call is succeeding, as does “EOS_Sessions_RegisterPlayers” in “FSessionsEOSGS::AddSessionMemberImpl” later.

And I can see that the playercount has been increased in the epic games dev-portal for my application.

So, it seems that the backend has been correctly informed about the added player, but as soon as I try to find the session with ISessions::FindSession, ISession::GetSessionMembers() always returns an empty array.

Any clue what might be wrong? I believe that the client-permissions are correct, but maybe I have missed something.

Thanks

3 posts - 1 participant