+1 vote

So in my project I use a .cfg file for storing options and unlocked achievments and it works perfectly fine. But when exporting the game the file (SaveFile.cfg) is created seperately from the .exe making it incredibly simple to just open up and edit.
If I add *.cfg to the export filter it seems to sort of work (the options that I've set are carried over, so the file must be there), but when the game is supposed to save something to the file it instead creates a new one seperate from the .exe.

If its relevant my functions for saving and loading look like this:

var savepath = "res://SaveFile.cfg"
var config = ConfigFile.new()
var load
repsone = config.load(save_path)

func saveValue(section, key, value):
config.setvalue(section, key, value)
config.save(save
path)

func loadValue(section, key):
return config.get_value(section, key, 0)

in Engine by (60 points)

2 Answers

+2 votes

I don't mean to sound rude, but have you considered simply not worrying about it? Players will pick apart your game in ways that you never expect. They will export your assets and read your code. They will use things like Cheat Engine to get infinite health, and achievement unlockers if you release your game on a platform like Steam. Even if you hide the save file somewhere, they will find it and they will create guides and tools to help people edit it anyway.

My recommendation would be to just let it go and not worry about it. Some people who go looking for the save file just want to make a backup copy, and by hiding it you would be denying that option to them. Your efforts are better spent on making your game into an excellent experience.

by (266 points)

There is a way to encrypt your save if you want to add an extra step.

The article:
https://docs.godotengine.org/en/3.2/tutorials/io/encrypting_save_games.html

But, as stated above, people will find a way and pick it apart if they really want to. People pick apart AAA titles, Indie titles will be cake work. Don't stress about it, if you can help it.

Thanks for that, I didn't know there was a built-in function to do this! You should post that link as an answer to this question so that it can be documented properly, since it technically is the actual solution.

+2 votes

There is a way to encrypt your save if you want to add an extra step.

The article:
https://docs.godotengine.org/en/3.2/tutorials/io/encrypting_save_games.html

But, as stated above, people will find a way and pick it apart if they
really want to. People pick apart AAA titles, Indie titles will be
cake work. Don't stress about it, if you can help it.

Moved to an answer as requested, Thanks and goodluck!

by (118 points)

Thanks, I'll try to see if I can make this work.
And yea of course people can find a way to cheat if they really want to, but I figured I'd at least not make it as easy as just opening a file in notepad and changing a few numbers.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.