Comment by trinix912

Comment by trinix912 2 days ago

21 replies

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...

db48x 2 days ago

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.

  • vinyl7 2 days ago

    There are no good third party libraries

    • db48x 2 days ago

      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.

      • trinix912 2 days ago

        But how is that C project using a custom made JSON library doing better than Rockstar games doing the same? Because that library has good error messages?

        Apart from that, many of us thought that Java serialization was good if just used correctly, that IE's XML parsing capabilities were good if just used correctly, and so on. We were all very wrong. And a 3rd party library would be just some code taken from the web, or some proprietary solution where you'd once again have to trust the vendor.

hattar 2 days ago

> Putting the (very valid) reasons for not having human-readable game saves aside,

I don't follow. What would the reasons be?

  • gsinclair 2 days ago

    A human-readable game save file is presumably human-editable.

    • RHSeeger 2 days ago

      Most binary save game files are human editable, too; unless they go through a separate encoding stage.

      • hermitdev a day ago

        Editting simcity saves was my introduction to hex editing...

    • kadoban 2 days ago

      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)

    • mrguyorama 2 days ago

      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.

      • keyringlight a day ago

        The trouble is that if some weirdness happens because of the edit, you've got to handle it even if you say it would be reasonable to assume that it's outside of being supported. Maybe you spend a bit more time defensive coding around what inputs it reads from the file, maybe a certain proportion of users doing the save edit see bugs in an apparently unrelated part of the game and seek support (and their bug report might not be complete with all the details), developers spend time to chase down what went wrong, maybe they bad-mouth it on forums which affects sales - there's going to be some cost to handling all of that.

        One of the anecdotes from Titan Quest developed by Iron Lore is that their copy protection had multiple checks, crackers removed the early checks to get the game running but later 'tripwires' as you progress through the game remained and the game appeared to crash. So the game earned a reputation for being buggy for something no normal user would hit running the game as intended.

  • trinix912 2 days ago

    Mostly to prevent people and programs from editing them, obfuscating implementation details, reducing file sizes (say had they used XML vs. binary)...

  • [removed] 2 days ago
    [deleted]