I´m currently building a game that is meant to be played via browser.
The game itself is most likely stored on something like S3.
Now to my problem… Since there´s a progression system with badges and achievements it would be bad if people deleted all their progress but deleting their browsercache/cookies.
I can see three ways and would love to discuss about possibilities to make that work.
Is there a way to save stuff on the local machine (not in saved to browsercookies) of the user and load it in after playing again via browser?
is it possible to make an exception for browsers to exclude certain domains from clearing cache/cookie? (you can manually delete cookies one by one. Didn´t find a function to just make an exception for one single site)
How would I go on if both methods don´t work and I´d have to build a web/server based solution? I didn´t do anything like that before and I´m afraid it also might exceed my skills since my knowledge about servers, java and so on is… well not existing currently.
I´d also gladly work with a site like itch.io and so on, but as far as I can tell there´s no way for these sites to save the data on their servers.
There is no way to prevent browser data from being deleted by the user from their own machines and browser vendors tend to make it easy to delete stored data over privacy concerns. With that said, if you are going to go this route, indexedDB would be better than cookies. IndexedDB can still be cleared when the user flushes their browser history (in most browsers) and more importantly, it won’t work at all when the user is browsing in private mode though so it doesn’t really solve your problem.
What I would suggest instead is to look into whether the sites that will be hosting your game have an option for private leaderboard statistics. These are basically leaderboard stats that your game passes up to their server, and has access to through the site’s javascript api but won’t show up on the leaderboard that the users see. I can’t speak to itch.io specifically as I have not personally used it, but similar types of sites such as Kongregate do have this feature. It sounds to me like that is what you are looking for. The main downside is that it will limit where you can post your game to the sites that have this feature.