weatherfactory / cultistsimulator-visible

Read-only preview builds of Cultist Simulator for the convenience of modders and the curious.
https://weatherfactory.biz/cultist-simulator/
36 stars 6 forks source link

Handle mod-borked saves better #211

Closed alexiskennedy closed 1 year ago

alexiskennedy commented 1 year ago

I have this canned reply in HelpScout:

"Hello! It looks like your save depends on mods you've uninstalled. You can fix this by

(1) reinstalling those mods, or (2) purging your save.

cheers,"

... which I send when I see something like this:

Unknown property in import: forlegacyfamily for DeckSpec Unknown property in import: forlegacyfamily for DeckSpec Unknown property in import: forlegacyfamily for DeckSpec Unknown property in import: forlegacyfamily for DeckSpec unknown element id specified: comments LOADING: Depersisting game state from C:/Users/Owner/AppData/LocalLow/Weather Factory/Cultist Simulator/save.json LOADING: Deserialized game state from JSON CRASH!!! UH O! LOADING UH O SCENE!!! Couldn't initialise / depersist game state when setting up: System.NullReferenceException: Object reference not set to an instance of an object

alexiskennedy commented 1 year ago

Can we validate the save before we redirect to the TabletopScene? and if it has errors that look mod-related, display a warning to that effect?

'look mod-related' might be as simple as 'unknown property', or there might be more cases

alexiskennedy commented 1 year ago

see also #212

Chelnoque commented 1 year ago

Ah, Shelves. I knew they gonna pose that problem one day.

It's a DLL thing - a mod creates a new type of payload, obviously, it can't be loaded if mod isn't enabled. But the whole problem isn't strictly about being "mod-related" - similar thing may happen, for example, when we introduce the Newer Shinier Dropzones(tm) in Cultist Simulator 2023, put it on the beta, and people will try to load beta-saves on the main branch.

So yes, better to just back-up the save and ignore the stuff the game can't load instead of crashing.

alexiskennedy commented 1 year ago

I'm good with all that, both in specific and in general ('CS should load game and log warnings rather than fail to load game and show error screen')

Chelnoque commented 1 year ago

Better in LONGIFLORUM. Can be even better (more accurate) if we validate all entities in the save, but it will come with costs. Will do that if LONGIFLORUM precautions won't be enough.