• Advertisement
Sign in to follow this  

iso map and file size

This topic is 3765 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

sooo heres the deal right now i have my engine fully functional...everything works just fine... but.. my map files are huge... i have 4 layers terrain background middle foreground all of which are jagged arrays of objects so...if i have a map of 300x300 tiles....thats a lot of info to save out. the three upper layers have a lot of empty data but i wanted to keep the structure of the base map to make view culling easier. and each object in my terrain layer is unique because i want the terrain to be able to animate. soooo...any ideas of view culling or a better way to store a map? thanks!

Share this post


Link to post
Share on other sites
Advertisement
The file structure doesn't have to reflect the memory structure, so you could certainly use a sparse or flyweight representation in the file, and still use a full representation in memory. Or you could zip your map files and unzip them at loading time—the holes in the structure would most probably be factored away quite efficiently.

Share this post


Link to post
Share on other sites
yeah i was thinking about doing something like that...

save out to binary instead of xml...then zipping the binary data...

might take a bit to load the maps but hey...

Share this post


Link to post
Share on other sites
Quote:
Original post by nex7
...save out to binary instead of xml...


That should give you quite a bit of space savings right there.

Share this post


Link to post
Share on other sites
Since disk speed is much, much slower than CPU, just the fact that you're loading a lot less data will probably be faster than reading raw XML. Instead of, or in addition to using ZIP, why not write your files in your raw, binary representation?

Share this post


Link to post
Share on other sites
well im writing everything in c# and just using the c# serializer to save out all of my data.

a 50x50 map saved in binary is 1.5 meg
a 50x50 map saved in xml is 4.5 meg

both stupidly big for a 50x50 map..when im going to need much much much larger maps.

Share this post


Link to post
Share on other sites
I decided to write out the ID of the object and a hash of <ID,Item>

on load i still create my big array but the file size is tiny in comparison to what it was.

thanks for the help.

Share this post


Link to post
Share on other sites
Quote:
a 50x50 map saved in binary is 1.5 meg
a 50x50 map saved in xml is 4.5 meg


I think right here is saying that you are saving in some strange way. I have no idea what you're doing. I typically have a 32-bit reference to the ID of the graphic template which is in memory (though even a 16-bit reference is often enough, since thats still plenty of templates). This way, your map file will just be 4x4x50x50 or 39 KBytes for a 50x50 map. If you are not using much of the other layers, you can use a 8-bit variable to state which layers are used of the next tile (or more optimally, next two tiles, so you use all of the 8 bits). This way it is +8 bits for every tile, but -32 bits for every layer not used. I'm sure this can knock down your map files quite a lot, too. I think what we need to know is what the "layers" contain.

[Edited by - Spodi on October 30, 2007 9:07:51 PM]

Share this post


Link to post
Share on other sites
some strange way = serialization of the objects out to xml

just taking a shortcut that i now have to fix.

all of the data came from the actual internal structure of the object....they have attributes to describe rendering and AI and quests....and inventory ...and anything else you could think of...then there is animation sets for each object.

each object...tiles include...is animated and can have a list of attributes to describe the abilities.

so...all of that directly serialized to xml = very large files.

Share this post


Link to post
Share on other sites
There's no real reason to use serialization for a handful of arrays. Just read it and write it using BinaryReader/BinaryWriter. It's really easy and will be as small, or possibly smaller than it is in memory.

Share this post


Link to post
Share on other sites
the handfull of arrays are full of large objects instead of the byte type data to store an index...anyway i am serializing a light version of the objects which is a lot smaller....in game development ive found that you should never write out binary data because the files are un editable in the text editor...as soon as all of my maps are built i will bake them down to binary and compress that.

Share this post


Link to post
Share on other sites
the main reason i wanted to use object serialization is that i get instance data for free. all of the objects in my game have multiple stages of completion so i can store all of that information along with the data in the array if i just serialize the object.

Share this post


Link to post
Share on other sites
How well does the information compress? Test a few quicker algorithms, and see what the compress and, more importantly, decompress times are, along with the compression ratio.

Besides that, not sure what to offer, since you don't seem too keen on changing the file format.

Share this post


Link to post
Share on other sites
Oh i already did change the file format...

"I decided to write out the ID of the object and a hash of <ID,Item> "

so my map file is quite a bit smaller now...while the actual objects are still serialized out elsewhere...only instance data is being kept now....i made the mistake of serializing out everything before which kind of defeated the purpose of my editor...once i saved a region...it was stuck that way.

all said and done...the final output is around 11k binary

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement