How do I make a save system for Mobile(Android)?

0 favourites
  • 3 posts
From the Asset Store
Match the similar cards with each other and free all animals!
  • Hello,

    I made a tycoon game where you get as much money as possible where you can buy upgrades\

    I had a friend test the game and his game didnt save

    A BETTER VERSION OF THE QUESTION

    Do i need to do anything special or can i use the simple "save game" and "load game commands?

    Thanks in advance

  • If you want more control over what gets saved (which also by comparison means you'll have a lot of variables, etc to keep track of but that's the tradeoff, anyway) or want to have multiple save-files, it's better to make a save system using local storage and a dictionary or two.

    I have a capx that's made for sort of zelda-like games but it should pretty easily apply to any game that has more than one save-slot and has at least some kind of stats, items, etc to keep track of:

    dropbox.com/s/pfgclknuert64i5/Savefile%20System.capx

    Also, if you want to keep track of things like bought-objects (as example, I played a lot of the Zoo Tycoon games in the past, so let's use a random zoo or snack structure the player can buy and place as an example, ignore the object in this example) and have them restored upon reloading a save:

    To utilize this properly, you may have want to have a grid system built or at least track the x/y place of objects, which can be done easily by storing them to variables or a dictionary upon placement.

    For picking the absolutely right object...well, UIDs may not be the best solution here, since exiting and saving a game would mean that objects may not be permanent and with the exception of global objects, here's a more fool-proof method:

    Track where players can place structures, whether by X/Y or a grid system. Regardless, you may want to assign arbitrary spaces for your sanity's sake and tie a specific X/Y to them. Something like "StructureSlot1" = Empty/"<StructureName>"* and "StructureSlot1X" + "SturctureSlot1Y". This way, when a save is reloaded, you can have the game check through each grid-space, and spawn a structure on grid-space-x if one happens to have a defined value in the savedata dictionary as well as restore any metadata such as what the player set something like a food-stand to sell if they have multiple options of what they can set.

    *I'll get to this part in a bit, it's below:

    You could store all your structure models/sprites in one object and create new instances (remember to track them properly!) whenever a player buys and places a new structure, such as a popcorn stand, bench, etc. Have their names match the structure-names in your definition/structure-list and also have them match whatever formatting would be for your dictionary or such so when you spawn a new structure, set the animation and set it to use the name stored in "StructureSlot1" key.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you want more control over what gets saved (which also by comparison means you'll have a lot of variables, etc to keep track of but that's the tradeoff, anyway) or want to have multiple save-files, it's better to make a save system using local storage and a dictionary or two.

    I have a capx that's made for sort of zelda-like games but it should pretty easily apply to any game that has more than one save-slot and has at least some kind of stats, items, etc to keep track of:

    https://www.dropbox.com/s/pfgclknuert64i5/Savefile%20System.capx?dl=0

    Also, if you want to keep track of things like bought-objects (as example, I played a lot of the Zoo Tycoon games in the past, so let's use a random zoo or snack structure the player can buy and place as an example, ignore the object in this example) and have them restored upon reloading a save:

    To utilize this properly, you may have want to have a grid system built or at least track the x/y place of objects, which can be done easily by storing them to variables or a dictionary upon placement.

    For picking the absolutely right object...well, UIDs may not be the best solution here, since exiting and saving a game would mean that objects may not be permanent and with the exception of global objects, here's a more fool-proof method:

    Track where players can place structures, whether by X/Y or a grid system. Regardless, you may want to assign arbitrary spaces for your sanity's sake and tie a specific X/Y to them. Something like "StructureSlot1" = Empty/"<StructureName>"* and "StructureSlot1X" + "SturctureSlot1Y". This way, when a save is reloaded, you can have the game check through each grid-space, and spawn a structure on grid-space-x if one happens to have a defined value in the savedata dictionary as well as restore any metadata such as what the player set something like a food-stand to sell if they have multiple options of what they can set.

    *I'll get to this part in a bit, it's below:

    You could store all your structure models/sprites in one object and create new instances (remember to track them properly!) whenever a player buys and places a new structure, such as a popcorn stand, bench, etc. Have their names match the structure-names in your definition/structure-list and also have them match whatever formatting would be for your dictionary or such so when you spawn a new structure, set the animation and set it to use the name stored in "StructureSlot1" key.

    Its not that type of tycoon game, but everything that i need are in global variables. Like the Money and purchases, they are all in global variables. As long as those save im fine. You dont place things in my game.

    But I really appreciate the explanation

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