Sign in to follow this  
murdock

Tiling question(Storing a map)

Recommended Posts

In general, is it better to store a tile map as a multi dimensional array of tiles or as a multi dimensional array of tilemaps? In other words, do you have a tile as each element or a tile map as each element in the array? I'm trying to build a tile class that will be used in a game and then build a map editor based on the tile class. I was thinking it might be easier to use the array of maps so you could edit each element in the array in the map editor; however, I was wondering if this is the best way to do that. Also, if someone knows of any "Best Practices" when it comes to tiling, it would be great if you could point those out as well.

Share this post


Link to post
Share on other sites
Quote:
Original post by murdock
I'm trying to build a tile class that will be used in a game and then build a map editor based on the tile class. I was thinking it might be easier to use the array of maps so you could edit each element in the array in the map editor; however, I was wondering if this is the best way to do that.


What?

A tile map is a map that contains tiles. That's why it's called a tile map. Therefore, you make your multidimensional array hold tiles.

When you do the map editor, you give it access to the entire multidimensional array.

Quote:
Also, if someone knows of any "Best Practices" when it comes to tiling, it would be great if you could point those out as well.


Make sure your tiles fit together. It's common for tiles on console systems to have power-of-two sizes, especially 8x8, 16x16 (probably most common) or 32x32; but there's no particular reason you have to do that (the consoles - especially handheld ones, and older, less powerful ones - do it because of various very-low-level hardware optimizations that probably won't be available to you or will work totally differently).

It's also common for tiles to be logically composed of a 2x2 sub-tile block; sometimes this really helps with the tile design. Or you can think of it as a kind of compression for map data that really maps out the sub-tiles. :)

Be aware that if you have more than one kind of terrain, you are probably also going to want transition tiles. Depending on how you decide to handle transitions, this can mean a LOT of tile variations. Possibilities are to have the tile change slightly at the edge on both tiles; have one terrain slightly overlap onto one other tile; or have some tiles that split down the middle. But be aware that this can go on in both directions, which multiplies the possibilities quite a bit.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this