‹— back

cornucopia

Starting out with a fundamental thing that will be needed soon, so getting it done before the harder parts of the project :) A Writer interface and serialiser for the data storage format.

Right now we can read this language from a big string or a file, but not write our own. Later on it will probably be used for any save progress this game (or any other) may have, but it's definite use in this project is for saving and loading level files. Here's the pseudo-not-code:

A level with two stages, starting with five tiles, a player in the centre, and a sawblade ('explorer') coming straight for them.

When the next level phase is triggered (through a button press, timer etc.), the tile below the player disappears - if they haven't moved, they fall to their death ^^ and it also creates a different kind of enemy too.

Anyways it's not clear to me yet exactly how the stage changes will work internally (maybe it will recreate all tiles or something) but there will definitely need to be data in a file.

n.b. the other problem here is 'arrays of objects' which currently isn't a feature ... later!

The writer will eventually need to be able to edit things in-place, move, and merge objects. But for these needs we're just going to add basic writing of data to a file.

And here's how that turned out:

The top is the writer API, the bottom is the serialised output. It can write all of the basic types, including multiple objects from the root node and nested object children and stuff. There's a lot missing (aside from the other features mentioned, it needs to do stuff like validate keys properly).