vaendryl / Sunrider

source code of the visual novel 'Sunrider'
http://sunrider-vn.com/
41 stars 21 forks source link

old save files often give a 'can't find a point to stop rolling back' and fail to load #73

Closed vaendryl closed 9 years ago

vaendryl commented 9 years ago

this issue is consistent in so far that if a save file doesn't work it will never work. if it loads it will always load. the cause is a mystery but the issue lies within ren'py itself.

it seems caused by using the label 'after_load' where code like reset_classes gets run. for some reason renpy fails to properly look up what point in the game it should return to after calling this label.

I may have to either hack renpy and cause it to jump to a fallback label whenever this exception gets raised, or make the after_load label jump to a fallback label.

the fallback label would be dispatch or the relevant mission label if battlemode is flagged as True. this should work without much issue with saves during combat, but saves during optional dialogue might give issues. it'd be pretty bad to get dropped off back at dispatch without any buttons to click to continue the story. I'm not sure that will be an issue though, as these buttons don't typically get removed untill the last moment.

BlueOrange commented 9 years ago

Haven't encountered this issue myself, although I guess I don't load the game from a save terribly often. Assuming that bad saves get created when the game is in a bad state, understanding that bad state would seem like the quickest path. Are there any bad saves that were created in a well-understood state?

EnderShadow commented 9 years ago

I have a couple of saves that I made at the end of beta 6 that cause a crash

EnderShadow commented 9 years ago

To be specific, they crash when trying to load or when placing ships in formation mode.

BlueOrange commented 9 years ago

Ender, do you know what the state of the game was when you made those saves? (How precise is your understanding of what's in the save file?)

vaendryl commented 9 years ago

you get a rollback exception when placing a unit in formation mode?

hunting down the specific states that cause a problem and finding the root cause would of course be cool, and I'm sure renpyTom would appreciate that, but that might be more effort than is really needed. I just don't understand the inner workings of renpy (specifically related to label management) or how exactly pickling works as used by the save system so it'd be really hard to do.

Right now I'm thinking of showing a warning screen inside the after_load code telling the player something like "you've loaded an old save and there is a chance loading normally results in a crash. if it does, please try again and select 'safe mode loading'" and then there are 2 buttons. clicking 'normal load' would just pass out and have the game try and return normally. clicking 'safe mode loading' would jump to either dispatch or the active mission loop.

in addition, I asked Tom in a PM on lemmasoft if there was a way for me to programmatically check the label the code will return to and check if it is corrupted. if it is, I can do an active jump automatically. he responded saying this isn't possible right now, but that he'll put it in ren'py for me. he just needs a few days to get it done.

EnderShadow commented 9 years ago

I get a NoneType error when placing a ship because result = None or something like that. Luckily I have a save file after the battles that does open correctly, so I won't have to restart.

vaendryl commented 9 years ago

I suspect this error would not happen with the latest master version.

BlueOrange commented 9 years ago

Time for me to stop back-seat-managing, I think! Definitely seems to be under control.

EnderShadow commented 9 years ago

will I need to restart or do you want the saves to try and debug them? The main problem is that I get a NoneType error on line 387 of classes.rpy. This happens right after I click the sunrider or any ship when in formation mode.

vaendryl commented 9 years ago

seems I'll have to check formation mode :/ maybe the problem isn't part of the save but I just broke formations.

as for this actual issue though, https://github.com/renpy/renpy/commit/a190738a242404e13e12c95019552938a903bc3b should help.

vaendryl commented 9 years ago

Ender, could you try if the same problem persists in the latest master version? formation phase seems to work normally

EnderShadow commented 9 years ago

The latest master for Sunrider or Renpy? If it's for Sunrider, then I already did.

vaendryl commented 9 years ago

In that case I would rather like to have a copy of that save file :)

EnderShadow commented 9 years ago

This one crashes when trying to place a ship. https://dl.dropboxusercontent.com/u/87762025/2-6-LT1.save

This one crashes when trying to load it. https://dl.dropboxusercontent.com/u/87762025/2-7-LT1.save

vaendryl commented 9 years ago

thanks, I'll have a look at those when I get home.

vaendryl commented 9 years ago

renpytom has worked hard to fix it. even when it happens clicking 'rollback' should actually work. downside is that my after_load compat code doesn't actually run this way.