Netcode course clienttravel not actually travelling?

Thank you for the help last time, I was wondering if anyone could spot if I’m doing something wrong here…
image

When attempting to connect to myself near the end of the coop tutorial (JoinSession)

The client successfully finds and “Joins” the server, but seemingly does not load into the server. The server does not see a new client, and the client is stuck in the menu. Any attempt to create a server from said client will then crash the game.

Here is the code for the delegate, where the travel function is called:

void UMultiplayerSessionsSubsystem::OnJoinSessionComplete(FName SessionName, EOnJoinSessionCompleteResult::Type Result)
{

    if(Result == EOnJoinSessionCompleteResult::Success) //not boolean due to multiple failure states
    {
        FString Msg = FString::Printf(TEXT("Successfully joined session %s"), *SessionName.ToString());
        PrintString(Msg);

        FString Address = "";
        bool Success = SessionInterface->GetResolvedConnectString(MySessionName, Address);
        if(Success)
        {
            PrintString(FString::Printf(TEXT("Address: %s"), *Address));
            APlayerController *PlayerController = GetGameInstance()->GetFirstLocalPlayerController();
            if(PlayerController)
            {
                PrintString(FString::Printf(TEXT("Travel to address: %s"), *Address));
                //Travel to the address of the found server
                PlayerController->ClientTravel(Address, ETravelType::TRAVEL_Absolute);//ETravelType cut out for testing
            }
            else
            {
                PrintString("Failed to get player controller");
            }
        }
        else
        {
            PrintString("GetResolvedConnectString returned false");
        }
    }
    else{
        PrintString("OnJoinSessionComplete failed");
    }

}

I’m not seeing any listening ports open from the server, is this normal?

I’m seeing this repeatedly from other students and particularly in Unreal Engine 5.3 which I would hazard a guess that you are using.

Anyway, the client travel doesn’t seem to work well inside the editor anyway and so the best way to run this is from command-line. Also, testing with steam closed is another thing you can try. The code you’ve shared is virtually identical to a project I have that works so not sure why some people see this issue.

Can you confirm the Operating system you use (Windows/MacOs/Linux) and also the exact version of UE.

Lastly, upload the project here if you have no luck https://gdev.tv/projectupload and let me know when you’ve done this. Note the instructions on how to package the entire project - basically remove Binaries, Intermediate and DerivedDataCache folders from your project directory and zip the entire folder.

1 Like

I’m using Unreal 5.2.1 on a gutted windows 10 19042, as higher versions interfere with my tablet drivers.
When I first ran into this issue a few days ago I started making the code as close to the tutorial as I could, to remove any obvious user error.
I ran this as a packaged development kit as both steam and as null, and in both cases it gets stuck on the travel. I sent it to my friend who also suffered the same problem on w11, but as I understood it he could direct connect using windows shortcuts, starting the game as ?listen and joining via direct IP.

I’ll try messing about with it some more and then uploading it to you :slight_smile: Thanks.

1 Like

I have uploaded the project files, I hope I did it correctly :slight_smile:

1 Like

I am so sorry for the delay. However you’re not going to like the answer. This actually worked for me so the project and code are both correct - this happens and could be down to PC configuration. It is very frustrating and tricky to figure out.

It could be how I run it as well. It doesn’t work in the editor (fails to travel) so give up on that right away. Note this isn’t just you - everyone has the same issue.

When I develop the multiplayer part I edit the C++, build in my code editor (Rider - doesn’t matter however, whatever you prefer) and then launch as many instances as I need locally. This enables me to test locally with as many copies as needed. It sort of speeds up the iterations and prevents the cumbersome need of exiting, deleting binaries etc and restarting the editor.

So, open Powershell (I am using Powershell 7.4.1 but any version 4 or greater should be fine) and use a command line similar to this:

& 'D:\Epic Games\UE_5.2\Engine\Binaries\Win64\UnrealEditor.exe' "H:\Unreal\Student Files\cooptestUpload - Alexander Ingvarsson\cooptestUpload\CoopTest.uproject" -Game -WINDOWED -LOG -NOSTEAM -ResX=800 -ResY=600

The & is needed for this. Update the paths to Unreal Engine and also to your project. You can actually add this to a .ps1 file and run that instead, or go old school and use a bat file with slightly different syntax (double quotes and no &)

Give this a try.

Thank you for this, I’ll get right on it when I get back :smiley:

I couldn’t get this to work, but I’ll continue the following course. I’ll see if some of my friends are willing to test it out with me.

Hi, can you tell me how you solved your problem with client to server connection. Because I have the same problem: The server finds, but the level does not load.

I didn’t manage to fix it. It did work between two computers on different networks though.
Other delegates like the button reset custom delegate did work though.
I have a theory that this might be a networking issue rather than a system issue, as I’m working on a shared IP.

Privacy & Terms