Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

[UWP] MultiplayerManager Issues

Discussion in 'Windows' started by MagicDesignStudios, Jan 4, 2019.

  1. MagicDesignStudios

    MagicDesignStudios

    Joined:
    Dec 22, 2016
    Posts:
    37
    Hello, we are we are developing a game on Unity and we have some question about the Windows 10 (UWP) version of the game.

    For the online session we are using the multiplayerManager API,and I want to create a single lobby session. But we always have this error when we try to add local user " UserAdded error message : error code : -2145844845" and we don't understand what was going on. I just call "AddLocalUser" when the user go to online mode, the multiplayerManager is already init, but when I handle the DoWork event we have this error. So the xboxUser is never add to the lobby sessions, the lobby sessions members list is always empty.


    There’s some points I don't understand with the connection address, the doc recommends to set the local member's connection address but I don't know were I can find this. For the moment we try to find the connection address in XboxLiveDeviceAddress but nothing is working.


    We have other issues with the friend invitation, when we call the TitleCallableUI.ShowGameInviteUIAsync(...) the invite windows open correctly but never find any friend, my account is set on the correct sandbox, the only thing displayed on the windows is an error message "Someting went wrong when loading this section. " Have you already encountered this issue ? Do you have any advice ?


    We try to implement the protocol activation events in unity, (Windows.ApplicationModel.Activation.IProtocolActivatedEventArgs) We would like to use this event to detect when the game is launched after accepting an online invitation or after an invitation while already being in the game. Do you know where we can catch this event?

    We would like to know, is there a multiplayer event type to handle when the player validate an online invitation ? The only event we have found for that is "JoinLobbyComplete" but we find nothing with invitation...
     
  2. MagicDesignStudios

    MagicDesignStudios

    Joined:
    Dec 22, 2016
    Posts:
    37
    Hello ,

    We have followed the Microsoft documentation and sample for UWP multiplayer manager, and we don’t understand why the lobby sessions is not successfully created, or user is not add to the sessions.

    We initialize the multiplayer manager when we acces to the online menu, and right after we add local user to the lobby sessions. We also tried to move the multiplayer init at the start of the game.

    This is how we create and init all of this sessions :


    Code (CSharp):
    1. private void AuthenticateAndConnect()
    2.     {
    3.  
    4.         if (!TitleCallableUI.CheckGamingPrivilegeSilently(GamingPrivilege.MultiplayerSessions))
    5.         {
    6.  
    7.             OnAuthFinished(ConnectResult.FAILURE_TRY_AGAIN);
    8.            return;
    9.  
    10.         }
    11.  
    12.         multiplayerManager.Initialize(sessionTemplateName);
    13.  
    14.         //this create lobby when add local user
    15.  
    16.         if (!userAddInSession)
    17.  
    18.         {
    19.  
    20.             AddUserToLobbySession();
    21.         }
    22.     }


    Code (CSharp):
    1. public void AddUserToLobbySession()
    2.     {
    3.         if (xboxUser != null && xboxUser.IsSignedIn && multiplayerManager != null)
    4.        {
    5.  
    6.             multiplayerManager.LobbySession.AddLocalUser(xboxUser);
    7.             //Set connection adresse (try)
    8.  
    9.             multiplayerManager.LobbySession.SetLocalMemberConnectionAddress(xboxUser,    Windows.Networking.XboxLive.XboxLiveDeviceAddress.GetLocal().GetSnapshotAsBase64().ToString(), xboxLiveContext);
    10.  
    11.             userAddInSession = true;
    12.  
    13.         }
    14.         HandleMultiplayerManagerEvent();
    15.     }
    Every time we try to add user to lobby session the multiplayerEvent caught whit DoWork() return an error code, “error event type : UserAdded error message : error code : -2145844844” and “error event type : JoinLobbyCompleted error message : error code : -2145844844” but we don’t know what this error code means or where we can find its meaning.

    We join to this post the Lobby sessions template and the game sessions template, do you see any problem ? And we join the Windows app manifest, do you see something wrong on it ?
    Code (CSharp):
    1.   <Applications>
    2.     <Application Id="Secret" Executable="$targetnametoken$.exe" EntryPoint="Secret.App">
    3.       <uap:VisualElements DisplayName="Secret" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="Unruly heroes" BackgroundColor="transparent">
    4.         <uap:DefaultTile ShortName="MonkeyKing" Wide310x150Logo="Assets\Wide310x150Logo.png">
    5.         </uap:DefaultTile>
    6.         <uap:SplashScreen Image="Assets\SplashScreen.png" BackgroundColor="#222C37" />
    7.         <uap:InitialRotationPreference>
    8.           <uap:Rotation Preference="portrait" />
    9.           <uap:Rotation Preference="landscape" />
    10.           <uap:Rotation Preference="portraitFlipped" />
    11.           <uap:Rotation Preference="landscapeFlipped" />
    12.         </uap:InitialRotationPreference>
    13.       </uap:VisualElements>
    14.       <Extensions>
    15.         <uap:Extension Category="windows.protocol">
    16.           <uap:Protocol Name="ms-xbl-multiplayer" />
    17.         </uap:Extension>
    18.       </Extensions>
    19.     </Application>
    20.   </Applications>
    21.   <Capabilities>
    22.     <Capability Name="internetClient" />
    23.     <uap:Capability Name="removableStorage" />
    24.   </Capabilities>
    25. </Package>
     

    Attached Files:

  3. zombie177

    zombie177

    Joined:
    Dec 1, 2013
    Posts:
    2
    Hi,

    We faced the same problem. Have you solved this issue?
     
  4. Xibbler

    Xibbler

    Joined:
    Jun 3, 2020
    Posts:
    1
    Same problem here.
    I can call LobbySession.AddLocalUser, and I even get a MultiplayerEventType.UserAdded event on DoWork(). But the session is empty. And if I call LobbySession.InviteFriends(...) I get this error message
    "
    Exception: Catastrophic failure

    Call add_local_user() and wait for user_added completion event before sending invites.
    "