Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Facepunch MLAPI Transport

Discussion in 'Multiplayer' started by justinwhelan, Nov 7, 2021.

  1. justinwhelan

    justinwhelan

    Joined:
    Aug 3, 2021
    Posts:
    1
    Hi all,

    I'm currently trying to migrate away from SteamP2P transport to Facepunch for MLAPI (0.1.0). It worked fine in SteamP2P, but I'm having problems connecting to a lobby using Facepunch.

    I've verified the lobby is being created, and is accessible. The remote user sees me joining the lobby (callback when member joins log entry) but nothing happens after that, and after approximately 30 seconds I get disconnected. Under SteamP2P, this would have then handed off to MLAPI to move the user into the "lobby" scene.

    The join code is:

    public async Task JoinLobby(Lobby joinedLobby)
    {
    Friend lobbyOwner = joinedLobby.Owner;

    Debug.Log($"[{nameof(SteamManager)}] joining lobby {lobbyOwner.Id}");
    GetComponent<FacepunchTransport>().targetSteamId = lobbyOwner.Id;
    NetworkManager.Singleton.StartClient();

    RoomEnter joinedLobbySuccess = await joinedLobby.Join();
    if (joinedLobbySuccess != RoomEnter.Success)
    {
    Debug.LogError($"[{nameof(SteamManager)}] failed to join lobby {joinedLobby.Id}");
    }
    else
    {
    Debug.Log($"[{nameof(SteamManager)}] successfully joined lobby {lobbyOwner.Id}");
    currentLobby = joinedLobby;
    }
    }

    I recevie teh "successfully joined lobby {id}" log file.

    I also enter the on lobby entered callback, which attempts to:

    private void OnLobbyEnteredCallback(Lobby obj)
    {
    Debug.Log($"[{nameof(SteamManager)}] Entered Lobby " + obj.Id);
    if(!isTutorial)
    {
    Debug.Log($"[{nameof(SteamManager)}] Swapping to Lobby with " + obj.Id);
    NetworkManager.Singleton.SceneManager.LoadScene("Lobby", LoadSceneMode.Single);
    }
    }

    but, 30 seconds later. Gone. Does anyone have an actual implementation guide for Facepunch with MLAPI?

    ta.
     
  2. wirsbo64

    wirsbo64

    Joined:
    Dec 26, 2021
    Posts:
    9
    Sorry to revive an old post, but did you find a solution to this? I have the exact same issue, and there is hardly any documentation to read.

    EDIT: Okay, so it works when I test it on two separate computers with different Steam users. Maybe the problem is caused by connecting to a server with two identical Steam users? How are we supposed to test our game without being able to connect twice from the same computer? Is there any debugging option accessible?
     
    Last edited: Dec 27, 2022
  3. TenShotsOneKill

    TenShotsOneKill

    Joined:
    Dec 13, 2023
    Posts:
    4
    Lobbies usually end after a certain amount of time with no interaction. For Unity's Lobby class, you have to send a heartbeat.