Default game map is not loaded at client startup

Since version 4.18, the default game map is not loaded when the client starts.

In the DefaultEngine.ini the default map is defined.

[/Script/EngineSettings.GameMapsSettings]
EditorStartupMap=/Game/Maps/D-Design-Env.D-Design-Env
LocalMapOptions=
TransitionMap=None
bUseSplitscreen=True
TwoPlayerSplitscreenLayout=Horizontal
ThreePlayerSplitscreenLayout=FavorTop
bOffsetPlayerGamepadIds=False
GameInstanceClass=/Script/KSGM.KGameInstance
GameDefaultMap=/Game/Maps/M-Entry.M-Entry
ServerDefaultMap=/Game/Maps/M-Entry.M-Entry
GlobalDefaultGameMode=/Script/KSGM.KLobbyGameMode
GlobalDefaultServerGameMode=/Script/KSGM.KMenuGameMode
+GameModeMapPrefixes=(Name="T-",GameMode=/Script/KSGM.KTeamGameMode)
+GameModeMapPrefixes=(Name="L-",GameMode=/Script/KSGM.KLobbyGameMode)
+GameModeMapPrefixes=(Name="R-",GameMode=/Script/KSGM.KTrainingGameMode)
+GameModeMapPrefixes=(Name="M-Entry",GameMode=/Script/KSGM.KMenuGameMode)
+GameModeMapPrefixes=(Name="D-",GameMode=/Game/Characters/Recording/RecordingGameModeBase.RecordingGameModeBase_C)
+GameModeClassAliases=(Name="1VS1",GameMode=/Script/KSGM.KDeathGameMode)
+GameModeClassAliases=(Name="2VS2",GameMode=/Script/KSGM.KDeathGameMode)
+GameModeClassAliases=(Name="1VS1C",GameMode=/Script/KSGM.KDeathCountGameMode)
+GameModeClassAliases=(Name="2VS2C",GameMode=/Script/KSGM.KDeathCountGameMode)
+GameModeClassAliases=(Name="LOBBY",GameMode=/Script/KSGM.KLobbyGameMode)

In previous version, when I launched the client with this command line, the M-Entry was loaded.

start /B KSGMClient.exe 192.168.1.148 -game -id=Iraque#T8V7RX -pass=DEBUG -WINDOWED -ResX=1920 -ResY=1080 -log=ClientIraqueNoPswd.log

But now in 4.18 the GameDefaultMap is not loaded.
Something changed ? Do I have to specify the map on the command line ?

Hmm, cant really remember this one. What level do you get loaded into instead? Also, what does your default map say in UE4? Under project settings you can find the default map. Is that also M-Entry?

Cheers!

That’s the problem. No level is loaded at startup. It is black in the viewport.
The map can be loaded in UE4, no problem.
If I travel to a map and go back, the M-Entry is loaded correctly in the game.
Only at startup, the M-Entry is not loaded as GameDefaultMap.

If you open the project in the editor and go to the project settings, then to Maps & Modes, does it have the correct map to load in there as well?

Yes, exactly as in the DefaultEngine.ini shown above.

In your output log when running the game, does it mention which map it is trying to load or mention any errors when initially loading?

‘LogLoad: LoadMap: xxxxxxxxxxx’ should be somewhere.

Mine looks something like:

[2018.01.19-10.00.00:543][  0]LogInit: Display: Starting Game.
[2018.01.19-10.00.00:554][  0]LogNet: Browse: /Game/PersistentLevel/PersistentLevel?Name=Player
[2018.01.19-10.00.00:561][  0]LogLoadingSplash: Loading begins
[2018.01.19-10.00.00:562][  0]LogLoad: LoadMap: /Game/PersistentLevel/PersistentLevel?Name=Player

Yes I have the line and no error, but the map does not load.

[2018.01.19-14.28.37:483][  0]LogDebug: Verbose: UKGameInstance::StartGameInstance
[2018.01.19-14.28.37:483][  0]LogDebug: Verbose: UKGameInstance::ShowLoadingScreen  -  LoadingScreenCounter=0    Viewport=000001ED4B5229B0
[2018.01.19-14.28.37:483][  0]LogDebug: Verbose: UKGameInstance::ShowLoadingScreen  -  Show the loading screen from the module
[2018.01.19-14.28.37:483][  0]LogLoad: Verbose: FKGameLoadingScreenModule::StartInGameLoadingScreen
[2018.01.19-14.28.37:543][  0]LogDebug: Verbose: UKGameInstance::ShowLoadingScreen  -  Show the loading screen in the Viewport
[2018.01.19-14.28.37:596][  0]LogNet: Browse: 192.168.1.148//Game/Maps/M-Entry?Name=Player
[2018.01.19-14.28.37:596][  0]LogTemp: Display: ParseSettings for GameNetDriver
[2018.01.19-14.28.37:596][  0]LogTemp: Display: ParseSettings for KadeoNetDriver_0
[2018.01.19-14.28.37:596][  0]LogTemp: Display: ParseSettings for PendingNetDriver
[2018.01.19-14.28.37:596][  0]LogInit: WinSock: Socket queue 32768 / 32768
[2018.01.19-14.28.37:598][  0]LogInit: WinSock: I am KadeoDevX (172.20.4.17:0)
[2018.01.19-14.28.37:598][  0]PacketHandlerLog: Loaded PacketHandler component: Engine.EngineHandlerComponentFactory (StatelessConnectHandlerComponent)
[2018.01.19-14.28.37:598][  0]LogNet: Game client on port 7777, rate 10000
[2018.01.19-14.28.37:799][  0]LogLoad: (Engine Initialization) Total time: 2.61 seconds

And if I go to the Training map, when in the client, it is ok.

[2018.01.19-14.28.43:098][294]LogNet: Browse: /Game/Maps/R-Training1?Name=Player?Rank=0
[2018.01.19-14.28.43:098][294]LogDebug: Verbose: UKGameInstance::BeginLevelLoading
[2018.01.19-14.28.43:098][294]LogDebug: Verbose: UKGameInstance::ShowLoadingScreen  -  LoadingScreenCounter=0    Viewport=000001ED4B5229B0
[2018.01.19-14.28.43:098][294]LogDebug: Verbose: UKGameInstance::ShowLoadingScreen  -  Show the loading screen from the module
[2018.01.19-14.28.43:098][294]LogLoad: Verbose: FKGameLoadingScreenModule::StartInGameLoadingScreen
[2018.01.19-14.28.43:147][294]LogDebug: Verbose: UKGameInstance::ShowLoadingScreen  -  Show the loading screen in the Viewport
[2018.01.19-14.28.43:206][294]LogLoad: LoadMap: /Game/Maps/R-Training1?Name=Player?Rank=0
[2018.01.19-14.28.43:721][294]LogLoad: Game class is 'KTrainingGameMode'
[2018.01.19-14.28.43:733][294]LogWorld: Bringing World /Game/Maps/R-Training1.R-Training1 up for play (max tick rate 0) at 2018.01.19-15.28.43

and I can see the acknowledge of map loaded

[2018.01.19-14.28.43:733][294]LogWorld: Bringing World /Game/Maps/R-Training1.R-Training1 up for play (max tick rate 0) at 2018.01.19-15.28.43

And when I come back to the lobby, M-Entry map, it is ok this time.

[2018.01.19-14.28.47:455][481]LogLoad: LoadMap: /Game/Maps/M-Entry?closed?Name=Player?Rank=0
[2018.01.19-14.28.47:455][481]LogDebug: Verbose: AKBaseCharacter::Destroyed  -  Role=ROLE_Authority   IsLocallyControlled=1   Actor=BP_PlayerCharacter_C_0  Controller=KPlayerController_0
[2018.01.19-14.28.47:455][481]LogDebug: Verbose: AKBaseCharacter::UnPossessed  -  Role=ROLE_Authority   IsLocallyControlled=1   Actor=BP_PlayerCharacter_C_0
[2018.01.19-14.28.47:455][481]LogDebug: Verbose: AKPlayerController::SetPawn   Role=ROLE_Authority   IsLocalPlayerController()=1   InPawn=None
[2018.01.19-14.28.47:455][481]LogDebug: Verbose: AKPlayerController::SetPawn   Role=ROLE_Authority   IsLocalPlayerController()=1   InPawn=None
[2018.01.19-14.28.47:455][481]LogGameMode: AKGameMode::Logout
[2018.01.19-14.28.47:455][481]LogOnline: Verbose: AKGameSession::UpdateGameState
[2018.01.19-14.28.47:455][481]LogGameMode: AKGameMode::UpdatePlayersPresence  -  MatchState=LeavingMap
[2018.01.19-14.28.47:455][481]LogGameMode: Verbose: AllowJoin: bWaitingPlayers=1 NumPlayers=0 GameSession->MaxPlayers=1
[2018.01.19-14.28.47:455][481]LogGameMode: Verbose: PC->ClientSetPresence: PC=KPlayerController_0  presence=WAITINGPLAYERMATCH
[2018.01.19-14.28.47:455][481]LogDebug: AKBasePlayerController::ClientSetPresence_Implementation  NewPresenceString=WAITINGPLAYERMATCH
[2018.01.19-14.28.47:455][481]LogOnline: UKLocalPlayer::UpdatePresence NewPresenceString = WAITINGPLAYERMATCH   bAllowInvites = 1  bAllowJoinInProgress = 1  bAllowJoinViaPresence = 1  bAllowJoinViaPresenceFriendsOnly = 0
[2018.01.19-14.28.47:455][481]LogDebug: UKLocalPlayer::UpdatePresence UserId = iraque#t8v7rx is valid
[2018.01.19-14.28.47:455][481]LogDebug: UKLocalPlayer::UpdatePresence GameSettings NOT found
[2018.01.19-14.28.47:455][481]LogDebug: UKLocalPlayer::ShowMenu: Parameters=WAITINGPLAYERMATCH
[2018.01.19-14.28.47:455][481]LogDebug: Verbose: AKPlayerController::SetPawn   Role=ROLE_Authority   IsLocalPlayerController()=1   InPawn=None
[2018.01.19-14.28.47:456][481]LogDebug: Verbose: AKBaseCharacter::UnPossessed  -  Role=ROLE_Authority   IsLocallyControlled=1   Actor=BP_BOT_C_10
[2018.01.19-14.28.47:456][481]LogDebug: Verbose: AKBaseCharacter::UnPossessed  -  Role=ROLE_Authority   IsLocallyControlled=1   Actor=BP_BOT_C_11
[2018.01.19-14.28.47:456][481]LogDebug: Verbose: AKBaseCharacter::UnPossessed  -  Role=ROLE_Authority   IsLocallyControlled=1   Actor=BP_BOT_C_3
[2018.01.19-14.28.47:456][481]LogDebug: Verbose: AKBaseCharacter::UnPossessed  -  Role=ROLE_Authority   IsLocallyControlled=1   Actor=BP_BOT_C_4
[2018.01.19-14.28.47:456][481]LogDebug: Verbose: AKBaseCharacter::UnPossessed  -  Role=ROLE_Authority   IsLocallyControlled=1   Actor=BP_BOT_C_8
[2018.01.19-14.28.47:456][481]LogDebug: Verbose: AKBaseCharacter::UnPossessed  -  Role=ROLE_Authority   IsLocallyControlled=1   Actor=BP_BOT_C_9
[2018.01.19-14.28.47:461][481]LogNet: UChannel::CleanUp: ChIndex == 0. Closing connection. [UChannel] ChIndex: 0, Closing: 0 [UNetConnection] RemoteAddr: 192.168.1.148:7777, Name: None, Driver: PendingNetDriver None, IsServer: NO, PC: NULL, Owner: NULL
[2018.01.19-14.28.47:479][481]LogAIModule: Creating AISystem for world M-Entry
[2018.01.19-14.28.47:479][481]LogLoad: Game class is 'KMenuGameMode'
[2018.01.19-14.28.47:480][481]LogWorld: Bringing World /Game/Maps/M-Entry.M-Entry up for play (max tick rate 0) at 2018.01.19-15.28.47

Something occurred, but only at client startup.

In addition, to my comment below.

[2018.01.19-14.28.37:596][ 0]LogNet: Browse: 192.168.1.148//Game/Maps/M-Entry?Name=Player

It is strange that it include the server ip’s address to the browse map.

Apparently my initial comment has not been published.
To resume:

  1. at client startup
    [2018.01.19-14.28.37:596][ 0]LogNet: Browse: 192.168.1.148//Game/Maps/M-Entry?Name=Player

  2. when in client, go to training map
    [2018.01.19-14.28.43:098][294]LogNet: Browse: /Game/Maps/R-Training1?Name=Player?Rank=0
    [2018.01.19-14.28.43:098][294]LogDebug: Verbose: UKGameInstance::BeginLevelLoading

    [2018.01.19-14.28.43:206][294]LogLoad: LoadMap: /Game/Maps/R-Training1?Name=Player?Rank=0

    [2018.01.19-14.28.43:721][294]LogLoad: Game class is ‘KTrainingGameMode’
    [2018.01.19-14.28.43:733][294]LogWorld: Bringing World /Game/Maps/R-Training1.R-Training1 up for play (max tick rate 0) at 2018.01.19-15.28.43
    [2018.01.19-14.28.43:741][294]LogWorld: Bringing up level for play took: 0.018460

  3. when in training map, leave it to go back to the lobby
    [2018.01.19-14.28.47:341][481]LogNet: Browse: /Game/Maps/M-Entry?closed?Name=Player?Rank=0

    [2018.01.19-14.28.47:480][481]LogWorld: Bringing World /Game/Maps/M-Entry.M-Entry up for play (max tick rate 0) at 2018.01.19-15.28.47

    [2018.01.19-14.28.47:705][481]LogLoad: Took 0.250227 seconds to LoadMap(/Game/Maps/M-Entry)

and the lobby map (M-Entry) is loaded correctly.
Not at client startup

The problem seems to belonging to void UGameInstance::StartGameInstance()

When it starts, the URL contains the Host and it fails to load the map.

	const UGameMapsSettings* GameMapsSettings = GetDefault<UGameMapsSettings>();
	const FString& DefaultMap = GameMapsSettings->GetGameDefaultMap();

	FString PackageName;
	if (!FParse::Token(Tmp, PackageName, 0) || **PackageName == '-')
	{
		PackageName = DefaultMap + GameMapsSettings->LocalMapOptions;
	}

	FURL URL(&DefaultURL, *PackageName, TRAVEL_Partial);
	if (URL.Valid)
	{
		BrowseRet = Engine->Browse(*WorldContext, URL, Error);
	}

LogNet: Browse: 192.168.1.148//Game/Maps/M-Entry?Name=Player
It includes the host in the URL

If I try to load the map in StartGameInstance, the maps load correctly.

void UKGameInstance::StartGameInstance()
{
	UE_LOG(LogDebug, Verbose, TEXT("UKGameInstance::StartGameInstance"));

#if UE_SERVER
	// Load the game objects
	ReadObjectDefinitionFromServer();
#endif

	ShowLoadingScreen();

	Super::StartGameInstance();
	/* @remark: try to fix problem with the default startup map */
	FURL DefaultURL;
	DefaultURL.LoadURLConfig(TEXT("DefaultPlayer"), GGameIni);
	EBrowseReturnVal::Type BrowseRet = EBrowseReturnVal::Failure;
	FString Error;
	FString PackageName;
	FURL URL(&DefaultURL, *PackageName, TRAVEL_Partial);
	if (URL.Valid)
	{
		UEngine* const Engine = GetEngine();
		BrowseRet = Engine->Browse(*WorldContext, URL, Error);
	}
}

I sets the PackageName to empty string and it loads the map.
It should be a bug or something has change in 4.17 or 4.18

I found the problem. The server’s ip address has changed and finally the map wasn’t loaded at startup.
To avoid this kind of problem, I think it is necessary to add logs for this specific error.