Archived

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

henthoven

Best way to save level data

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
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
Guest Anonymous Poster
XML is a format few have experimented for maps, but it is entirely viable. It is well structured and I wouldn''t be surprised to see more games in the future making use of it.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by henthoven
...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...



Same anon poster from before.

All the files are organized as you say, but the game still crashes. I''ve even tried moving the DLLs to the SYSTEM directory, but that didn''t work either. I''m not sure what''s wrong.

Share this post


Link to post
Share on other sites
Hi anon poster

I am not sure what the problem can be. But, a friend of my uses Windows ME and there it did als not run. But why this is, I don''t know. Do you also run it on Windows ME?
Sorry, I can''t help you at the moment, but I am gonna try and find out why it does not run on all computers. Maby you can tell me your configuration? (Windows version, directX version,etc).

Regards,

Hans.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Yes, I''m using Windows ME and have DirectX 8 installed.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Sorry, I meant DX9. That was a typo in that last post.

Share this post


Link to post
Share on other sites
Hi,

I''ve heard from more people the last few days that it does not work with Windows ME. I am going to try to find out what the problem here is, but at the moment I don''t have a Windows ME test station.
So sorry, I can''t help you at the moment but as soon as I know more I will let you know.

Regards,

Hans.

Share this post


Link to post
Share on other sites
What os are you using?
The faqs say that the dos allegro may or may not work with windows. None the stuff I coded with allegro back when I was using win98 work in my current win2k.

[edited by - ReaperX on April 23, 2004 10:15:05 AM]

Share this post


Link to post
Share on other sites
I am using Windows XP, but I''ve tested the game also on a Win98 pc and it worked fine.
But, I am using allegro for windows (it uses directx). I can try to make a dos version of it, maby it works then on other windows versions?
By the way, does my game work on your computer running win2k?

Share this post


Link to post
Share on other sites
You could use an image format such as .bmp or .tga . That way you can edit your maps quickly using a paint program. Each pixel would represent a terrain type. If you have additional information that you want to assocate with each map, then store it in a separate text file. The text file can contain the file path of the texture it uses to hold the map data.

Share this post


Link to post
Share on other sites
Hi,

Thanks! Well, it is a bit hard, but when you go for the time bonusses in each level it is doable But maby I should make it a bit easier.
To be honest, the music I found on the internet when my mother was visiting a site. The site had this background music and I tought "This is perfect for the game" . The problem is, I really don''t know what site that was. But, I have the midi file here on my pc. So, if you want to have it, I can mail it to you. Just let me know!

Regards,

Hans.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by henthoven
I am going to try to find out what the problem here is, but at the moment I don''t have a Windows ME test station.
So sorry, I can''t help you at the moment but as soon as I know more I will let you know.

Regards,

Hans.


Good to hear. Thanks.

Share this post


Link to post
Share on other sites