Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

henthoven

Best way to save level data

This topic is 5169 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

Hi, The last few weeks I have been working on a side scrolling platform game. I am verry happy with the result I have at the moment. But I am not very happy with the way I save and load the level data for the different levels. At the moment level data is saved in a textfile. In this file the first lines tell the size of the level and some other information. Then I have a table with komma sepperated integers that that represent the level data. So, it looks as something like this: 10 // width 5 // height 0,0,0,0,0,0,0,0,0,0, 0,3,0,0,0,0,0,0,3,0, 0,3,0,0,0,1,0,0,3,0, 0,0,0,0,1,1,1,0,0,0, 1,1,1,1,1,1,1,1,1,1, Well, I don''t think this is a very good way, or is it? Is there someone who can advise me a good solution? Thanks in advance! Regards, Hans. By the way, if you would like to see the game, it can be found at http://www.pottum.nl/manzana/.

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Sadly, your game doesn''t run. For like a split-second you can kinda see a window, but then it disappears and the game crashes.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Apart from the packfile idea - I don''t see any simpler way to easily store the data for your type of game

Share this post


Link to post
Share on other sites
Hi,

Thanks! I am gonna checkout what a packfile is, maby I can use it.
For that anonymous user, strange that it doesn''t run. Did you unpack the files including the subdirs? There should be 4 files in a dir called ''data''. These files are menu.dat, level1.dat, level2.dat, level3.dat and game.hs.
Hopefully this will help.

Regards,

Hans.

Share this post


Link to post
Share on other sites
Ok, thanks, I also check out mappy!
But I also had another idea. Is it a good idea to just serialize a level object to a file and unserialize it when the level must be loaded. In that way a level editor could be made very easy because you only have to make an instance of a level object, set all the values and then serialize it to a file.
In the game the level can be loaded by unserializing the file.

Is this a good idea and is it easy in C++ to serialize and unserialize an object?
I hope someone has experience with this and can tell me more about it. Thanks in advance!

Regards,

Hans.

Share this post


Link to post
Share on other sites
I''m not sure if serialization is a good way to go for games so I won''t comment.

I did try out your game though and it worked perfectly. Keep up the good work!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!