Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: SpacePaw on Mon 22/03/2010 19:50:14

Title: Save game file structure?
Post by: SpacePaw on Mon 22/03/2010 19:50:14
Hey people. I have a question about the save files structure. Is there any specification of how it is composed available? I want to implement a way of checking if the file is corrupt before loading it.
If anyone figured a workaround some time ago I would be also happy to know how did he/she do that :)
Cheers!
Title: Re: Save game file structure?
Post by: Calin Leafshade on Mon 22/03/2010 20:11:39
you dont really need the structure.. you could just use a hash algorithm on save and then check it again before load.
Title: Re: Save game file structure?
Post by: SpacePaw on Mon 22/03/2010 20:51:46
Quote from: Calin Leafshade on Mon 22/03/2010 20:11:39
you dont really need the structure.. you could just use a hash algorithm on save and then check it again before load.

briliant :) I hope I can do that in AGS though. Never tried that before. Sometimes you just bounce of the walls while scripting XD

Edit: Anyways, great solution! Thanks! I bet I can do that in ags anyway X3 so thank you! great help!
Title: Re: Save game file structure?
Post by: SpacePaw on Mon 22/03/2010 22:31:31
Blah totally forgot about the loop count problem :/ so I'll need to do a separate app and a batch file after all.. *sigh* pity
Title: Re: Save game file structure?
Post by: monkey0506 on Mon 22/03/2010 22:45:55
Well you could just use the noloopcheck keyword such as:

function noloopcheck blah() {
  int i = 0;
  while (i < 2000000) {
    i++;
  }
}
Title: Re: Save game file structure?
Post by: Pumaman on Mon 22/03/2010 23:00:15
What do you mean by "corrupt"? Do you want to check if the player has tried to hack it, or are you just concerned with data integrity? It's very unlikely that their files would be corrupt.
Title: Re: Save game file structure?
Post by: SpacePaw on Mon 22/03/2010 23:35:36
Quote from: monkey_05_06 on Mon 22/03/2010 22:45:55
Well you could just use the noloopcheck keyword such as:

Didn't know it existed? LOL. That's fun! Thanks monkey :) We'll see if it's too slow

Quote from: Pumaman on Mon 22/03/2010 23:00:15
What do you mean by "corrupt"? Do you want to check if the player has tried to hack it, or are you just concerned with data integrity? It's very unlikely that their files would be corrupt.

Both hacks and integrity. It's highly unlikely but still possible right? :)
Title: Re: Save game file structure?
Post by: subspark on Tue 23/03/2010 11:17:15
I support the idea because we imagine saved games will be shared around a lot in our production and if one goes wrong, it would be nice to have AGS not break and instead throw a user-friendly message up like, "The current save file appears to be corrupt. Please select another one."

I'm almost certain this can all be done with a seperate Exe/Batch.

Cheers,
Sparky.
Title: Re: Save game file structure?
Post by: Dualnames on Tue 23/03/2010 11:47:51
Quote from: subspark on Tue 23/03/2010 11:17:15
I support the idea because we imagine saved games will be shared around a lot in our production and if one goes wrong, it would be nice to have AGS not break and instead throw a user-friendly message up like, "The current save file appears to be corrupt. Please select another one."

I'm almost certain this can all be done with a seperate Exe/Batch.

Cheers,
Sparky.
Unless I'm mistaken there's this error message that uses the current speech style and displays "Error bla bla Couldn't load savegame." And if I'm not wrong, I think it doesn't crash the game, but instead it just doesn't load the game.