Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Kinoko on Tue 10/08/2004 12:04:06

Title: Copying save slots
Post by: Kinoko on Tue 10/08/2004 12:04:06
Would it be possible to give the player the ability to 'Copy' a saved game to another slot? You can currently save, restore and erase but I can't think of a way to copy, which I think is a really handy feature (at least, it's something I use a lot because I'm paranoid about software screwups or something).
Title: Re: Copying save slots
Post by: Mr Jake on Tue 10/08/2004 13:01:54
Load the slot then save it right away :D
Title: Re: Copying save slots
Post by: Pumaman on Tue 10/08/2004 20:26:54
Is this something anyone else would find useful? Some sort of CopySaveSlot function?
Title: Re: Copying save slots
Post by: Mr Jake on Tue 10/08/2004 21:51:42
Maybe.... only for long games really :/
Title: Re: Copying save slots
Post by: Kinoko on Wed 11/08/2004 06:58:30
It's no big deal really, it's something I always use in a game if it's available. I was hoping there might be some elaborate work around for it already (though I wasn't optimistic - I had to ask).
Title: Re: Copying save slots
Post by: Mr Jake on Wed 11/08/2004 09:11:04
there is a walk around, I think :/, say you had 5 save slots, make the game:
Save the game to the 6th slot
Load the game you want to copy
Save it to the new slot
Load the 6th slot again.
Title: Re: Copying save slots
Post by: Gilbert on Wed 11/08/2004 09:27:52
Heh you don't even need slot 6 if that feature only work in say, the title screen (ie if you don't need to copy savegames ingame).

Actually I had thought of similar solutions, but didn't post my suggestion, as it may not worth that much effort to workaround it just to have a copy savegame function (unless there're some internal supports of course).

The problem is, when you load the game, how can you tell the engine: "Now I'm NOT loading a game to play, but just to load it and save it again and then go back to title screen or whatever, thank you!"

My thought was that (not tested, don't know even if it works, and I think it's too complicated to make it worth trying) when you want to copy a savegame you write to a temp file with info of slot you want to write to, and when you load a game back, the game checks the info from that file to see if the game is loaded for playing or copying, if it's for copying, it will save the game in another slot and then modify the file's content so when you load a game for playing next time, it won't be interpreted as a copy action.

Sounds like "simple" eh? Not so. The problem is where in the game do you want to check the file's content, it's definately not a good idea to have it checked in rep_exe(always), so what I came up is just after saving a game (warning messy pseudo code ahead):

SaveGameSlot(blahbla...);
handle=FileOpen(blah blabla...
blabla...
if (file content says "copy") {
Ã,  set file content to "nocopy"and save blah...
Ã,  RestartSaveCode() and then go back to title;
}

I don't think it's worth messing with such so I didn't even tried.
Title: Re: Copying save slots
Post by: Kinoko on Wed 11/08/2004 15:00:09
I think I see where you're coming from. I'll tell you exactly what my plan was, anyway. In typical RPG style, when you load the game up, it eventually gets to a Load screen. From here you can see the four save slots (either reading "EMPTY" or containing the save game description), a "New Game" option, "Copy Game" option and an "Erase Game" option.

All of these I have figured out rather well except of course Copy Game. You won't be able to do this during any other part of the game (ie. when saving your game), ONLY when you first load the game up and are about to load or start a new game. (So, exactly what you said, Gilbot).

Basically, I have it set up so that when you click on 'Copy Game', you are faced with the four slots. If you then click on a slot that contains a saved game (ie. doesn't read "EMPTY"), you'll then click on any other slot to copy the contents of that slot over to whatever the other slot is.

All of this is scripted already, so the 'skeleton' of it works. I can remove it though, if this isn't going to work, which I suspect it won't unless there's definitely going to be a function for this added in some future version.
Title: Re: Copying save slots
Post by: Hollister Man on Wed 11/08/2004 22:58:37
I have used the name of the save game (the description, in other words) to denote if it is a temp file, in the past.  I think that might be helpful.
Title: Re: Copying save slots
Post by: Gilbert on Thu 12/08/2004 03:19:00
Yeah kinoko, that's exactly what I meaned, as I had played loads of such kind of games before. :=
Title: Re: Copying save slots
Post by: Kinoko on Mon 13/12/2004 01:33:34
Sorry for dredging up another old thread, but I'm only just now considering this problem again. Again, if this doesn't work, it's no big deal.

Re: Gil's suggestion - I don't suppose you could help me flesh that idea out?

I understand your idea. When you're at the title screen, if you go to 'copy' a particular saved game, the engine needs to "load" that game without actually just loading it for play, then save it to another specified slot. I'm afraid I still don't understand your code though.

I suppose also that there's no way to achieve this without the game loading the saved game, hence leaving the title screen.

Well, I just thought I'd have one more go at this but if it's not gonna work, it's not gonna work.
Title: Re: Copying save slots
Post by: Gilbert on Mon 13/12/2004 01:53:55
Quote from: Kinoko on Mon 13/12/2004 01:33:34
I suppose also that there's no way to achieve this without the game loading the saved game, hence leaving the title screen.
No at the moment I think, my suggestion (if working) would still flash the room in play a bit and then go back to the title screen.
Title: Re: Copying save slots
Post by: Pumaman on Mon 13/12/2004 19:53:54
Actually, you could use a FileReadRawChar/WriteRawChar loop to physically copy the save game file, but that'd probably be rather slow.
Title: Re: Copying save slots
Post by: Gilbert on Tue 14/12/2004 01:35:22
Yeah but this thread was created before that function is added I think. In my opinion if there's no CopyFile() function, it's probably not worth going into the mess of doing similar stuff. But then I doubt the usefulness of added such a function or similar.