I'm combining elements from two very different projects I started..
, I originally used XML as the save file format, because while it is probably the worst format ever designed, it's what other projects used, and subsurface wasn't originally really capable enough to stand on its own.
Now, I did the best that I could with XML, and I suspect the subsurface XML is about as pretty and human-readable as you can make that crap, but it really doesn't scale as a file format, and it's generally a complete disaster.
So me and +Dirk Hohndel
(who maintains subsurface, I long since gave up that role) have been idly talking about better save formats for months now. But binary formats are evil and generally not extensible, and besides, you want replication and network transparency, plus the ability to combine dives from many different sources. Binary blobs are just horrible for all of these things.
So I've wanted to use the +Git
object database format, because it's actually very well designed if I say so myself. Not only does efficient deduplication and compression, it has the advantage that it still does a really good job at line-based textual representations, while allowing a very natural representation of multiple different events as separate files, with git itself tying it all together.
And you get backups and history for free, plus a lot of tools to look
at it all, seeing readable diffs for format changes or just new dives etc. In fact, both I and Dirk ended up already using git to track our XML files, because of these issues, but it wasn't very nicely integrated.
So I've been thinking about this for basically months, but the way I work, I actually want to have a good mental picture of what I'm doing before I start prototyping. And while I had a high-level notion of what I wanted, I didn't have enough of a idea of the details to really start coding.
Until a couple of days ago, when everything came together.
So now I'm happily hacking on a new save format using "libgit2", and apart from the git_treebuilder interface being horrible I think I'm making good progress.