Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Local Storage is shared between games

A topic by Pipo created Feb 15, 2023 Views: 367 Replies: 3
Viewing posts 1 to 4

I've tested this by printing the local storage itself from the game, and I can see the entry of other games made by me.

I'm not sure if the local storage is also shared between games of different authors.
If u have done a game that uses local storage let me know so I can also test that!


This was already pointed out in this archived post: https://itch.io/t/1158456/html5-local-storage-seems-to-be-shared-between-multipl...

Of course this is an annoying issue, especially if the local storage is shared between every author

(4 edits) (+1)

Interesting, I never noticed it, but it seems you're right. I looked at the local storage for the itch.io address (https://v6p9d9t4.ssl.hwcdn.net/), and there seem to be entries for a lot of different games (including three of my own). This might explain some storage-related bugs that people are reporting. I notice one key (not from my own game) is just "gameJSON" - that might easily cause some clashes!



I guess the conclusion for now for developers is to use better keys, like gamename.valuename instead of just valuename, and to keep the size of the data in mind.

By the way if you want to test: I have three WebGL games that use localStorage: Ostark & Didi, Robo Repair and Trading with Werewolves - just click on my profile to find them. (They only add very little data to the local storage, so don't worry about the 5MB limit.)


EDIT: this does open up some fascinating possibilities for cross-game progress: for instance, if you unlock the FIREBALL in Vampire Survivors, you get it in my game too... :-D

EDIT2: ...or if you're up for using some very questionable marketing strategies: "play my game - as a bonus you unlock all characters in Vampire Survivors!" Hm...

Ahaha that would be interesting, if it was a per author thing it could be good, or if it was possible to specify that it is shared with some specific games, even of other creators if they accept that!

This also could lead to some privacy issues of people creating games just to see what your local storage holds.