Poobslag / turbofat

Block-dropping puzzle game
MIT License
56 stars 19 forks source link

Game crashes sometimes on scene change #2821

Open Poobslag opened 1 month ago

Poobslag commented 1 month ago

In Adventure mode, I finished a level in Starberry Mountain. Instead of being dropped back to the map screen, the game crashed.

godot2024-10-15T12.34.30.log godot.log godot(4).log

The logs apparently show that the game was in the process of retrieving the achievement status for many achievements.

Poobslag commented 1 month ago

It always seems to be for the "aggregate achievement" achievement triggering the crash -- the one that checks for all of the dependent achievements.

Poobslag commented 1 month ago
func is_achievement_achieved(id: String) -> bool:
    _log("Getting Steam achievement: %s" % [id])
    var get_achievement_response: Dictionary = Steam.getAchievement(id)
    _log("getAchievement(%s) response: %s" % [id, get_achievement_response])

    return get_achievement_response["achieved"]

Maybe we should check achievements differently? This method optimistically assumes the method will always return a dictionary with an achieved boolean in it. Maybe it returns garbage sometimes?

Poobslag commented 1 month ago

I've made a new version of the game which checks these getAchievement responses and makes fewer steam calls, but it still crashed a moment ago. I'm hoping that if I run the game with --verbose flag enabled, it will maybe log something about the crash -- but it crashes very unpredictably.

On Monday, I playtested for 12 hours and the game didn't crash once. On Tuesday, it crashed 2 or 3 times for me! All of the crashes for me were during levels in Starberry Mountain.

Faulting application name: turbofat.exe, version: 1.3.0.0, time stamp: 0x66f60127
Faulting module name: ntdll.dll, version: 10.0.19041.5007, time stamp: 0x688f8c4b
Exception code: 0xc0000374
Fault offset: 0x00000000000ff3c9
Faulting process id: 0x6818
Faulting application start time: 0x01db1fe5d89fcc3c
Faulting application path: C:\workspace\steam\steamworks-sdk\tools\ContentBuilder\content\turbofat-win\turbofat.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report Id: ae5dedad-6e58-4cb7-b4c4-839f75a74871
Faulting package full name: 
Faulting package-relative application ID: 
Poobslag commented 1 month ago

https://github.com/godotengine/godot/issues/85692

This may be related to Godot #85692. We could try adjusting breadcrumb.change_scene() to do something different.

Poobslag commented 1 month ago

This seems to be happening less frequently after the recent changes, but it is still affecting some users.

One user says it seems to be growing more frequent; the simplest explanation for growing more frequent over time would be that it's tied to save file size. Let's experiment with making the save file very large, or having them change save files.

Poobslag commented 1 month ago

I've removed the ResourceCache singleton logic; while I never had any evidence this was broken, it's kind of a weird nasty thing I probably shouldn't be doing.

Poobslag commented 1 week ago

It's been about 2-3 weeks since anyone reported a scene change crash, I think the ResourceCache singleton logic fixed most of them.

I encountered a crash within the Godot editor about five days ago, so I'm leaving logging enabled there to see if I can track that down. But for now, I'm downgrading this to a 3 and removing it from the milestone since it doesn't seem to be affecting players anymore.

Poobslag commented 3 days ago

I encountered another crash within the Godot editor today, here are the logs:

Changing scene to [PackedScene:70921] (res://src/main/ui/menu/TrainingMenu.tscn) valid=True
tree.change_scene_to returned 0
Launching scene transition fade in effect
Finished launching scene transition fade in effect
Launching scene transition fade out effect
Finished launching scene transition fade out effect
Scene changing; unassigning CurrentLevel.puzzle.
Finished unassigning CurrentLevel.puzzle.
Changing scene to [PackedScene:71834] (res://src/main/puzzle/Puzzle.tscn) valid=True
tree.change_scene_to returned 0
Launching scene transition fade in effect
Fading in creature #player#; valid=True
Finished fading in creature #player#
Fading in creature #filler_105#; valid=True
Finished fading in creature #filler_105#
Fading in creature #filler_094#; valid=True
Finished fading in creature #filler_094#
Fading in creature cast; valid=True
Finished fading in creature cast
Fading in creature #filler_044#; valid=True
Finished fading in creature #filler_044#
Finished launching scene transition fade in effect
Launching scene transition fade out effect
Save scheduled; Showing save indicator
Finished showing save indicator
Finished launching scene transition fade out effect

This would usually be followed by:

Scene changing; unassigning CurrentLevel.puzzle.
Finished unassigning CurrentLevel.puzzle.
Scene changing; saving player data
Player data saved; Showing save indicator
Finished showing save indicator
Player data saved; Hiding save indicator
Finished hiding save indicator
Finished saving player data
Changing scene to [PackedScene:70717] (res://src/main/ui/menu/TrainingMenu.tscn) valid=True
tree.change_scene_to returned 0
Launching scene transition fade in effect
Finished launching scene transition fade in effect

The crash occurred after launching the Training Menu, testing Serving On A Rocket for about 15-20 minutes, and then exiting back to the training menu with the "Back" button.