Json json json json beans json...

Hey Folks! Sorry in advance for the less exciting post today. I actually did quite a bit of coding, even going as far as closing email and other non-essential apps to focus. But it's not anything to look at, really, unless you like data.

Json data, that is :)

To-date, all of the data in the game is already stored in Json format, so this isn't anything new. And for those wondering, it's a text format similar to XML, just a bit less awkward to work with (so it works well for modding). And since there's a lot of prebuilt stuff out there for loading/saving in that format, that's the format I'm using for now.

That said, everything I've been loading/saving so far is raw data. Data that can be used to generate new objects without any history. Like spawning a new hammer, identical to every other new hammer in the game. A blank template, basically.

What I need, in order to start saving and loading game state, is a step further. I need to know which template the item came from, but also everything that's changed since it was spawned. Has it been damaged? Did something get attached to it? Is it someone's favorite hammer?

That's where today's work comes in. I've been plowing through almost every major class in the game, making special Json data types for storing this info. Jsons for ship situational data. Jsons to record current celestial object positions. Jsons for everything Crew has attempted to satisfy their needs, and the results (their experience and memory, basically). Jsons for the current partial pressures of rooms on the ship, after days of atmo pumping.

So far, I've got just about every class I need half done. The half that creates a Json file based on their data. I've just started working on an overall save game function that gathers all of this info and generates files to store it.

Tomorrow, I'll get started on the other half. The part that reads this data in again. This is where the rubber meets the road. So far, I haven't actually launched the app to test anything. But once I can both save and load data, if any errors are awaiting, this is where they'll be. Could be a grueling day :)


matsy's picture

Good choice to go with Json over XML. Is this lessons learnt from Neo Scavenger? I've recently moved away from XML to Json because of serialisation issues.

dcfedor's picture

I think the biggest reason is convenience. Json was the fastest to setup.

But yeah, NEO Scavenger also pushed me away from XML a bit. There's a lot of extra fluff in XML files, and they're a bit harder to read/write for humans.

Dan Fedor - Founder, Blue Bottle Games