Download

Getting an "Out of Control" behaviour on OpenLevel( ).

Hello.

This is strange, looks like the engine is doing things I’m not telling it to do on use the OpenLevel( ) method Node…

Here is the issue:

  1. I have a MainMenu level with a button that loads another level:

0902302dbda31bc42e7f3b83b8d5bc5063931e21.jpeg

  1. The trouble is on click the button and trigger the OpenLevel, so the game is sent to an “Outacontrol” state where it’s not respecting any from my GameMode defaults, create some UI elements I don’t want…

LimboFrame.jpg

  1. Just after some seconds on this state it gives back control to my code, and fires the Level Blueprint’s BeginPlay Event.

Finally.jpg

I suppose the engine should not make these things, have default UI elements shown without order, ignore the camera pointed on the PlayerController class…

Could someone please tell me how to avoid these things?

Thanks

hi… game looks nice! love that menu & UI

I’d start by taking out the delay, see if loading the level still lingers & if it does, use a Loading Screen with a loading animation in UMG.
if this works to some degree calculate the time it takes to actually load the level & get control back and make the loading screen stay up for that period of time.
(at this time, I don’t believe there is anything in the game engine that will return when you have successfully loaded a level)

@ayretek Thanks by the answer, let me try to expose better the catch22… :smiley:

The delay is just there to assure that a loading image will be drawn before the Draw being stuck by the OpenLevel Method (Hourences’ Hack to simulate loading screen).

Additional Troubles:

  • Looks like the HUD class/instance is destroyed between level loads, I’ve checked this by wiring the EndPlay event on my HUD Class.
  • I did my UI implementation based on what I’ve learnt on UDK-Scaleform holding the widgets references on the HUD class, so, everything but the cursor Widget is being “recreated”.
  • On the LimboFrame there is no HUD instance created or it should show the Combat Idol at the bottom of the screen.
  • But… Looks like the engine holds some hud drawing capabilities somewhere (that “undesired” waiting sign on the LimboFrame is being hold somewhere).
  • About the camera, it should NOT ignore the CameraManager class pointed on the Controller Class, the trouble is that I have not knowledge about any higher priority event than Level BeginPlay to wire a camera setup, if I try Reinforce the CameraSetup on PlayerController::PostInitializeComponents or Constructor it’s shooting a Net error (C++).

Really lost on this. LOL

Trying to solve… What “DOESN’T” works to avoid the start as spectator:

A) Trying to specify the GameMode on the Options from the OpenLevel Node.
B) Entering the GlobalModes on the DefaultGame.ini

Some theories to a workaround (not tested yet)
Noticed that GameModes has a boolean to force all players to start as spectators.
Noticed that GameModes Blueprints has a field to point spectator pawn class.

New Problems…

Began to try implementing the SeamlessLevelTravel to see if I could get a better behaviour changing the map change method, pretty simple by now, just a direct call to UWorld::SeamlessTravel( ).

  1. UMG still crashes on that assert from OnMouseMove( ) with !GIsRoutingPostLoad, the map change completed on some tries “ONLY IF” I don’t move the mouse while changing the map.
  2. I’m overriding the AudioListener from player controller to use the pawn position, but, if I do this on Pawn possession or pawn BeginPlay it’s crashing the maptravel.

Here is the crash log from the UMG OnMouseMove( ), I bet the mousemove causing the trouble is the one that is handling the “Mouse Cursor Widget”, thinking a bit, is sort of weird keep this assertion crashing any MouseMoves( ) after implement a feature that does use UMG to handle the cursor on the games.



MachineId:04F45E86465454A74BAA4D8A13996386
EpicAccountId:62bdf974692e427cbf3d0467a433985d

Unknown exception - code 00000001 (first/second chance not available)

Assertion failed: !GIsRoutingPostLoad [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.7\Engine\Source\Runtime\CoreUObject\Private\UObje

KERNELBASE + 109229 bytes
UE4Editor_Core!FOutputDeviceWindowsError::Serialize() + 292 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\core\private\windows\windowsplatformoutputdevices.cpp:95]
UE4Editor_Core!FOutputDevice::Logf__VA() + 248 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\core\private\misc\outputdevice.cpp:144]
UE4Editor_Core!FDebug::AssertFailed() + 1079 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\core\private\misc\outputdevice.cpp:224]
UE4Editor_CoreUObject!UObject::ProcessEvent() + 381 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:799]
UE4Editor_UMG!UUserWidget::OnMouseLeave() + 223 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\intermediate\build\win64\inc\umg\umg.generated.cpp:975]
UE4Editor_Slate!FSlateApplication::ProcessMouseMoveEvent() + 1911 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\slate\private\framework\application\slateapplication.cpp:4277]
UE4Editor_Slate!FSlateApplication::SynthesizeMouseMove() + 337 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\slate\private\framework\application\slateapplication.cpp:3019]
UE4Editor_Slate!FSlateApplication::Tick() + 2065 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\slate\private\framework\application\slateapplication.cpp:1277]
UE4Editor_MoviePlayer!FSlateLoadingSynchronizationMechanism::SlateThreadRunMainLoop() + 222 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\movieplayer\private\movieplayerthreading.cpp:132]
UE4Editor_MoviePlayer!FSlateLoadingThreadTask::Run() + 84 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\movieplayer\private\movieplayerthreading.cpp:163]
UE4Editor_Core!FRunnableThreadWin::Run() + 102 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\core\private\windows\windowsrunnablethread.cpp:73]
UE4Editor_Core!FRunnableThreadWin::GuardedRun() + 93 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.7\engine\source\runtime\core\private\windows\windowsrunnablethread.cpp:26]
kernel32 + 88525 bytes
ntdll + 178321 bytes


Killing “almost ALL” my widgets and hud before perform a seamless travel looks like gives the best result…
BUT since my mouse pointer is a widget, a click on the screen while loading a map crashes the engine: REPORTED HERE.

Got a nice idea to a loading message while the player waits:
“Please don’t click the screen or the game will crash!”

Will be a success! :smiley:

Ona bad new, but also a good one…

Changed the level loading to SeamlessTravel, after “UNPLUG” the Cursor Widget (ShowCursor=false and CursorType::None on PlayerController) before travelling it doesn’t crashes anymore…

f9484733b81a080094c50b0e6a83dba49908c9ce.jpeg

My only troubles are:

  • I’m going to a random place on Level (maybe the previous PC position) before get spawned on the right PlayerStart.
  • The Alien loading sign still appearing. :frowning:

Any tips or advice?

Great…

This chunk of code (just copied from HandleSeamlessTravelPlayer( )) generates the camera bug:



NumPlayers++;
NumTravellingPlayers--;			
PC->bPlayerIsWaiting = false;
PC->ChangeState(NAME_Spectating);
PC->ClientGotoState(NAME_Spectating);


No matter what I do (changing the parameters to NAME_Playing or setting bPlayerIsWaiting to false per example) could change the weird behaviour and unfortunatelly is not something I can simple delete/comment.

Any tips?

Thanks

Lol

SOLVED!

Finally got the game to work as I wanted, overriding the PostSeamlessTravel to stop using UT logic (waiting for start match and things alike), I think that this method will also be a nice entry point to reload the character save (instead of the default restarting of the PlayerState).

Got a question but better post it on the C++ area.

Thanks.