Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

How to save data?

A topic by Defentures created Oct 11, 2018 Views: 6,445 Replies: 12
Viewing posts 1 to 6
(+1)

Hello!

How I can save data on itch.io ? Cookies, Local storage is bad idea,  cause uploading a new build of your game changes the path it lives on.

So what to do?

Admin(+3)

We don't have a really good solution for this right now, but we are considering providing some of kind of API that does server side storage, or adding an option for games to re-use existing path. How much storage do you see yourself using?

Hi! it's enough for me to have a player login. So I can use PlayFab to store data.

As I understand now I can't get player login from my webGL game running on itch.io.


If I will not use PlayFab, I need 20-30kb per player to store all saves on itch.io.

(1 edit) (+2)

Hello! Any progress since you posted this? Right now there's no way for games to store anything reliably unless we force players create an online account with some third party, which makes me sad :(

I have not solved the problem and use playfab. It is still very uncomfortable.

But maybe something has changed since that time, I don't know.

And what service do you use?

None, just localStorage. Updates will nuke people's highscores and settings, which gives people a reason to buy the desktop version I guess...

@FrozenFractal, can't see why that would be, you can make people login with Itch and get their account information (unless you consider Itch to be third-party relative to your game).

(+1)

You can use Firebase (and they have a free tier to get started) but you won't have the benefit of integration with itch.io's login system.  Users will have to create a new account, specifically for your game.

I already use PlayFab to save data. But I don't want  users to create a separate account. Very convenient to use one user name in itch.io and game. And login user in PlayFab automatically. That's why integration with itch.io's login system will useful for me.

Yes, what's really needed is for Itch to provide a signed token giving the user's account ID (and possibly other details if the user agrees to share them).  I know there is a way to use such a token with Firebase and probably there is with PlayFab too.

A related problem is that there is no way for an HTML game to know if the user has paid.  I will soon be uploading a new version of Gwen which will be chargeable after a short taster.  It interfaces with PayPal entirely on its own because while I could set the game page to accept payments, there is no way for the game to be notified of them.

Can I get some clarity here: I have a web game hosted at https://codedread.itch.io - I understand that underneath it's an iframe (https://html-classic.itch.zone/html/(some number)/ as I update my web game, am I likely to lose that underlying origin such that anything stored in IndexedDB is lost?

(+1)

I don't know if the iframe URL is likely to change, but one thing you can do is redirect the user to a domain you control.  You upload a single HTML file to Itch, which contains some Javascript that redirects to the URL where your game is actually hosted.  You can choose to change only the iframe URL, in which case the game will still be embedded in your Itch page, or you can redirect the whole page when the user clicks the Play button.

One recent nuisance is that Safari has started deleting sites' saved data if they're not used for a week (for "privacy").  There may be additional restrictions on iframes in Safari and other browsers—I vaguely remember something about that, because of them being used for cross-site tracking.  To avoid all this, I'm moving saved games to the server, and I'm working on a system which will provide one-click sign-up with no personal data collection.  There's no reason why I shouldn't make it available to other people too, once it's done, so if you'd be interested in this route let me know and I'll keep you updated.

I like your idea, but upon testing it, unless I redirect the entire page to my host, the IndexedDB instance is not shared, despite the iframe hosted at itch.io pointing to the same site. This was surprising to me.

I'd rather keep the itch.io link stable.  I think I'll cross my fingers that itch.io doesn't change the underlying iframe host they control. I use the Google Drive API to host saved games so that's also an option for players.