jasonjie88
302 posts
|
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.
|
Draco18s
6860 posts
|
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.
|
Drakim
1139 posts
|
Wait, are we talking about RAM memory usage or file size memory usage here?
|
Ace_Blue
1071 posts
|
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.
|
skyboy
6261 posts
|
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
|