Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Best Method For IsoMetric Multi-Level Map Storage


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
5 replies to this topic

#1 Lance42   Members   -  Reputation: 335

Like
0Likes
Like

Posted 12 September 2012 - 05:31 PM

Up until now, I've been using a simple flat text file that just defined the x/y coordinates of the first tile, and then mapped every character to a tile. This worked well for getting the basic engine up and running, but now I'm to the point where the Isometric engine is running fine, and I need to start making a world generator and adding features. Clearly, it's time to add in real map data storage. The method should be pretty quick, and I'll want to be able to divide up the map into chunks and save and load chunks fairly quickly. Any recommendations on a format/method of doing this? Thanks in advance...

Lance...

Ad:

#2 Krohm   GDNet+   -  Reputation: 1710

Like
0Likes
Like

Posted 12 September 2012 - 10:56 PM

I would make up each tile as a model with a specific name (supposing you're using 3D tiles), place them in Blender, replicating them by ALT+D, then export to collada.

If this is too complicated, here's a method I've used in the past with moderate success.
I used a spreadsheet which would export in CSV.
Each spreadsheet cell would contain one or more of the following codes
  • nswe: an exit is present going north-south-west-east
  • o: origin of layer. Different floors were assembled by matching origin position. Origin had position (0,0)
  • other stuff you're likely not interested
  • in your case, you might add a tag such as TILE:NUMBER to select model. Or maybe TILE:IMAGERESOURCE.
This proven quite fast for defining layouts. As 3D information is not readily available, matching positions between different floors ("I want this room to be on top of... this other room below") proven more involved than predicted. I then switched to the blender+collada oriented method and I'm now very happy with it.

Edited by Krohm, 12 September 2012 - 10:57 PM.


#3 Lance42   Members   -  Reputation: 335

Like
1Likes
Like

Posted 12 September 2012 - 11:26 PM

I should be a little more specific. Currently my "world" is stored internally as a Dictionary<Vector, Tile>. The vector class is, as you may have gathered, a simple vector with x, y, z values. The Tile class holds data related to a specific title, as well as a Sprite class. I'm thinking the best bet is to divide the map into chunks, and serialize the resulting chunk class, dictionary and all. Comments?

#4 yewbie   GDNet+   -  Reputation: 624

Like
0Likes
Like

Posted 13 September 2012 - 10:20 AM

I ended up just writing a file for a 10 (layer) isometric world that was 1000x1000 the filesize would get huge... mostly all of those tiles were blank.
So I ended up having my base tile and any layers of tiles above it would be part of a vector(data vector) (increasing with the Z axis) I could just check at draw time.

I ended up doing something like this as output binary to a file:

(int) FileVersion
(int) Checksum - The checksum is the total of the tilenumber for each given tile used to check data integrity.
(int) Number of tile records - I only store tiles that actually have data on them (On the base 0 level)

(for each base tile)
(int) X
(int) Y
(int) Tile - Add to checksum
(int) Number of Additional Levels on this tile
----(If > 0 parse each addtional level)
{

(int) X

(int) Y

(int) Tile - Add to checksum

}

(As always I am sure there are way better ways of doing this)

#5 Lance42   Members   -  Reputation: 335

Like
1Likes
Like

Posted 13 September 2012 - 12:05 PM

Ah... If I serialize the dictionary, that will do for now, but ultimately I shouldn't be serializing the sprite as well, which I will be at first. Silly. =D

#6 yewbie   GDNet+   -  Reputation: 624

Like
0Likes
Like

Posted 13 September 2012 - 12:48 PM

Ah... If I serialize the dictionary, that will do for now, but ultimately I shouldn't be serializing the sprite as well, which I will be at first. Silly. =D


What I was trying to say was just store the pertinant data to save and load and ignore everything else =)
(Which is exactly what you just said)

Dictionaries are neat I need to use them more often.
I think as a hold over from C++ I tend to store all of my stuff in vectors of a given class and refernce everything by a number.
Something like:
int TileReference = y + (MapWidth * x) ;
Then you could have s single 1d vector with all of your map tiles (as part of a class) in it making it really easy to export / import data.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS