Comment by trinix912
1 day ago
Putting the (very valid) reasons for not having human-readable game saves aside, are you sure it's worse than using a 3rd party library that's built to accept semi-valid input values, possibly evaluates user input in some way and has difficult to debug bugs that occur only under certain inputs? I agree that writing a stable and safe parser for a binary data file isn't easy, but there's less things that can go wrong when you can hardcode it to reject any remotely suspicious input. Third party XML/JSON libraries OTOH try to interpret as much as possible, even when the values are bogus. Also no need to deal with different text encoding bugs, line endings...
You misunderstood. Game developers should use a _good_ third–party library, not a _bad_ one. At a minimum they should be able to read the source code so that they know it is good. Thus open source libraries should be at the top of the list.
If you don't know what “good” looks like, take a look at [Serde](https://serde.rs/). It’s for Rust, but its features and overall design are something you should attempt to approach no matter what language you’re writing in.
There are no good third party libraries
I disagree. Serde is not merely good, it is excellent.
The only C code that I have recently interacted with uses a home–grown JSON “library” that is actually pretty good. In particular it produces good error messages. If it were extracted out into its own project then I would be able to recommend it as a library.
3 replies →
> Putting the (very valid) reasons for not having human-readable game saves aside,
I don't follow. What would the reasons be?
A human-readable game save file is presumably human-editable.
Most binary save game files are human editable, too; unless they go through a separate encoding stage.
2 replies →
Require a hash in the file to match the rest of the file if you want to avoid effortless changes to the file.
(There is no way to prevent changes by a knowledgeable person with time or tools, so that's not a goal)
Before game companies earned all their profit through selling cosmetics and premium currency nobody cared if you cheated at your single player game and nobody SHOULD care if you want to give yourself extra money.
It's only now that single player progress is profitable to sell that video games have taken save game encryption to be default.
It's so stupid.
3 replies →
Mostly to prevent people and programs from editing them, obfuscating implementation details, reducing file sizes (say had they used XML vs. binary)...
Higher barrier to cheating.
It's a single player game. Cheat codes are built into it by design.
HESOYAM