game has been modified since save. unable to restore game. (GM01)

Started by monkey424, Wed 13/02/2013 09:45:02

Previous topic - Next topic

monkey424

Howdy y'all!
Just wanted to share some knowledge of a bug I recently fixed in my game.
I'm not sure how common the problem is, but if you come across it hopefully you'll find this post useful.

Bug - get this error: "game has been modified since save. unable to restore game. (GM01)" when trying to restore a saved game from certain rooms.

Solution - fixed problem by doing the following steps prior to creating the save-game file:

After user clicks on the save game button..

1. use ChangeRoom function (i.e. change room to current room, so character stays in that room)
2. set a trigger variable (e.g. bool save_game = 1) to continue code in global repeatedly_execute()
3. in global repeatedly_execute(), continue with SaveGameSlot function

Now the save-game file will restore without producing the error.

Not sure why this works, but it does!
    

Crimson Wizard

The error message "game has been modified since save...." is supposed to be displayed if the save is restored in an updated game with changes to number of rooms, characters, and so on. Also (AFAIK) size of global script data (global variables). The reason is that in such case game won't restore properly, and some things may behave in a weird way (even crashes may occur).

1. If you receive this message after you made any similar change to your game, then it is a correct behavior.
2. If you haven't done any such changes to your game, and just save and then load the game, this is incorrect behavior.
3. If your case is #1, but you were able to "fix" this by some hack in script, this is rather incorrect behavior too, because this means that engine can't detect incompatibility between saved game and new modified game.

Can you, please, give more information on when and how do you get this error?


E: Update, the error message, exactly, "Game has been modified since save; unable to restore game (GM01)" is displayed when you change number of global variables. Not the script global variables, but the ones created on Global Variables project page.

Ghost

AGS is pretty tetchy in that respect. IIRC the same message crops up when you restore a saved game with a different resolution (changed in winsetup.exe).

Crimson Wizard

Quote from: Ghost on Wed 13/02/2013 22:23:02
IIRC the same message crops up when you restore a saved game with a different resolution (changed in winsetup.exe).
Hmm, I doubt that. There's a resolution check made indeed, but it is native game resolution being tested (the one set in the project General Settings).
I was running games with various scaling settings a lot, when testing engine, and never encountered such behavior.

Khris

Yeah, the scaling filters got rid of that problem.
With earlier versions, one could for instance run a 320 game at a native resolution of 640. Needless to say, that caused lots of problems and confusion and was luckily ditched at some point.
But if you did save a game at one resolution, then tried to restore it in another, you'd get an error saying "this save game was saved with a different resolution" or something to that effect.

monkey424

Dear Crimson Wizard et al.
Thanks for your reply.
The error is case#2 - no changes were made to the game. I just save and then load and then get the error. So it is incorrect behavior.
I'm using version v3.2.1 of AGS
    

Crimson Wizard

Quote from: monkey424 on Thu 14/02/2013 09:56:59
The error is case#2 - no changes were made to the game. I just save and then load and then get the error. So it is incorrect behavior.
I'm using version v3.2.1 of AGS
I see, so this is a bug in the engine then.
Would it be acceptable for you to share the project files, or at least compiled game that had this error, so that we could debug this issue?

monkey424

Ok. I'll prepare some files. How do you want me to share them?
    

Crimson Wizard

There's a bunch of free hostings out there.
I am using this, for example: http://www.mediafire.com

Also, you may send a link by PM rather than posting on public.

monkey424

Here's the link: http://www.mediafire.com/?68783lc9x94s7xy
The file "Chalk Demo" is a simplified version of my game with just two rooms (room5 and room10).
To help with the diagnosis, I've included shortcut keys:

1 - SaveGameSlot(1, "demo save")
2 - alternative save game method
3 - RestoreGameSlot(1)

If you alternate between pressing 1 and 3 it will produce the error (just in room5, not room10).
    

Crimson Wizard

It is very good (seriously) that it is so easily reproduced. I'll try this out.

SMF spam blocked by CleanTalk