How to debug crashes?

So I’ve created my game project but it seems to be crashing a lot and I’m not sure how to figure out what the cause is. The game is built entirely out of blueprints and it doesn’t seem like it’s very intensive but something in my script is causing the problem. How does one go about figuring out why the game is crashing? It just hard locks and I have to shut it down in the task manager.

Most basic things you can do is check the logs after crash in /Saved/Logs in you project directory, UE4 if it was controlled crash (assert fail for example, engine has assertion check expection of specific state, if it’s false engine will crash it self as it can’t ensure stability) it will leave crash log with reason of crash, it should also leave stack trace (list of functions what function called what function) you might figure what caused crash just by look of it. In case of assert fail you will give a condition that failed in C++ code, and where that happened (file + line number) you need to search engine code and search for check() function with that condition and figure why it is false. If it was not controllable crash, cause for example by tring to call function on not existing object or any CPU level error, OS will stop execution without question and you will have cutter log that suddenly stop, because engine could not do anything, those crashes are harder to debug, thats why it has this assertion checks mentioned above.

Other solution is code debuging, you run UE4 in debugger in Visual Studio and when crash happens it will halt the code execution nad VS will tell you where crash happened and give you stack trace and you can also probe memoery for varable states. This debugging works on any crash, when OS will detect issue and halt the application, you can also put break points in the code and deugger will stop at that program point like it crash but you can resume.

But as you not doing C++ this might be hard to do, so mostly what you can do is check the log, look above in log there might be some hints what went wrong, if this won’t help try to reproduce the crash so you know when it happens, the you can raport it us a bug with step by step instruction how to reproduce it and Epic or someone else can look at it, even if it’s assert fail since it should not happen so submit also your log too. There no solution for random crashes sadly without proper code debugging, which will be hard wither way if you don’t know when crash happens.

Thanks for the detailed response. So I looked at the latest log file and couldn’t see anything out of the ordinary. I deleted the log folder and I’m going to play the game until it crashes again so it will generate a new one.
It seems to be crashing when I kill one of my NPCs but sadly with this game you’re killing NPCs every few seconds. I am using some experimental AI functionality so that could be the problem.
I’ll check the new log files when they’re created and see where I can go from there.

Ok it’s definitely my NPC.
Opened the crash log and the first warning at the top of the log right after it says “LoadMap” reads

[2017.02.22-07.16.29:785][243]LogCharacterMovement:Warning: GetSimulationTimeStep() - Max iterations 8 hit while remaining time 0.096552 > MaxSimulationTimeStep (0.050) for 'BP_NPC_Master11', movement 'Walking'

Which is my NPC blueprint.

Then right below that I’ve got 26 warnings that all read

[2017.02.22-07.16.30:372][275]LogScriptCore:Warning: [2017.02.22-07.16.30:372][275]LogScriptCore:Warning: Script Msg: Attempted to access index 0 from array LastSensedStimuli of length 0! [2017.02.

Which is the experimental AI… wonder if this is fixed in the latest version?
It seems to be saying that the LastSensedStimuli array isn’t actually an array. I was following a tutorial that Epic Live Streamed. I wonder if I followed a step incorrectly… You’d think if I did though that the AI wouldn’t be working but it is.

@TorQueMoD Have you solved the Warning: GetSimulationTimeStep() warning? I’m running into the same thing when spawning my character pawns.

To be entirely honest this was so long ago that I can’t remember the solution. I know I solved it, as I shipped the game, but I’m not sure what the fix was. My apologies. What version of the engine are you running? Can you share your blueprint so I can try to help more?

I think I can see the issue visually, one of my spawned characters is hanging in mid-air for some reason.
I had a crash as well but now I know it was unrelated to this character movement issue, now the game is stable but the warning is still there.

This is the code I’m using to spawn my player characters in game mode’s BeginPlay. It’s a hot-seat local multiplayer game, basically a clone of HoMaM 3. :slight_smile:

I’m spawning four characters and getting the error three times. I’m possessing my all new characters by controller 0 and then again the one that should actually be controlled by the first player. I have a feeling there’s something I’m not doing right there.

LogCharacterMovement: Warning: GetSimulationTimeStep() - Max iterations 8 hit while remaining time 0.091142 > MaxSimulationTimeStep (0.050) for 'Hero_C_2147482465', movement 'Walking'
LogCharacterMovement: Warning: GetSimulationTimeStep() - Max iterations 8 hit while remaining time 0.091142 > MaxSimulationTimeStep (0.050) for 'Hero_C_2147482438', movement 'Walking'
LogCharacterMovement: Warning: GetSimulationTimeStep() - Max iterations 8 hit while remaining time 0.090483 > MaxSimulationTimeStep (0.050) for 'Hero_C_2147482432', movement 'Walking'