In order to write Tiled’s TMX file format I needed to do exactly this: figure out how to compress data, encode it as a string, and write it to XML.

I wrote down what I learned from using zlib, base64 and xswi – XML Stream writer for iOS (a single Objective-C class) while writing KoboldTouch‘s TMX writer.

I split it into two articles in the Essential Cocos2D section of the www.KoboldTouch.com homepage:

I was positively surprised how relatively painless zlib and base64 encoding worked (I expected the worst!) and how simple and effective xswi is for writing XML compared to any other XML library.

I’ll probably continue to add those articles to Essential Cocos2D rather than posting them on this blog. Confluence is just so much more convenient for writing technical documentation than WordPress.

Final word: Enjoy! :)

Tagged with: