Save System

This forum is currently in read-only mode.
From the Asset Store
Template for a generic save / load system, fully documented in comments and video
  • I have two questions:

    1.) How do you make a save system where you can click a save button, quit the game and when

    you get back on the game, everything is exactly the same as when you saved.

    2.) How do you make it where you have everything you had when you switch layouts. (like going

    out of a building)

  • I'm an INI fanatic, so I'd recommend using those for both tasks (save and load on layout change as well as exit).

    Here are some INI tutorials:

    Basic INI Use: http://www.scirra.com/forum/viewtopic.php?f=8&t=4328&hilit=Save

    INI File Protection: http://www.scirra.com/forum/viewtopic.php?f=8&t=4549&hilit=Save

    INI Level Loading/Editing: http://www.scirra.com/forum/viewtopic.php?f=8&t=1721

    Achievements With INI Files: http://www.scirra.com/forum/viewtopic.php?f=8&t=9418

  • Thanks Jay Jay

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks Jay Jay

    No problem, if you get stuck with INI files just send me a PM and I'll try to make a tutorial for you when I next have some free time

  • There's a built in save feature, and i think it's supposed to work quite well, but check the bugtracker. I've had poblems with it in the past.

  • There's a built in save feature, and i think it's supposed to work quite well, but check the bugtracker. I've had poblems with it in the past.

    In some of my own tests, I've found that it tends to load layouts with very few assets quite well, but when you get into layouts with a lot of on-screen assets it has trouble. In my own case, save and load has actually caused the game to malfunction completely in very strange glitchy ways. Lots of crashes, too.

  • > There's a built in save feature, and i think it's supposed to work quite well, but check the bugtracker. I've had poblems with it in the past.

    >

    In some of my own tests, I've found that it tends to load layouts with very few assets quite well, but when you get into layouts with a lot of on-screen assets it has trouble. In my own case, save and load has actually caused the game to malfunction completely in very strange glitchy ways.

    I haven't ever used the built-in save feature myself (I have used INI's like Jayjay mentioned though), but would it be possible to have a very small, bare-bones save screen layout to save and load from at runtime?

    Like, you hit pause and transition to a separate save/load layout with a simple UI. Hit the save button, and it stores all the globals you need. Hit the load button to load them. Then you can transition to whatever level is stored in your "currentLevel" global or whatever, and populate any scores, powerups, stats, or whatever with your other globals. Would that be one way around the lots-of-assets-to-load problem?

    Edit:

    By the way, if you are using INI's to build levels (by saving the size and position of platforms and enemies, for instance), then it is possible to store those in the game itself with simple hidden text objects by useing the Text Manipulator and the File objects.

    Step 1:

    On level load, you read the INI file information stored in the text object.

    Step 2:

    Use the Text Manipulator to save that text information to a temporary INI file in the game directory.

    Step 3:

    Use the INI object to read the info from the file you just created and do your level building loop.

    Step 4:

    Use the File object to delete the INI file.

    This can all be done in one tick, seamlessly. In fact I'm not even certain that it writes an actual file to the drive because it's being created, stored in memory, used, and deleted all in one fell swoop before Windows has a chance to process the write command. Anyway, this is how I did dynamic level loading for my game Vert, which only uses one layout for the entire game (even though there are only two levels ).

    Of course, with Rojo's new Resource plugin you can just store whatever INI files you want in the .exe itself without any fancy tricks like this, I'm just saying. Well, obviously you can't CHANGE the contents of an INI stored in the exe, but you can save basic level building data.

  • I haven't ever used the built-in save feature myself (I have used INI's like Jayjay mentioned though), but would it be possible to have a very small, bare-bones save screen layout to save and load from at runtime?

    Yeah, you can make a separate layout and set your events for saving and loading right in there. I just ran a test today of that in CC1. I only had a few assets in the layout I wanted to load, but it worked except that if I had two commands tied to the same button (i.e. left mouse button saves in layout 1, and left mouse button loads in layout 2 and also loads a picture from file) it causes images in the loaded layout to enlarge and pixellate, and then when I click the left mouse button to load, it crashes.

    Like, you hit pause and transition to a separate save/load layout with a simple UI. Hit the save button, and it stores all the globals you need. Hit the load button to load them. Then you can transition to whatever level is stored in your "currentLevel" global or whatever, and populate any scores, powerups, stats, or whatever with your other globals. Would that be one way around the lots-of-assets-to-load problem?

    That sounds like a plan. I'm definitely going to give that a shot as I would like to be able to get a precise save and load down to the last saved x and y position. Though, it seems like .ini is the path of least resistance for most games where all you need to do is save values/scores. It's quite possibly a larger matter of the .ini object being more functional than Save/Load and that the Save/Load function still has some critical bugs to be worked out. I mean, I've written to and loaded things from .ini with no problem whereas I've had glitches and crashes with the same things using Save/Load.

  • The Game Jolt Achievements plug now has web storage, which means you can store game saves online in text format.

    http://gamejolt.com/developers/achievements/

    The method is much like ini, where you designate a key, and data for the key. You can not make multiple items like ini, but you can make as many keys/groups as you like, and there is user storage, as well as game storage ie global data.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)