ravenzachary / Far-Horizons

Far Horizons is a strategic play-by-email (PBeM) game of galactic exploration, trade, diplomacy, and conquest. This repository contains the game engine source code.
GNU General Public License v2.0
3 stars 3 forks source link

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

Open ravenzachary opened 3 years ago

ravenzachary commented 3 years ago

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.

ravenzachary commented 3 years ago

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]

mdhender commented 3 years ago

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 :(

ravenzachary commented 3 years ago

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? : )

mdhender commented 3 years ago

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