About local storage...

Post » Thu Nov 02, 2017 2:32 pm

In my game I have a highscore and it's saved to local storage.

When I remote preview my game it saves etc. and when I reset my web cache on my phone the highscore resets to 0.

Will this happen with the final app? Will things saved to local storage be reset when the user empties their cache or is it saved differently as it's not being viewed in a web browser?
B
9
S
3
G
3
Posts: 98
Reputation: 2,373

Post » Thu Nov 02, 2017 10:34 pm

Local storage (and the save behavior) is indeed stored in the browsers app cache, so it will be possible to be wiped manually. This is normal and fairly common, such as on many phone games if you wipe the app cache, it will be reset as if you just installed it.

You'll need a cloud service or some sort of web data storage to back up away from the users device if that is your intention.
Mistakes were made.
B
54
S
28
G
115
Posts: 1,705
Reputation: 65,083

Post » Thu Nov 02, 2017 11:21 pm

OK - so (for example) the CandyCrush app on my phone saves my score to a server rather than some sort of data file on my phone?

And am I right in thinking everyone who uses Construct to create games that have highscores save these scores on a server somewhere?
B
9
S
3
G
3
Posts: 98
Reputation: 2,373

Post » Thu Nov 02, 2017 11:29 pm

I'd say there are many cases that use both methods, rather than saying everyone saves on a server or local cache only.

Generally speaking, local cache is pretty reliable. The user has to go out of their way to delete it, and if they know how to do that then they should understand the ramifications as well.

Regarding cloud storage, there are different levels of solutions for that as well. You could build an entire database server with a firebase backend for your app, or you could use Google Play Services, which will store at least high scores for your app just fine.
Mistakes were made.
B
54
S
28
G
115
Posts: 1,705
Reputation: 65,083

Post » Thu Nov 02, 2017 11:47 pm

Ok cheers. More to think about, just as I thought I was getting to the end of this game. Blegh.

Out of interest, how would a mobile user actually delete their game cache? I’m guessing that even though we’re building these games in Html5 etc they’re not played within the browser but as an actual app, is this correct? So simply emptying their browser cache wouldn’t delete any data would it?
B
9
S
3
G
3
Posts: 98
Reputation: 2,373

Post » Thu Nov 02, 2017 11:59 pm

For a phone app, it is separate from their browser app cache. They would need to go into settings, app setting, your app name, delete cache, and confirm.

If they access your game through a web browser though, then deleting the cache for that browser will delete the data.

Most well developed games (I believe) use both systems. For example, popular gatcha/lottery games like Puzzle and Dragons will store user data locally in the cache, and allow you to register an account to back up your data online. This is usually taken advantage by users who want to "reroll" their starting character, by not registering until they get their desired roll. They do this by clearing their cache to reset the game, and get another free roll from the tutorial or something like that.
Mistakes were made.
B
54
S
28
G
115
Posts: 1,705
Reputation: 65,083

Post » Thu Nov 09, 2017 3:57 pm

oosyrag wrote:For a phone app, it is separate from their browser app cache. They would need to go into settings, app setting, your app name, delete cache, and confirm.

I was testing one of my game awhile back (viewtopic.php?f=147&t=189715&p=1118343#p1118343)
and it seems like the local storage data reset as I replace the app with a new version (it's not on app store, i'm just dragging it to my itune in this case).

And what was even weirder is that if I port using Cocoon.io. The local storage data reset whenever I close the app and reopen again. It was fine with Intel XDK which went out of commission from what I understand. I'm not too sure what to use at the moment too since I was off the book for a little bit now.
B
20
S
5
Posts: 14
Reputation: 1,178


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest