Building a 3D scene from a 2D map


I’m kinda stuck right now. I’ve created some 2D maps that look a bit like this (but quite bigger, more like 512x512):

1 1 1 1 1 1 1 1

1 0 0 0 0 0 0 1

1 0 1 1 1 1 0 1

1 0 1 0 0 0 0 1

1 1 1 1 1 1 1 1

Where 1s should be walls and 0s empty space (still with a floor and ceiling). I’ve tried various things but i can’t seem to figure out the best way to translate this into 3D.

I’m not sure what to do next. I need a Wolfenstein-like blocky visual in 3D (for the walls, at least). Do i need to implement some sort or ray casting to know what is visible by the player? I’ve read a bit into this, but still nothing really explained what i really need to do. Should i create the quads, texture them, light them, and place them on the fly when they enter the player’s view? Seems quite intensive to me… or is the geometry created beforehand? But then, when do you stop creating geometry? Say the map is 512x512…

Btw, i’ve checked most FPS tutorials on here, but they’re all dead. All they do is load a simple level, throw in a cam, maybe a little physics here and there, but they don’t go deeper. I need info about Hidden Surface Removal, dynamic level loading, that sort of thing…

I’m lost and confused, if anyone could shed some light into this… i’d be eternally grateful! :wink:

I’m noob too, but I would divide world into small areas that no matter where player is, player cannot see past neighbouring area, and then load area where player is and all neighbours and if he moves to another, drop not-neighbour areas and load new neighbours.

But inside area, i would leave all hard work on JME, just divide it into nodes, so it can do its magic.

Well I would create a roof and a floor in the 512 size in the first step

Then I would create blocks for all walls

then I would try to combine as much of these blocks thogether as possible, maybee even combine all the walls togheter into one mesh, as one larger model would be way better than thousand smaller ones.

If it works good then I would leave it, else I would try some bsp like optimizations. (just google for bsp)

dammit went afk and forgot to click send

To complete what EmpirePhenix said, someting like <a href=’>dynamic programmingcan be used to generate a reduced set of blocks.

Another simple/cheap trick is to NOT generate a block for a pixels whose 4-neigbhours (north, south, east, west) are “full” (ie non empty) since it can not be seen. This depends on the level, but on a nethack-like one, this an do marvel.