Are there any Webstorage limits?

0 favourites
  • 12 posts
  • Hi Yall,

    I am creating a game where you can unlock 100's if not 1000's of things.

    The way i know how to save it ( Android ) is using webstorage.

    Though i am very curious if there is anything i have to keep in mind using webstorage? Is there a limit i should use? Could i just save 1000's of things?

    As far as i know i am saving things like:

    Level 1

    • Level 1.1.1
    • Level 1.1.2
    • Level 1.1.3
    • Level 1.2.1

    And that for 100's of levels.

    Just before i go trough all the hassle i want to be sure that i can use webstorage like that or if there is any method i should use.

    Thanks in advance!

  • Thousands of small strings, yep.

    Thousands of large strings, nope.

  • Thanks for your reply.

    So if i'm correct you are saying:

    Webstorage > Set value "level1" = 1 (x1000 as for level 2, level 3 etc.)

    No problemo?

    Keep in mind that the whole game will be designed for Android ( don't know if this makes any changes ).

  • As long as you dont do something like putting base64 strings in it.

  • Alright! Thanks for your answer !

  • From the manual:

    [quote:1owyzcvb]Most browsers implement a maximum size of the data that can be stored with WebStorage - 5mb is a common limit. If you exceed the limit, the WebStorage's On quota exceeded trigger runs.

  • Thanks Ash, i indeed did read that but to be fairly honest, i have no clue how much KB a webstorage takes in.

    My guess was that a simple webstorage like "Yes = 1" would take no more than like 1KB each. Ofcourse i could be wrong but i have no idea how to measure that.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you export as a stand-alone node webkit game then the webstorage is stored, at least on Windows, in the app-data folder. You could do that and check the size of your game's folder to find out how much of a browser's webstorage it would use up.

  • From the manual:

    WebStorage does not store in the browser cache. If the user opts to empty the browser cache, WebStorage data remains intact. However if the user opts to clear all their cookies or offline website data,

    WebStorage will be cleared



    Can I just say that based on my own current frustrating and project stalling experiments with attempting to use local 'webstorage' to store level data, I don't think it is suitable at all for storing level data created by the game dev.

    Level data as in data created by the developer of the game to set up multiple levels - afaik that level data won't be 'shipped' with your exported game because webstorage is designed to save and load data created within the game - but the data is not created within the game - only accessed by the game and possibly created by an editor created to support development.

    More detailed information is needed in the manual about the different ways to store files externally. For example - Where is the data stored?

    I'm storing the levels I create using my level editor in an array (grid x, grid y, and sheet number) and I want to have several packs available on release day with the option to add extra packs later.

    Webstorage just seems totally irrelevant in my case and possibly in the OP's case.

    Download and Load as json also misses the mark - In all my attempts at storing an array as json and 'downloading' that file, When I run the program again any changes I made are gone - because the last saved file has to be re-imported to the project for the changes to be available.

  • blackcrypt - WebStorage is for saving and loading data at runtime. If you want to ship data with the game itself, import it as project files.

  • Ashley

    This would require all levels (level packs) being imported into the project before release? 30+ packs. I had planned for more (maybe as DLC to fund further projects).

    Does a licence open up more (file storage) options for me - Are the limits I am experiencing due to the free version? I am evaluating C2's viability to deliver my game, currently the C2/HTML export and the file (data) storage issues are stopping me from getting a license. Pretty much the only thing really - everything else about C2 is awesome - and that's why I'm still here asking questions to find a way forward.

    Are there and 3rd party file storage plugins that would help? Also, at this stage I have no plans to release on any mobile - just desktop.

  • No, you can leave some out and AJAX request them from somewhere else if you like. They're just files on a web server after all. It's up to you what you do and how you handle it.

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