Advice about saving complex data (Minecraft-like game)

Hey everybody. Lately, I’ve been writing a voxel engine for Unity, very similar to Minecraft. It’s coming along very well, and I’m writing the engine separately from my game, so I will release the engine on the asset store when I feel it’s ready.

I’ve been thinking about how I will be saving data. The world is generated pseudorandomly, meaning that the same seed will generate the same world every time. Because of this, only the blocks that are changed by the player must be saved. The world is broken up into smaller “chunks” of terrain. Like Minecraft, the world is infinite, and chunks are generated as the player explores.

Minecraft saves chunks in “regions”, which are just large groups of chunks. I’m thinking that would be a good approach. Each block is stored as a byte and can be accessed via a 3 dimensional byte array. So I need to save which blocks have been changed in each chunk. But I’ve never had to save any custom data. I’ve always used playerPrefs, but I don’t think that’s an option here. I know you can use xml files to save some things, but I don’t know much about that. I was just wondering if anyone had some good ideas? Any help would be greatfully appreciated.

The format doesn’t matter. If this is not web-based, you can use .NET file and stream classes to read/write whatever data you like (binary I would think).