#Multipass with Yak & Tugboat always uses Tugboat

13 messages · Page 1 of 1 (latest)

blissful vine
#

My game worked both in single player and multi player mode by always using the default Tugboat transport.

I'm now trying to use multipass with Yak and Tugboat (and will later replace Tugboat with Steamworks).

The idea: If I'm in a single player game or in the level editor, I start the server (all transports) and connect with the Yak client. If I start a multiplayer game, I start the server (all transports) and connect with the Tugboat client (later with the Steamworks one).

However, this doesn't quite work as expected. I run the following code:

// Get Multipass transport
Multipass multipass = Current.FN_TransportManager.GetTransport<Multipass>();

// Start server
Current.FN_NetworkManager.ServerManager.StartConnection();

// Start client
multipass.SetClientTransport<Yak>();
Current.FN_NetworkManager.ClientManager.StartConnection();

What happens now is this (see attachment): At first, everything is fine. Then, the local connection with ID 0 for Yak is stopped, and another connection with ID 1 for Tugboat is started. Oddly enough, this even works (except it doesn't use Yak and I'm back to square one). If I reverse the order of the transports in the Multipass settings to Tugboat/Yak instead of Yak/Tugboat, I'm getting an exception here.

What am I missing?

blissful vine
#

Version is 3.11.7R.Pro, Unity 2021, in case that matters.

winter yarrow
#

Hmm, I don't see you doing anything wrong. I can't seem to replicate it either. The following works fine for me:

using FishNet.Managing.Client;
using FishNet.Managing.Server;
using FishNet.Transporting.Multipass;
using FishNet.Transporting.Tugboat;
using FishNet.Transporting.Yak;
using UnityEngine;

public class MultipassTester : MonoBehaviour
{
    private void Start()
    {
        GetComponent<ServerManager>().StartConnection();
        GetComponent<Multipass>().SetClientTransport<Tugboat>();
        //GetComponent<Multipass>().SetClientTransport<Yak>();
        GetComponent<ClientManager>().StartConnection();
    }
}
#

It works with either transport set as the client transport

blissful vine
#

Interesting... I must be doing something weird then. Maybe the call stacks offer an explanation?

#

Here's the call stack for the first "dodgy" thing to happen (Yak client stopping):

#

And this is the call stack for when the second connection (ID 1) is started:

winter yarrow
blissful vine
#

Oh god

#

Thanks for pointing that out, I went over the call stacks over and over but didn't see my own code in the middle of all the FishNet stuff. I have code that reacts to a new server connection being made in a way that absolutely does not handle the new situation (with multiple transports) the way it should.

#

That solves it, thanks a million!