Could we have the .save file in a format which is easy to read.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shirish
    Rookie
    • Aug 2018
    • 23

    Could we have the .save file in a format which is easy to read.

    Currently the .save file is a mess . It is just a data file through which it's impossible to know, what if anything is wrong.

    Code:
    ~/games/angband-t4nk074/lib/save$ file Shirish 
    Shirish: data
    Code:
    $ cat Shirish 
    SaveVNLAdescriptionShirish, dead (Quitting)xxxrng�K�����&�ޕPzd'�̸�"l*IӶ7���,`��0�չ	��H�����k���?�]xݧ5 �5W�Sam�G"
                                                                                                                         &�n�T&��w���}	H����tc��W&��EUD<G�x`�Qл�)���G�A�s�ԲǶ܋d���X�-options���(nonerogue_like_commandsuse_soundshow_damageuse_old_targetpickup_alwayspickup_invenshow_flavorsshow_targethighlight_playerdisturb
    Wouldn't it be nice/better to have the save game as a .json or some readable file format. It would make it easier to understand what sort of info. the save file has and you can at least try to understand what went wrong if you want for analysis.

    Right now, don't think there's a way to do that unless there is some specialized tool that can read that stuff .

    Having it in some sort of json, xml format would make things lot more simpler and also extensible if need be.

    There is possibility I may be missing something obvious, if it is, would be glad to be pointed out.

    I am willing to test and give feedback if anybody is prepared to do something like that.
  • takkaria
    Veteran
    • Apr 2007
    • 1951

    #2
    To be honest I think it would be a lot of work for limited use. The savefile code is pretty straightforward, and quite extensible already. Debugging what is going on in it isn't that hard. The savefile also stores a lot of binary data and it would be really inefficient to encode it in a text-based format like XML or JSON. I'm not sure what actual advantages it would offer.
    takkaria whispers something about options. -more-

    Comment

    • Pete Mack
      Prophet
      • Apr 2007
      • 6883

      #3
      Well it lets you cheat more easily. More seriously, json does not make sense for a language without first class objects (like C or C++) where you can't serialize objects via reflection. You would have tk write your own serialization code, which pretty much defeats the purpose.

      Comment

      • Derakon
        Prophet
        • Dec 2009
        • 9022

        #4
        Having a human-readable file format would be preferable, all else being equal, to the current binary format. Human-readable files are easier to debug, inspect, and of course modify. But someone would have to implement it.

        shirish: if your goal is modifying the save file, a lot of common operations (like editing stats, experience level, and equipment) can be done via the debug commands. I'm not aware of good documentation for them, but this portion of a Let's Play has a few examples.

        Comment

        • shirish
          Rookie
          • Aug 2018
          • 23

          #5
          Originally posted by Derakon
          Having a human-readable file format would be preferable, all else being equal, to the current binary format. Human-readable files are easier to debug, inspect, and of course modify. But someone would have to implement it.

          shirish: if your goal is modifying the save file, a lot of common operations (like editing stats, experience level, and equipment) can be done via the debug commands. I'm not aware of good documentation for them, but this portion of a Let's Play has a few examples.
          Cheating is a good side effect but for me, it is more of how to retain character information and progress before death. From what I recall of my playthrough several years ago, it is/was easy to die i.e. permadeath.

          The save file as it is hard for me to know what level I am, what quests are there (if there are any) , my armor and various bits of information. Having such information is and would be gold in an easy to read manner.

          It might also tell if there are any 'secrets' in any room I am or are left or something like that.

          It would make it also easier for people to share save files and exchange info. (copy and paste) rather than having to write each and everything.

          I do hope it makes sense.

          Comment

          • takkaria
            Veteran
            • Apr 2007
            • 1951

            #6
            Originally posted by shirish
            Cheating is a good side effect but for me, it is more of how to retain character information and progress before death. From what I recall of my playthrough several years ago, it is/was easy to die i.e. permadeath.

            The save file as it is hard for me to know what level I am, what quests are there (if there are any) , my armor and various bits of information. Having such information is and would be gold in an easy to read manner.

            It might also tell if there are any 'secrets' in any room I am or are left or something like that.

            It would make it also easier for people to share save files and exchange info. (copy and paste) rather than having to write each and everything.

            I do hope it makes sense.
            I think a savefile is very unlikely to have most of that information that you want to see in a human-readable way anyway. Remember that a savefile is a thing that exists for the game to be able to restore itself after it is shut down. Your equipment list would just be a ton of different numbers referencing other places (the gamedata files). The dungeon layout wouldn't be saved in a way that was understandable, neither would what monsters there are or where they are. The files themselves would also be many megabytes in size, or they would be stored compressed for efficiency, in which case you'd have to uncompress them first. (I know because years ago someone did start implementing a more human readable key-value store for savefiles and this is what happened.)

            I wonder if what you want is a better way to choose between different saved games that gives you an indication of a given savefile's current status before you load it? Or maybe an autosaved character dump alongside each savefile that gives you the kind of information you want in a human-readable format?
            takkaria whispers something about options. -more-

            Comment

            • shirish
              Rookie
              • Aug 2018
              • 23

              #7
              Originally posted by takkaria
              I think a savefile is very unlikely to have most of that information that you want to see in a human-readable way anyway. Remember that a savefile is a thing that exists for the game to be able to restore itself after it is shut down. Your equipment list would just be a ton of different numbers referencing other places (the gamedata files). The dungeon layout wouldn't be saved in a way that was understandable, neither would what monsters there are or where they are. The files themselves would also be many megabytes in size, or they would be stored compressed for efficiency, in which case you'd have to uncompress them first. (I know because years ago someone did start implementing a more human readable key-value store for savefiles and this is what happened.)

              I wonder if what you want is a better way to choose between different saved games that gives you an indication of a given savefile's current status before you load it? Or maybe an autosaved character dump alongside each savefile that gives you the kind of information you want in a human-readable format?
              the latter info. would be quite nice, thank you.

              Interestingly though, could you share some more info. or point out to threads about the human-readable save file initiative which was done ?

              Comment

              • takkaria
                Veteran
                • Apr 2007
                • 1951

                #8
                Interestingly though, could you share some more info. or point out to threads about the human-readable save file initiative which was done ?
                I'm afraid not, it was done years ago on an IRC channel for which logs are unlikely to still exist.
                takkaria whispers something about options. -more-

                Comment

                • shirish
                  Rookie
                  • Aug 2018
                  • 23

                  #9
                  that is a pity

                  Comment

                  • takkaria
                    Veteran
                    • Apr 2007
                    • 1951

                    #10
                    Also, if you're on Linux you can get some basic information about what savefiles you have with ./angband -l (I think, anyway).
                    takkaria whispers something about options. -more-

                    Comment

                    • AnonymousHero
                      Veteran
                      • Jun 2007
                      • 1393

                      #11
                      I've actually tried something very similar, and I was actually surprised that (at least with the libraries I tried) JSON serialization actually adds a considerable overhead to just writing out the save game data compared to the current situation. (My experiment was in ToME 2, but I'd assume it's pretty similar in Angband -- I don't think the code has changed that much.)

                      Some of this has to do with the absurd overhead of serializing e.g. each dungeon tile as individual strings, etc., but...

                      Comment

                      • Pete Mack
                        Prophet
                        • Apr 2007
                        • 6883

                        #12
                        Amusing story: originally thw bing search engine did all its anysis on json or a similar format, but a performance analysis showed it was spending 50% of CPU time in binary-decimal interconversion, and a bunch more time just parsing the files. It is a prohibitively costly format for large datasets.

                        Comment

                        Working...
                        😀
                        😂
                        🥰
                        😘
                        🤢
                        😎
                        😞
                        😡
                        👍
                        👎