WebStorage, still best method to save data?

Get help using Construct 2

Post » Wed Dec 19, 2012 1:00 am

In short Im creating inventory system (which is already working, kinda) but I would need that data to remain in-game after browser has been closed.

Short scenario:
* each inventory slot is made from 3 different arrays (using 10,3,1 array as in width,height,depth).

- Pick up item.
- Compare item name with inventory slots.
- If item is not found at inventory, save item to first free inventory slot.
- When hassle is done, vave data to WebStorage and update/load inventory slots via webstorage information.


Any other suggestions? Databae support would be awesome, but I dont really doing &user=name&password=fake type of things, sounds scary to me :P

EDIT: I assume AJAX and POST/GET functions should help me to build simple database support for storing this kind of information (and possible auto save every x minutes). CoffeeOD2012-12-19 01:18:21
B
7
S
1
Posts: 51
Reputation: 1,087

Post » Wed Dec 19, 2012 1:54 am

There is a solution ... You could save array data to Json using Local keys and then load all the data when the player reconnects ...
B
34
S
16
G
16
Posts: 2,222
Reputation: 16,564

Post » Wed Dec 19, 2012 2:05 am

Ah, I just started reading about JSON and it could do the trick :) At least in here http://www.scirra.com/arcade/example/1539/asteroid-in-less-than-100-events high scores are saved, so looking good.

Thanks for the tip, I was going to ignore that option but you made me look into it better :PCoffeeOD2012-12-19 02:05:43
B
7
S
1
Posts: 51
Reputation: 1,087

Post » Fri Dec 28, 2012 2:35 am

All right, back with more questions. I managed to save and load information using database, then loading/saving information via JSON and parsing necessary parts to arrays.

For offline games, is there any way to store information in XML or any other file to player own computer and use that for saving/loading information?

I assume we can use instance variables to check if object should spawn or not, but there is alot more information we need to be able to handle such as player own information (health, mana, skill points, money, items currently in use, skills selected etc.), inventory, map progress, dungeon progress, game total progress, karma (relationship between other NPCs) and more. Hoping that player will not clear their cookies and lose all game data is bit akward.CoffeeOD2012-12-28 02:38:27
B
7
S
1
Posts: 51
Reputation: 1,087

Post » Sat Dec 29, 2012 4:42 am

Small bump, would love to know is there any solution to this? Current system works only for those who have active internet connection available.

Second thing I worry is Kongrete/other providers if they have similiar data storing solutions for us to hook into, of course Steam is another thing which Im uncertain with current setup, all seems quite scary at this point :P

Making wrong decision now with data storing can lead into bigger problems later. I have look into other engines but to be honest, CS2 provides us fast way to make our ideas happends.CoffeeOD2012-12-29 04:43:39
B
7
S
1
Posts: 51
Reputation: 1,087

Post » Sat Dec 29, 2012 12:22 pm

You cannot/should not save files. While I know some browsers are starting to dabble in the area of FILE.IO(or whatever it's called). It's not wise as browsers having direct file access has heavy negative stigma and might not become standard. Continue to use Webstorage as it actually saves data locally and not online. Webstorage uses some form of cookie and browser cache.

webstorage is local and Kongregate should have no problems with it.

B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834


Return to How do I....?

Who is online

Users browsing this forum: imnotspecial, totoe and 12 guests