Sunday, 1 April 2012

Saving and Loading games

Saving and loading, seems simple, right. Well it's not.

For the past 5 hours or so I have been implementing a saving and (somewhat) loading system into my new game. About 2 hours of that was testing, the other 3 were figuring out how I would go about achieve saving and loading. The system now works fantastically, it saves the map into 100 different chunks, each holding data for approximately 187,500 blocks.

One chunk takes about 0.2 seconds to create and save and only takes up ~0.153MB (153KB). Here's some math on how fast it really does save and how much space a FULL world takes up:

  3000 * 1000 / 16 = 187500 blocks in 1 chunk
  187500 / 2 = 93750 blocks created & saved in 0.1 seconds
  187500 blocks = 0.153MBs of data
  0.153 * 100 (amount of chunks) = 153MB MAX in any given world
  Finally 187500 * 100 = 18,750,000 blocks stored in the save files

That's the math over and done with, basically what I'm trying to say is the method I have created for saving worlds is VERY efficient. (after 5 hours of work that's what you would expect). And this is all done in Game Maker 8.0. :)

Now it's time to move onto random world generation, this should be fun.

P.S: If anyone wants to make me a texture pack for the game feel free, here's the reference one (right click save file to your computer to save it):

No comments:

Post a Comment