Skip to main content
GameDev.net gamedev.net
🔒 Locked

3d grid based map structure

Started by MrBob Dec 17, 2008 at 3:43 PM 0 replies 1.5k views
Original Post
MrBob
MrBob
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.
A priest, a rabbi, and a monkey walk into a bar. The bartender says," hey whats going on here, is this some kinda joke?"
Daivuk
Daivuk
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.