Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to create an arbitrary sized(but not infinite) 2d tilebased world. My question is, how do i save a world like this?

My idea was to split up the tiles into bigger chunks and then save those seperately. Let's say you have a world of 5000x5000 tiles, each chunk would be 50x50 and saved in a seperate file. This leaves me with 10000 seperate files, which does not seem optimal. Is there a better way?

share|improve this question
up vote 0 down vote accepted

This is usually ideal - you can also further decide to split things into 'regions'. This is pretty similar to how Minecraft does things and you can probably learn a lot from just examining it. Splitting it into multiple file sis ideal because while it does incur a penalty for opening the file still, it makes things manageable and prevents large seeking times on a single large file on slower drives. You can read up on this post here for more information on the method. Essentially, what you had in mind is a good idea - just try and minimize chunks into optimal amounts. Good luck!

share|improve this answer
What are adventages of many-files approach versus NoSQL database? – krzat Feb 2 '13 at 16:35
This is basically what i thought too, but it still gives me lots and lots of small files, while minecraft only has one level.dat file. How is that done? – ThatOneGuy Feb 2 '13 at 16:53
Level.dat is just an index. Read up on the file format and check out the open source InfiniMiner – Vaughan Hilts Feb 2 '13 at 17:51

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.