Tue Nov 1 21:10:37 EST 2011

Z+ - File Format Considerations

Z+ will need to read and write world files. I think the correct option is to pack all the data into a single file and document the format. I considered using zipped directories with a custom extension, but decided against it. zziplib would let me use a renamed zip file as a world file, but it makes it very difficult to write out world files. Making a world a directory (like OSX app bundles) seems to be the backwards option. All it does is open the risk of losing pieces of the world when sending it around.

What I will probably do is write a sequence of tpl records to a file. If necessary, I can compress files with zlib. Because tpl records are self-delimiting, I can just spew out a sequence of them to a file descriptor and read them back one at a time. It also has support for storing binary blobs, so if I decide to allow the embedding of sound files, that becomes quite easy.

I'd like to follow the ZZT model of using the same format for world and save files. It means one less file format to document. On the downside, it means that storing assets in every save file creates a lot of duplication. I could not embed assets and instead use bloopsaphone for sound, I suppose, but that's another consideration for another time.


Posted by Jack Kelly | Permanent link | File under: zplus, coding