Are there any Webstorage limits?

Discussion and feedback on Construct 2

Post » Sun Feb 22, 2015 9:53 pm

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!
B
10
S
4
G
3
Posts: 163
Reputation: 2,507

Post » Sun Feb 22, 2015 9:57 pm

Thousands of small strings, yep.
Thousands of large strings, nope.
Image Image
B
164
S
49
G
114
Posts: 7,668
Reputation: 79,535

Post » Sun Feb 22, 2015 10:03 pm

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 ).
B
10
S
4
G
3
Posts: 163
Reputation: 2,507

Post » Sun Feb 22, 2015 10:23 pm

As long as you dont do something like putting base64 strings in it.
Image Image
B
164
S
49
G
114
Posts: 7,668
Reputation: 79,535

Post » Mon Feb 23, 2015 10:22 am

Alright! Thanks for your answer :)!
B
10
S
4
G
3
Posts: 163
Reputation: 2,507

Post » Mon Feb 23, 2015 10:43 am

From the manual:

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.
Scirra Founder
B
367
S
217
G
82
Posts: 23,262
Reputation: 183,689

Post » Mon Feb 23, 2015 11:31 am

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.
B
10
S
4
G
3
Posts: 163
Reputation: 2,507

Post » Tue Feb 24, 2015 1:44 am

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.
FREEDOM: Diegesis - Out Now for Windows! http://freedom.quicksandgames.com
B
21
S
5
G
1
Posts: 83
Reputation: 1,793

Post » Tue Feb 24, 2015 3:50 am

The Manual wrote: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.


@Ashley

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.
Image
B
14
S
3
G
1
Posts: 61
Reputation: 993

Post » Tue Feb 24, 2015 11:19 am

@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.
Scirra Founder
B
367
S
217
G
82
Posts: 23,262
Reputation: 183,689

Next

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 3 guests