Feature Request : Improve/New Local Storage

Discussion and feedback on Construct 2

Post » Mon May 23, 2016 4:50 pm

For Request 1, i would be happy allready if i could get the whole Local Storage a json (after all it is keys and values) and assign it to a dictionary (or the Local Storage should be formatted in the same way as a dictionary).

For me that would be helpfull.

About the get/set system i have no complains at all.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed May 25, 2016 9:25 pm

rexrainbow wrote:The request could be separated into two parts,
1. enumerate the variables in GUI like global/local/private variables
2. save/load in synchronization mode

Using a dictionary like Ashley said, could solve request2 only.


For point 1 i was thinking in something more like "instance variables" on you can add/remove, select position, set an initial value,etc... like the examples, something more visual/easy to manage.

About the sync, i'm not a coder and after read some about that i'm still not understand very well XD(also english is not my native language), for that reason i'm using C2(Thanks for this great program!) ,my code skills are 0 so local storage, json's, arrays and similar things simply i can't with that and always i get frustrated to get something working, and maybe i finally got something but when i finish the game and go to another if i need to use it again, simply remember all the time i will have to invest to understand again and get it working i lose the motivation or avoid that feature.

My first game using C2 was AsteroidX (https://www.scirra.com/arcade/shooting- ... roidx-4511) , was made in only 2 weeks. The unique time i get a bit stucked was using the Parse plugin for online Scores but finally i got things working great with more features that i planned in a first moment so this one worked great and was intuitive/easy to use.

Now i'm trying to do a basket game cross-platform desktop/mobile/tablet using only the html5 version, this one: https://kronbits.itch.io/basket-prototype . And my idea was create some player stats of wins/loses/draws , gameplays, % of accuracy and lots of achievements but after see all i have to do for get working only one, to load the local storage keys and manage.... well i think i will do only the best score that is already working and maybe the wins/lose/results :P .

Seems the way i planned have a problem with the sync, but sure there is a way to make it, if not more simply, more visual/intuitive on you can see in a first look how many keys you have in the local storage and manage them, load all integrating with the LocalStorage without using another plugin (the dictionary) and learn how json's works.

So well, i don't know if this finally will be improved/redone or whatever, but thanks for the replies and the interest guys! ;)
B
25
S
10
G
3
Posts: 577
Reputation: 4,556

Post » Wed May 25, 2016 11:03 pm

I See where you are gooing. But for that to work (i think) the sprite should accept json, (when i try it destroys itself) to link it direcly to the Local Storage in get and in set. Dont think that is for tomorrow.

I would welcome an interface to see whats happening i the Local Storage. Althaugt, you can see the Local Storage object and its contents in the debugger.

Currently. I avoid A sync by using an array and store its json. And i know whats in the array. Probaly why i cant complain. Guess i dont do complicated stuff with it. I also keep the user on a dead layout till all my stuff is loaded. Like this:

99Instances2Go wrote: ?

https://
drive.google.com/open?id=0B1SSuCVV8v74SnBseHRpUXRfSEU
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri May 27, 2016 7:53 am

I had another idea but maybe i'm falling again in the sync/async problem, but if not's the case here is:

A temporaly LocalStorage, or maybe saving in memory while the game is playing, as variables that we can add/substract or some like that. I prefer Storage Variables so we can manipulate them and change more easily.

Then an event to save to the real Local Storage like:

Read TempStorage/Storage Variables > Save to Local Storage

This "Save to Local Storage" event willl do:
--------------------------------------------------------------------
Get item Key1
On item Key1 get - > Set item "Key1" to Temp.Key1
Get item Key2
On item Key2 get - > Set item "Key2" to Temp.Key2
etc....

In the same way now we do that, only that he will do automatically for us starting to get the first key defined until the last one. Same thing for the load.


So, we have a Storage Variable like Global Variable that we can manipulate, if we change his name, in all the sites appears in the even sheet will change (like global variables), the option to add/substract for numbers and all this things.

In the GUI we have that variables in X order, and set in case of missing what number/text set to default when load.

The event mentioned to load /save like the Dictionary/Json's trick for all the keys and the option to load/save only one of them in case we need that.
B
25
S
10
G
3
Posts: 577
Reputation: 4,556

Previous

Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 6 guests