Multiple save game systems

Started by jamesreg, Tue 07/01/2014 04:35:49

Previous topic - Next topic

jamesreg

Ok this one might should be in advanced help.
and if this has been handled before Im sorry for reposting but couldnt find anything like it in the search.

Ok here is what I am doing.

I am creating an ags game that is multiple games in one example being multple old style nes style games or small games like that.
Each game so far consist of one room each game will have about a dozen or so seperate games all together.

Now I had not problem up till now when I totally forgot about save/restore features.
I do not want to or want to avoid using one save game menu for all games.

I would rather have seperate save game menus and systems for each game.
Is this possible to do at all?

and if so could someone point me in the way of getting started or what to look at.

Khris

Using the built-in save system will save the entire game's state, so if you want each mini game to have its own, independent save states, you need to save manually. You can create files and write Strings and Ints or arbitrary characters/bytes to them.

If you want multiple save game slots for each game, just use multiple files.

ListBox.FillDirList allows you to state an arbitrary pattern, so you could use ListBox.FillDirList("game01*") to show only saves pertaining to the first game, etc.

It might even be possible to still use the internal system. You could save the progress of game 1 in slot 1, the progress of game 2 in slot 2, etc., and when the player leaves one game and selects another, you'd save the current game, then restore the other game's slot. You could possibly even use multiple save games, you'd have to manage all the slot numbers and remove all other entries after using ListBox.FillSaveGameList() though.

jamesreg

That was enough info to get me along the way Might still have a couple questions but thats enough to get me going thanks

Gilbert

Alternatively, you may try to make each mini game a separate game and use the RunAGSGame() function to launch them from a host game. I think in this way each separate game would use its own save games.

jamesreg

Ok im comming back to this now cause im at a point of needing to figure it out now.

Here is what I was thinking tell me if this is possible or not.

First a couple questions

1) How many slave slots can an ags game have is there any limits? and if so is this easily changed or changeable in script?

2) Is it possible to code it out so that say a game that is made up of multiple mini games such as my NES remake/port whatever you call it project can define certain save game slots per game. (Example being say I want the shadowgate game I am doing to only use save game slots 1-3, then When I do another game I want it only to use save game spots 4-6) I would only want the three save/load game slots to show according to what game is played at the moment.

3) If number two above is possible would it be possible then to have a different background on the save game dialog box for each game.

Hope I made that clear enough and not to confusing hope its clear enough people understand what im trying to achieve.

Khris

Assuming that each game has its own room and three slots, you can do this:

Code: ags
// global variables
int slots = 0;
int slot[3];

  // show load GUI function
  lbSaveGames.Clear();          // clear listbox
  slots = 0;                    // reset slot counter
  int first = player.Room * 3;  // first slot
  int currentSlot = first;
  String desc;
  while (currentSlot < first + 3) {
    desc = Game.GetSaveSlotDescription(currentSlot);
    if (desc != null) {   // if save game is available, add to list, add slot to array
      lbSaveGames.AddItem(desc);
      slot[slots] = currentSlot;
      slots++;
    }
    currentSlot++;
  }
  if (slots == 0) Display("No save games found.");
  else {
    // set GUI background here
    gSaveGames.Visible = true;
  }


In the listbox's select event, do
Code: ags
  RestoreGameSlot(slot[lbSaveGames.SelectedIndex]);


You could also simply use GUI buttons to restore / save and hardcode them to use slot player.Room*3, player.Room*3+1 and player.Room*3+2.

(Note that this code might not necessarily work as-is. It's supposed to show the general way of how to implement this.)

Crimson Wizard

As an additional note...
Quote from: jamesreg on Tue 14/01/2014 15:52:29
1) How many slave slots can an ags game have is there any limits? and if so is this easily changed or changeable in script?
AGS supports up to 999 saves, numbered from slot 1 to slot 999, 999th usually used by autosave feature. Slot 0 does not work IIRC (tested some time ago).

jamesreg

Yes each game would take place its on room and at 999 saves thats 333 games possible and Ill get tired of this long before I do that many so Yeah this would work thank you very much.

SMF spam blocked by CleanTalk