need some scripting advice for a doungin keeper style game system

I’ve been prodding at this idea for a few weeks now, went through two different attempts to build it to, but it seems to consistently fall apart. basically, what I want is a grid of blocks that can be destroyed or rebuilt made up of several basic blocks that fit together to form walls, corners, ect. you can tag blocks for digging, claim rooms, you know. dungeon keeper type stuff. only real difference is I want to allow for double sided thin walls and partial walls rather then everything being exactly the same block sized.

I’ve treed two variations on using a grid of nodes to generate the blocks. the first attempt each node had code and generated it’s own block locally when told to. this didn’t run so well, so on my second attempt the nodes were strictly for data storage and I used a master script to generate the stage exclusively, this ran better.

but both worked with smaller grid sizes. the first was fine with up to 50 X 50 the second ran better and loaded faster at 60x60 but both cases if I increased the size over 100 performance just bottomed out the second anything trys to move or update in the game. if noting is moving but the camera it’s fine. the larger the grid, the worse the performance.

it seems directly linked to the number of wall and floor segments that are drawn in. I tried only drawing in blocks the camera has seen. but it went from tolerable to slow, to unbearable as I uncovered more blocks. since the blocks contain no data I am baffled. generating the blocks that are visible and destroying them when not is to slow for that to work either.

there has to be something I am overlooking here, but I can’t see what it is. does anyone have any advice on how to handle this sort of dynamic level layout or how to approach handling it more efficiently?

Have you checked out the profiler or watched your draw call count once you are generating a larger grid? I assume your bottleneck is the number of draw calls.

You might need to look at combining chunks of blocks at runtime:
http://unity3d.com/support/documentation/Manual/Optimizing%20Graphics%20Performance.html

You might also have to make a method to remove blocks from the combined mesh if they can be destroyed during the game or just don’t combine the ones that can be destroyed.

Depending on your camera setup you may benefit from occlusion culling as well.

not sure that’t the problem. to my understanding, draw calls and so on only matter for what is being rendered on screen at the time. the performance drop happens when I increase the number of objects in the scene regardless of what the camera is seeing.