Sign in to follow this  
MrBob

Turn based map tile information

Recommended Posts

I am building a 3D turn based strategy game much like the classic x-com games. The maps are pretty straight forward, 30 x 30 tiles and 3 vertical levels. When the level loads up, i build a tile class that represents all of tiles on the board. it contains (but not limited to) north, south, east, west variables that store whether or not there is some kind of blockage (i.e. wall, wall w/ window, door, etc.). different values for the directions mean different types of blockage. examples of my wall types... fences -> no lose of visibility, but blocks movement walls -> no visibility, no movement low walls -> no visibility if crouched behind, can be hurdled from this i derive path finding and LOS for shooting and spotting. my question is, is this the best way to handle this? it seems like my tile class could get very large if i decide to increase my map sizes much. any idea to improve this would be great, thanks.

Share this post


Link to post
Share on other sites
What I did when I was messing with a 2d map, was have a binary structure. A group of tiles where set into blobs (say 9x9) that define default value. after that each tile would have a value of bits telling it what it was overiding and telling the loader what to check for.

for example, at the head of the map it would have something like '9x9 blob' (of course not in text) after that there would be a 'blob header' saying something like, all tiles had a id of 102, do not change speed and can be walked on. the next tile, which matches all of those would simple be represented by a series of 8 or so 0's. the tile after that would be like 'HEY my id isnt 102' so it would have a 1 in the line of 0's and the reader would then check for the id (which was placed after the line)

That method created a VERY small map file size, and allowed for a great complexity of the map.

Share this post


Link to post
Share on other sites
Valeranth; seems pretty comparable to image compression formats. One good one I've seen is sort-of progressive, streaming in common bits for each quadrant and dividing recursively until you've given all bits for each pixel in the image. Your idea is somewhat the same; common properties are batched, and small differences are set apart.

Only problem is the algorithm to do that batching; making that algorithm do an efficient job can be non-trivial, unless using that prototyping mechanism is a part of the level design process itself (in which case, it is as efficient as the level designer makes it). Any tips on the batching algorithm?

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