EDITOR’S NOTE: This is part of a series, start here.
When I initially thought about doing this, I figured I’d persist the galaxy in some form of binary (or even plaintext) JSON file. This has a lot of advantages: JSON is easy to edit, simple to work with programmatically and requires very little overhead. It also has a lot of disadvantages, at least for my purposes: Things like loading and saving game states requires doing a bunch of object serialization/deserialization. I’d also have to be querying the DOM constantly and popping things in and out of data structure, which is difficult and error prone. There are solutions to these problems, but I didn’t like any of them.
In the end I decided to use SQLite, the world’s most adorable RDBMS system. Databases live in single files and can be read/updated with SQL. This allows me to update the “save” file in real time. This is great, because I really didn’t like the idea of “save states”. That whole idea feels wrong for this game.← Xoth Devlog Pt. 6 Xoth Devlog Pt. 8 →