Sign in to follow this  

3d grid based map structure

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

I am trying to determan the best way to handle my map data. i am in the stages of building an editor for my game and i was hoping to get some feed back on my implementation. I have build a few perfab 3d models (boxes, crates, a small warhouse). my plan is to have a "footprint" that when placed on to the game board would transfer the prefab info to the map class.
//simplified view of my map classes
//
class map
{
     grid *tile[width][depth][height]
}

class grid
{
     int height;
     int moveCost;//-1 no movement, 0 open, >0 some movement penalty
     int visionCost;// -1 blocking vision, 0 no blocking, >0 some vision degradation
     entity *prop
}

i am also trying do decide on how to handle enities. there are not too many types; i have one for doors, windows, ladders, exploding things, and a few others. currently the tiles that have entities in them will have a pointer to it. any thoughts are greatly welcome, thanks.

Share this post


Link to post
Share on other sites
My thoughts are that you should have a 2D array :)
From the description your game looks like stuff placed on a terrain. (boxes, crates, a small warehouse)

Else you really want a vertical gameplay, I say go with 2D tile array. or quadtree.

But if you go 3D, definitely think about going to octree. Because a 3D array will get very huge depending on the size of the map.

Share this post


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