encrypted save

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Divinity
Prole
Posts: 7
Joined: Thu Nov 21, 2024 2:23 pm
Location: Portugal

encrypted save

Post by Divinity »

I was wondering what would be a good approach to handling save/load data?
Can you encrypt those files? I heard it's really easy to open the source of LOVE projects, so i imagine it would be easy for users to cheat by editing the save file variables (?)
poof()
MrFariator
Party member
Posts: 559
Joined: Wed Oct 05, 2016 11:53 am

Re: encrypted save

Post by MrFariator »

You can do some simple obfusctation on save files, sure. It could even be as simple as just taking the table tracking your save data, and dumping it into a file with a serializer like bitser (awesome-love2d repo has a few other options), which will result in a file that isn't exactly human readable. This can stop an average user from just opening the file and modifying it... But then they can also potentially just use cheat engine, or share save files between players.

Even if you somehow (successfully) manage to obfuscate the source code regarding your save file management, a knowledgeable hacker could always just bypass your encryption with some work. It'll mostly be a losing battle, so my advice is just to not worry about it. The only exception may be an online multiplayer game, where it's likely better the server stores the saves rather than the client.
User avatar
dusoft
Party member
Posts: 654
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: encrypted save

Post by dusoft »

You can try binary as that's harder to crack. But similar to MrFariator, I would recommend against doing that. Just let your players enjoy hacking their save games if need be.
User avatar
darkfrei
Party member
Posts: 1204
Joined: Sat Feb 08, 2020 11:09 pm

Re: encrypted save

Post by darkfrei »

Make the hash sum by the saving and recalculate it by the loading. If cheat, make the game harder and keep the hash wrong.
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
RNavega
Party member
Posts: 385
Joined: Sun Aug 16, 2020 1:28 pm

Re: encrypted save

Post by RNavega »

dusoft wrote: Sun Dec 01, 2024 7:53 pm Just let your players enjoy hacking their save games if need be.
I'm also for this. Interpret it like opening your game up for modding to let your customers tweak it and enjoy it more, even if that means letting them have "infinite gold coins" or whatever it is that they're going to change.

(You could argue against it if you're making a game with in-app-purchases / pay-to-win scheme.)
User avatar
dusoft
Party member
Posts: 654
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: encrypted save

Post by dusoft »

Just a quick example: Sunless Sea is a mix adventure/RPG game where you navigate your boat through the story. However, keeping boat stats up such as fuel etc. get tedious over time, specifically when there is story behind it. Fortunately the game was using JSON format for their saves. So I just edited this JSON to have unlimited fuel and other items needed for boat driving to progress easier, however I kept other important story stats unchanged to enjoy the story.
User avatar
dusoft
Party member
Posts: 654
Joined: Fri Nov 08, 2013 12:07 am
Location: Europe usually
Contact:

Re: encrypted save

Post by dusoft »

RNavega wrote: Mon Dec 02, 2024 7:04 am
dusoft wrote: Sun Dec 01, 2024 7:53 pm Just let your players enjoy hacking their save games if need be.
I'm also for this. Interpret it like opening your game up for modding to let your customers tweak it and enjoy it more, even if that means letting them have "infinite gold coins" or whatever it is that they're going to change.

(You could argue against it if you're making a game with in-app-purchases / pay-to-win scheme.)
In this case you will want to keep your saves/records on a server anyway and only sync it to a client.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 13 guests