ravenzachary/Far-Horizons

Use text data files or a database instead of binary flat files

ravenzachary opened this issue · 4 comments

The Far Horizons code stores data in binary flat files making it extremely difficult to change data post-game, whether that be empires, stars, or other game attributes. Move to using JSON files (or something similar), or use a real database.

Having ASCII data files in a format such as JSON would allow a GM to fix an error in the game code manually or fix some order syntax error for a player if an order failed.

The following binary data files were created in the game/ folder at game start:

HS3, HS4, HS5, HS6, HS7, HS8
galaxy.dat
locations.dat
planets.dat
stars.dat
sp##.dat [one file for each player, such as sp03.dat]

There are a few get/set functions scattered through the code that read/write the file. It should be possible to update them to use JSON or YAML.

There's also a set of programs to convert binary to ascii and back. The output looks like space delimited records. It looks like it uses the get/set functions from above.

There seem to be some programs that have their own get/set that maybe duplicate the same functionality. Would be worth going in and de-duping the code base. Of course, that's safer after tests get written :(

My sense is that it would be better to have you finish the Go port with the JSON data files and leave the C code as an historical archive? : )

A lot less rework, but it will take me a while to finish.