XML decompression?

Subscribe to XML decompression? 5 posts

avatar for jasonjie88 jasonjie88 302 posts
Flag Post

I use XML files to store my level arrays, because I hear it saves memory, and they can be separately loaded as opposed to loading everything in one go. But I’ve got more than 300 arrays to store in XML files, and I’m going to load multiple XML files on levels. I am also scared of how much memory the XML files may take up. So I wanted an alternative solution, like compressing the XML files and decompressing them when needed. I have heard decompression can be done in Python, but I’ve never seen it done on Actionscript 3.0, so I was wondering if there is a possible way.

 
avatar for Draco18s Draco18s 6860 posts
Flag Post

First off:
Google “AS3 zip file API

Second off:
That’s not actually going to help you any. What you should be doing is loading in the XML for the current level and the current level only. And when you’re done with it? Unload it.

 
avatar for Drakim Drakim 1139 posts
Flag Post

Wait, are we talking about RAM memory usage or file size memory usage here?

 
avatar for Ace_Blue Ace_Blue 1071 posts
Flag Post

I find XML files to be a waste of space. Serialize your levels into ByteArrays and store that, you’ll get compact, efficient files that load and save fast, and you’ll minimize you memory usage. ByteArrays can even be compressed if disk space is really that much of an issue (are you shipping files back in time to my C64 in 1982?) The only reason to use XML is if you want to modify the file by hand outside of your program, say with a text editor.

 
avatar for skyboy skyboy 6261 posts
Flag Post

Originally posted by Ace_Blue:

I find XML files to be a waste of space. Serialize your levels into ByteArrays and store that, you’ll get compact, efficient files that load and save fast, and you’ll minimize you memory usage. ByteArrays can even be compressed if disk space is really that much of an issue (are you shipping files back in time to my C64 in 1982?) The only reason to use XML is if you want to modify the file by hand outside of your program, say with a text editor.

JSON is also a valid replacement for XML; smaller, still editable by hand, and it’s faster to parse and access properties of. it’s also less of a leap for someone who doesn’t know how to compress/decompress data in AS3