• Advertisement
Sign in to follow this  

Better Method for Load and Save Maps

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

Advertisement
I think you could use some more details in your post than just that.

What size maps? how are you storing your map data? will maps be made of large chunks of smaller tiles, and each chunck and be loaded when it is needed, allowing massive maps, where the game only has the needed area and a buffer zone around it?

Share this post


Link to post
Share on other sites
man, you not read my post ... i need the 'better' method for this, tiles sizes : 48x48, Multi-sized maps, storing in files ... (.map), multi-layered (4 layers), and the rest, i need the opinion of yours, WHY the Best methods ( new, please, the articles of GameDev is too Old, 1995,1997 ... !!!! ), Please Help-me with this ...

codes please ...


Thanks

ps . Sorry but my english is not very good ehheheh

Share this post


Link to post
Share on other sites
Quote:
Original post by strikerbcb
man, you not read my post ... i need the 'better' method for this, tiles sizes : 48x48, Multi-sized maps, storing in files ... (.map), multi-layered (4 layers), and the rest, i need the opinion of yours, WHY the Best methods ( new, please, the articles of GameDev is too Old, 1995,1997 ... !!!! ), Please Help-me with this ...

codes please ...


Thanks

ps . Sorry but my english is not very good ehheheh


'Better' is subjective, and relies too heavily on implementational details. It also relies heavily on individual programmers and styles. This is also not really that complicated a problem, does not really provide anything of interest to most of the frequenters of this forum, and thus probably will not garner much of a response. A tile map is simple, so an exhaustive comparative analysis of algorithms is not really necessary. Coming in here and demanding codes (what kind of codes? James Bond type, secret message codes? Morse code? Buildings and structures codes? Specificity is your friend and ours.) is not really a good way to guarantee a response.

As well, old does not necessarily mean obsolete. Tile-based games are pretty much a solved problem, and there really isn't much new to discuss. All those old articles probably have the answers you are looking for. Find something that works for you and go with it.

Share this post


Link to post
Share on other sites
Hidden
I am working on a tile-based RPG game (like Zelda or FF), and here is how my Map-struct looks like:

struct MapStruct {
int Ground;
int Fringe;
int Roof;
int Object;
} Map[16][16];

This creates a 16x16 size map. I save the maps to a textfile, something like this:

for (y = 0; y < 16; y++) {
for (x = 0; x < 16; x++) {
sprintf(tmpstr, "%d %d %d %d\n", Map[y][x].Ground, Map[y][x].Fringe, Map[y][x].Roof, Map[y][x].Object);
fputs(tmpstr, fp);
}
}

The file (on disk) will end up looking something like this:

4 -1 -1 0
5 0 -1 0
4 -1 -1 1
2 2 -1 2
4 -1 -1 0

Or whatever. It's probably not the best way doing it, and I myself have been looking for a better way to store the maps on disk, but it works, and it's relatively easy to load them back into memory on program startup.

Hope this helps. :)

Share this post


Link to post
I think Kada2k6's method is good, except I would write the data to a binary file, rather than a text file. My current project actually uses bitmaps(pcx's) to save the map layers. This makes it easy for me to quickly view a map when resolving a bug in the level editor. Once I am happy with my editor, I will insert code to save using the above method.

Share this post


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

  • Advertisement