Suggestion: Save Array / Dictionary iOS

0 favourites
  • 4 posts
From the Asset Store
Template for a generic save / load system, fully documented in comments and video
  • Moin,

    on browsers (pc) you can download a json from a object like Array or Dictionary.

    But on iOS the Download Function does not work. (Tested with Ejecta).

    I have file "settings.json" (Dictionary) stored in the project folder "Files".

    Ajax load this file OnLayoutStart and loads into the Dictionary OnComplete(Ajax).

    Now I want to store / overwirte the "settings.json" when I suspent the app. To save the current settings (Dictionary Data).

    But this is not working. Or am I doing something wrong?

    PS: I know that there is a "save" and "load" function from system object. Savegame.

    But I ONLY want to save the Dictionary Object. And nothing else. By the way: The savegame function does not work with tilemaps.


    It must be possible to store the Array/Dictionary Data into a File in the App Sandbox Filesystem (Project Files). On mobile devices (iOS).

    I'm looking for suggestions about save/load settings on iOS with Construct 2 and Ejecta. Awesome Tools btw. =)

  • I might be missing something... Have you tried using web storage for the data save? I don't think there's a way to overwrite your game file settings.json but I could be wrong. So when you suspend the app just save a json string of the array into akey in web storage and when the app resumes, load that key back into the array. On start of layout just do a check that the key exists so that you chose to load the default file if there's no local save-game.

  • Sounds good. Thanks. Works fine.

    But it is still a important suggestion, I think.

    For example I want to download content from another website. Downloading new levels, etc. And save this files (json) to the local app data. (project files).

    Ok, I can download data (request http) and store it into a webstorage key (split for huge data). But this is a dirty way.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • yes, this is a good question....

    if you need to store only 10/50 values for example (health, coins, levels..) you can use the database...

    but I'm thinking how I can store the array... for example, minecraft has a very big map where the cubes are stored on a JSON file or something like that...

    If I like to make a world map like terraria (2d game) with the tilemap, it's really hard to load and store everything... I means, if the tilemap is 1000x1000 and the tile are 24x24 (so much data...) and the player can edit the single tile (destroy, building...etc) and you have 100 tilemap... every tilemap need 1 JSON file... the problem of save this kind of data, is if someone delete the cache of the computer (there are a lot of software to clean all of the data, or a lot of people do manually) you will lost all of the progress...

    and to store on the database will be impossible... (for the tilemaps)

    so, I'm thinking about to upload the single file, and when the player save, construct2 just upload the file in a specific folder and overwrite the older...

    this is possible... if in the game you make a sort of registration for the user (when a person make a new user, one script in php make a new folder in your server with a name of the user) and when you open your tilemap from the layout (or from external JSON on the website) construct2 can check if exsist the file in a specific folder of the user... if exsist just load this file, if doesn't exisist, load the original...

    doesn't exist a plugin for construct2 to make a sort of uploader and connect in your server (I think is very important to have a plugin like that) but is possible to make everything in php or java and just use AJAX request...I think this method would be the best to store the savegame

    for example, I don't know how construct2 can upload the file JSON (you need to know where construct2 save the data on the local store...but maybe you need the permission of the computer...) but is possible to send with AJAX the array in a single string (crazy I know, the limit of the url is like 2500 characters...) and make a specific script to overwrite the file...

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