Sign in to follow this  

3d grid based map structure

Recommended Posts

MrBob    143
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
Daivuk    413
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

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