Angband Forums

Angband Forums (http://angband.oook.cz/forum/index.php)
-   Development (http://angband.oook.cz/forum/forumdisplay.php?f=10)
-   -   Could we have the .save file in a format which is easy to read. (http://angband.oook.cz/forum/showthread.php?t=9081)

shirish September 27, 2018 16:08

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 September 27, 2018 17:15

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.

Pete Mack September 27, 2018 17:22

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.

Derakon September 27, 2018 17:25

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.

shirish September 27, 2018 18:03

Quote:

Originally Posted by Derakon (Post 133499)
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.

takkaria September 27, 2018 20:40

Quote:

Originally Posted by shirish (Post 133501)
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?

shirish September 28, 2018 00:52

Quote:

Originally Posted by takkaria (Post 133504)
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 ?

takkaria September 28, 2018 01:32

Quote:

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.

shirish September 28, 2018 17:08

that is a pity :(

takkaria September 28, 2018 18:23

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


All times are GMT +1. The time now is 20:22.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.