Packaging a multiplayer game fails to load map

Hi all,

I’m currently trying to create a test build of our project, and it’s crashing on launch.

I narrowed down the cause of the crash (verified by removing the logic and the game build running with a blank level - black screen).
It seems that the LoadPackageAsync functionality is crashing in some way.

The project is a simple multiplayer game, with some of the architecture inspired by the ShooterGame example project. As such it has a GameInstance that loads states. In this instance, the initial state during testing (until we have a main menu map) is Playing, with a LoadFrontEndMap call upon BeginPlayingState.This call then results in the following:

[2018.02.27-18.02.02:223][  1]LogOurProjectGeneral: Display: OurProject Game Instance - Entering Begin Playing State, attempting to load MapName map.
[2018.02.27-18.02.02:223][  1]LogNet: Browse: MapName
[2018.02.27-18.02.02:223][  1]LogLoadingSplash: Loading begins
[2018.02.27-18.02.02:298][  1]LogHMD: FSplash::OnShow
[2018.02.27-18.02.02:298][  1]LogLoad: LoadMap: MapName
[2018.02.27-18.02.02:468][  1]LogWindows: Windows GetLastError: The operation completed successfully. (0)
[2018.02.27-18.02.02:704][  1]LogWindows: Error: === Critical error: ===
[2018.02.27-18.02.02:704][  1]LogWindows: Error: 
[2018.02.27-18.02.02:704][  1]LogWindows: Error: Fatal error: [File:D:\Build\++UE4+Release-4.18+Compile\Sync\Engine\Source\Runtime\CoreUObject\Private\Serialization\AsyncLoading.cpp] [Line: 6647] 
[2018.02.27-18.02.02:704][  1]LogWindows: Error: LoadPackageAsync failed to begin to load a package because the supplied package name was neither a valid long package name nor a filename of a map within a content folder: ''
[2018.02.27-18.02.02:704][  1]LogWindows: Error: 
[2018.02.27-18.02.02:704][  1]LogWindows: Error: 
[2018.02.27-18.02.02:704][  1]LogWindows: Error: [Callstack] 0x000000001B184008 UnknownFunction []
[2018.02.27-18.02.02:704][  1]LogWindows: Error: [Callstack] 0x00000000C90E2000 UnknownFunction []
[2018.02.27-18.02.02:704][  1]LogWindows: Error: [Callstack] 0x0000000000000400 UnknownFunction []
[2018.02.27-18.02.02:704][  1]LogWindows: Error: [Callstack] 0x0000000016ACB260 UnknownFunction []
[2018.02.27-18.02.02:704][  1]LogWindows: Error: [Callstack] 0x0000000070B6B448 UnknownFunction []
[2018.02.27-18.02.02:704][  1]LogWindows: Error: [Callstack] 0x0000000000000001 UnknownFunction []
[2018.02.27-18.02.02:704][  1]LogWindows: Error: [Callstack] 0x0000000000000001 UnknownFunction []
[2018.02.27-18.02.02:704][  1]LogWindows: Error: 
[2018.02.27-18.02.02:715][  1]LogExit: Executing StaticShutdownAfterError
[2018.02.27-18.02.02:717][  1]LogWindows: FPlatformMisc::RequestExit(1)

The map is located in the following folder: Content/OurProjectName/Maps/MapName/Map.umap

I have also verified that when removing the call to the LoadFrontEndMap function, and just simply loading into the blank map and typing ‘open MapName’ opens the map as expected.

Can anyone explain to me why the packaged build fails to load the map correctly?

Are you obfuscating the names with generic ones to hide details of your project or are you really naming things OurProject and MapName?

Obfuscating for non-disclosure reasons. The names themselves are standard characters, map name contains the an underscore, but that’s very normal in my experience.

OK. Just making sure because using generic names can cause issues due to naming conflicts (UE4 doesn’t disallow them for some reason).

The reason it’s failing is FPackageName::ParseExportTextPath() is returning false. That means it couldn’t parse the input path to the package. The error says the input path is an zero-length string. Beyond that it’s hard to tell. Maybe with more disclosure I’d have a better idea.

If that’s not possible (and it sounds like it isn’t) then I suggest you try and figure out why the input path is invalid. I’d check what’s being used with the LoadFrontEndMap call.

You could build a package for Debug, run the packaged game in the debugger, and look at the input path (and call stack) when it fails. There might be a thread there to pull on.

Hi Jin_VE,

I’ve taken a look at this over the past few days. I’ve exposed the string out to both config game and blueprint for the game instance. In both cases the game’s map is being successfully detected from the string (for example the full path “/Game/ProjName/Maps/MapFolder/MapName”). It breaks that down to MapName during the loading. Here: LogDuringMapLoad - Pastebin.com

In the crash window, the call stack is the following:

PROJECTNAME!FDebug::AssertFailed()
PROJECTNAME!LoadPackageAsync()
PROJECTNAME!LoadPackageInternal()
PROJECTNAME!LoadPackage()
PROJECTNAME!UEngine::LoadMap()
PROJECTNAME!UEngine::Browse()
PROJECTNAME!UPROJECTNAMEGameInstance::LoadFrontEndMap() [c:\PROJECTNAME\source\PROJECTNAME\gameinstance\PROJECTNAME_gameinstance.cpp:467]

I’ve just found and replaced all appearances of our project name with PROJECTNAME for obscuring. The project name is “ProjectBLARG” where BLARG is a standard word. As for the map name, it’s simply “MAP_main” where MAP is the name of the map, all standard alphabetical characters.

Are you sure that the map is being cooked into the package? How are you packaging this? And you’re trying to run the client, or the server? Also, can you show me what string the shooter sample is using in the call to LoadFrontEndMap?

The map is definitely being cooked into the package as I can open the command console (tilde key) and type “open MAPNAME” and it opens without a problem. I’m packaging it by adding it to the map listings under the packaging settings. The game is attempting to run in Offline mode (as done in the BeginMainMenu function of shooter game) and then loading the map. Theoretically this should just run the map, unless I specifically need something like ?listen at the end of the URL.
As for the string shootergame is using, it’s the following (taken from the config game file):

[/Script/ShooterGame.ShooterGameInstance]
WelcomeScreenMap=/Game/Maps/ShooterEntry
MainMenuMap=/Game/Maps/ShooterEntry

Oh right. Sorry. Well, the main difference I see is that the shooter project is loading some kind of pre-level that (I assume) will eventually load the main level. Maybe the problem is that you are trying to load the main level in that manner. Why can’t you just load the level the regular way?

By the regular way do you mean via level streaming? If so, I don’t believe I can call “UGameplayStatics::LoadStreamLevel()” as the initial world that loads doesn’t contain the map (I believe it works off the levels window, and it’s not a streamed level in the empty map that loads by default). Obviously the way to do this normally is set the default map in the project settings, however, this doesn’t work either currently.

It looks like you can use UGameplayStatics::OpenLevel(). But that just means you have one level that loads another. So you still need to have some default map for it to load first.

If you click the down-arrow in (Maps & Modes)->(Default Maps) you’ll see a “Server Default Map”. Did you set that one too?

I could try out the UGameplayStatics function, I believe the map that is opening up currently is just the editor blank level, so could be possible to call the open level function in the Game Instance
As for the default map, it is set too, the only one I haven’t set is the transition map, but not sure if it really needs to be set for any of this to work.