Saving Chargen Data

Hey Folks! Still sorting out the bugs in character creation, focusing on the ability to save and load data generated during that process.

Now that chargen is creating social networks for the captain, career history, and other data, I need to bring the save file up-to-speed so it has that info, too. And that means a fair amount of code changes for reading/writing json data.

Json has a few limitations on the type of data it can store, so many of the in-game data types have a corresponding Json storage class. It tends to store more advanced data in simpler formats, by breaking them into basic types.

Fortunately, a lot of what I added in chargen data was almost already in these formats. So making storage containers was only necessary for a couple of them, and the read/write code was pretty straightforward.

Unfortunately, it's been a while since I tested save/load, and I think I've added quite a bit since then. Been finding several null pointer bugs in things like pathfinding, homeworlds, and social network that needed handling before save will even generate a file. And once I get all those fixed, I still have to verify it actually restored that info correctly.

In more exciting news, I made a few tweaks to the code so that it generates actual NPCs for each social contact now. And furthermore, I added the rest of the homeworlds to the system map. So in theory, social contacts will be wandering around one of the various stations in the system when the player eventually makes their maiden voyage.

Still no real narrative arc, and they won't travel or anything. But one step at a time.

It also looks like I have some more content review to do tomorrow. Both Michael and Emily sent revisions of their current work, so there should be some new stuff there soon!


matsy's picture

Sounds like an ideal candidate for you to be doing some unit tests!

ra1's picture

How did you handle "references" in Json?

dcfedor's picture

@matsy, I think the individual components are doing their job, but their integration into a bigger picture is the part in need of work. E.g. the JSON is being produced, but was it designed to have the right info?

That, and I sometimes skip proper error-checking when I'm trying to hack something together for a test. And that test is slowly calcified into a permanent system :)

@ra1, depends on the reference. An NPC on a ship, for example, is stored as a unique name, which refers to an NPC save-data json filled with per-instance data (current mood, location, goals). That, in turn, refers to an NPC template (appearance info, rules) jsons, condition jsons, interaction jsons, etc.

It's jsons all the way down :)

Dan Fedor - Founder, Blue Bottle Games