[4.8.1] Cannot connect client to editor server with commandline specifying IP

Just upgraded to 4.8.1, building our own engine binaries.

Repro Steps:

  1. Launch a server: start .\engine\Engine\Binaries\Win64\UE4Editor.exe D:\p4\trunk\qc\QC.uproject -server -log
  2. Launch a client to connect to it: start .\engine\Engine\Binaries\Win64\UE4Editor.exe D:\p4\trunk\qc\QC.uproject 127.0.0.1 -game
  3. Observe error when client starts up: “The map specified on the commandline … could not be found”
  4. Was also able to repro by launching a standalone dedicated server from the editor with 2 clients.

Digging into the code, it looks like UGameInstance::StartGameInstance is panicking, Engine->Browse returns EBrowseReturnVal::Pending, presumably because this is a network connection. The rest of the function then assumes this a fatal error and exits out. I temporarily fixed it by simply leaving the function without fuss when we get a pending state, but I have no idea what the correct solution is.

Relevant Epic CL#2584764

Hi Stefan, I had the exact same problem

Try this workaround that I did for my game:

void UAbatronGameInstance::StartGameInstance()
{
	GotoInitialState();
	
	
	//The below extracts to see if we are trying to run an localhost connection or not for dev testing
	UEngine* const Engine = GetEngine();

	// Create default URL.
	// @note: if we change how we determine the valid start up map update LaunchEngineLoop's GetStartupMap()
	FURL DefaultURL;
	DefaultURL.LoadURLConfig(TEXT("DefaultPlayer"), GGameIni);

	// Enter initial world.
	EBrowseReturnVal::Type BrowseRet = EBrowseReturnVal::Failure;
	FString Error;
	TCHAR Parm[4096] = TEXT("");
	const TCHAR* Tmp = FCommandLine::Get();

#if UE_BUILD_SHIPPING
	// In shipping don't allow an override
	Tmp = TEXT("");
#endif // UE_BUILD_SHIPPING
	
	if (!FParse::Token(Tmp, Parm, ARRAY_COUNT(Parm), 0) || Parm[0] == '-')
	{
		//FCString::Strcpy(Parm, *(DefaultMap + GameMapsSettings->LocalMapOptions));
	}
	
	FURL URL(&DefaultURL, Parm, TRAVEL_Partial);
	//Internal means local host 127.0.0.1 =)
	if (URL.Valid && URL.IsInternal())
	{
		BrowseRet = Engine->Browse(*WorldContext, URL, Error);
	}
	else
	{
		//This needs to run to startup commandline maps
		Super::StartGameInstance();
	}

		
}

The real problem is that the Pending state is not handled correctly. Currently you can’t link to 'UGameSettings" to completely override the base class.

Above is my fix to still use the launcher version of the game. If you want to modify the engine for a better fix: Then just add into the base class:

if (BrowseRet == EBrowseReturnVal::Pending)
{
return;
 }

Insert before the Success check. This works aswell. I would like Epic to eventually un privatize access to the UGameSettings =)

Hi guys, i’m having the same problem with a blueprint project. - no experience with coding here, is there a simple way to fix this issue?

Run the game without the ip in the command line, then connect manually after it launches:
open ipaddress

Thanks for the report, this has now been fixed: https://github.com/EpicGames/UnrealEngine/commit/8e682dec4de11106b5002ca0176b834bc009c925

I am seeing the exact same problem with our game. This worked in 4.7.5.