Webstorages VS System Save/Load

Discussion and feedback on Construct 2

Post » Sun Jul 06, 2014 1:58 pm

I gotta say I always prefer make dictionaries & global variable and then let the player click the save button and use the system save/load. In that way I insure the game has been fully saved! While others ( and I know lot of them) like or prefer using webstorage to save data.
So I got confused :?
What is better: Webstorages or System's save/load?
ImageImageImageImageImage
B
54
S
15
G
5
Posts: 852
Reputation: 11,346

Post » Sun Jul 06, 2014 2:07 pm

I use both, both for different purposes. I use save/load for respawning after death so that the game remains in the same state, and webstorage to save values (e.g. score, settings) so that the game can remember progress.
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,679

Post » Sun Jul 06, 2014 2:19 pm

@sqiddster, but can't save/load already save scores & settings??
ImageImageImageImageImage
B
54
S
15
G
5
Posts: 852
Reputation: 11,346

Post » Sun Jul 06, 2014 2:26 pm

It can, but I find it a bit overkill for saving those sorts of things. It just feels weird to save the game state at a menu or something. There's probably no huge reason to avoid it, it just felt wrong for my specific game :P

If you're making an RPG or something, saving the game state is most likely the best way to go about saving.
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,679

Post » Sun Jul 06, 2014 2:31 pm

The savestating is huge, and while it works, I always find it too overkill, you are saving te entire game, in some cases, a simpler saving does the job really well and can also help not having the issues of saving unwanted things (sure there is the nosave behavior, but still)
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093

Post » Sun Jul 06, 2014 5:15 pm

Personally, I think it really depends on the type of game. In my smaller games, web storage just makes sense for me since the game is driven by data stored in global variables. However I have a larger game that I'm working on and using save is a much better option because it's a simulator and I want to preserve the state of the game. Sometimes saving the game doesn't have the desired effect of allowing the user to re-start the level. It really depends what works best for your model and how your going to lead the user into the restarting process. If you want users to be able to select levels when returning to play then, save game is not really the best option.
Image
B
75
S
23
G
3
Posts: 673
Reputation: 9,273

Post » Sun Jul 06, 2014 7:05 pm

With save/load, you don't have to save your entire project's state.

Mostly to reduce the clutter of it's savefile, make a couple families called "No Save OBJECTTYPE" and apply the behavior that prevents saving of that object's data. This way you don't have to record the exact location of all the sprites and static elements, saving the global variables and whatever objects you did not blacklist.

With webstorage, you just save a key to a value, sort of like a perma-dictionary key. You have to design your own events on what to load into where with this, but it's more of a whitelist option, where you choose what to save. The save/load basically uses this, but it's saving/loading code is already programmed into the C2 engine.

In the end they both function the same, data is saved and is kept until webstorage/localstorage is cleared.

So in summary, for saving games:
Save/Load = Blacklist
Webstorage = Whitelist
B
21
S
8
G
6
Posts: 346
Reputation: 4,891

Post » Wed Jul 09, 2014 3:07 pm

My game is quite large and I found that using save/load worked well and was super easy but after a load sometimes objects would disappear randomly and I have a feeling that somehow items were left as artifact UIDs... I don't know. I switched to a webstorage save system where I save only the arrays and variables that I need to save and things work much better. I just like having the control of what you are saving... Having said all of that, I think the save\load is such an amazing feature. It can work for a quick solution. (Why haven't I submitted a bug?... I use addons and I have an excellent workarround) For saving things like bindable keyboard key values Webstorage is a great choice too.
Image
B
36
S
14
G
11
Posts: 142
Reputation: 8,465

Post » Wed Jul 16, 2014 10:03 pm

Does anyone on this forum know how to save your game and highscore on a mobile device without it getting reset after you close the game? I've tried everything but nothing works, web storage, save/load and dictionaries.

It only saves during a session then it resets when you close and start the game upp again.

My game relies on this and right now I'm stuck. Am I the only one here making a game for mobile devices? :P

I usually always find a solution on all my problems but not this one. So if somebody can help me I would be super happy :D
B
52
S
22
G
12
Posts: 725
Reputation: 11,716

Post » Thu Jul 17, 2014 12:40 am

@Anonnymitet: With the webstorage use "Set local key" instead of "Set session key". Be also sure to load those data from the webstorage on start of a new game. Otherwise you are just overriding data without taking advantage of it.

Check out the How do I FAQ for further examples of use of webstorage in the "Webstorage" section.

It does work on mobile. You're not the first, not the only and not the last to do games on mobiles.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
284
S
109
G
91
Posts: 7,317
Reputation: 87,483


Return to Construct 2 General

Who is online

Users browsing this forum: Hiran Rodrigues and 5 guests