• AdrianTheFrog@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    17 hours ago

    I was looking at the savegames from the game control recently, it’s kinda funny because you open them in notepad, you see a bunch of random gibberish from bad decoding (the game uses a proprietary save format) with the words “collected” “Collected” “unlocked” “available” “VariableRestoreHack” (??) “STATE_B_PUZZLE_SOLVED” “Powercore_Not_Attached” randomly interspersed

    Like, surely there is a better way to store 2 state data other than an english word?

    It does generally get longer as you play, but also “locked” just switches to “unlocked” for example when you unlock something

    • SkaveRat@discuss.tchncs.de
      link
      fedilink
      English
      arrow-up
      5
      ·
      15 hours ago

      Eh, really depends

      They are likely just serializing a bunch of data objects. And set states and flags with humans readable enums

      Enums make code a lot easier to read, especially if you use it to check stuff all over the place

      Using to a couple bytes more storage is worth it

      • Echo Dot@feddit.uk
        link
        fedilink
        English
        arrow-up
        2
        ·
        edit-2
        13 hours ago

        I thought that enums were supposed to compile down to aa, ab, ac when you actually build the game.

        • SkaveRat@discuss.tchncs.de
          link
          fedilink
          English
          arrow-up
          4
          ·
          13 hours ago

          Depending on the language, they are.

          Lots of games also use data structures derived from tables/csv at runtime to configure things like stats. So they would also need these (human readable) values in the save files

          Hard to tell from speculation and not having the data

        • Natanael@infosec.pub
          link
          fedilink
          English
          arrow-up
          1
          ·
          12 hours ago

          Depends on optimization levels, data types, and whatnot. If it’s a string to be fed into the API of a different binary then the compiler will often not optimize down that representation. Internal function names are likely to be optimized that way, with lookup tables holding original function names (at least for any externally exposed function).