Underground maze map


I've got a problem I'd like to submit, that I have already solved the 'heavy' way, and I'd like to know if somehow could advise me on solving more efficiently.

I'm working on modeling a maze (http://www.jmonkeyengine.com/forum/index.php?topic=13462.0), made up of 64x64 squares (or more). Each square (or block) can be either dug or full, but in any case, it should be alterable. Right now I solved the question by creating a set of 64x64 independent quads + 64x64x4 potential walls (so roughly 30-40k quads) (when you dig a block, walls must appear), and I can see it's taking a lot of resources. In contrast, I see that the jme Island demo with a 30k + triangles that is going so much faster. Could anyone give me his thoughts about this ?



Reducing the single object count by creating one mesh and modifying that might be one solution. Also, culling of unneeded/hidden objects might bring some improvements here if you need single spatials. Maybe you could try locking() and unlocking() the nodes when they are static and see if that works for you.

Another approach might be creating one big mesh (the "basis" for the maze) and then just add walls here and there to alter it instead of building it from the ground up from those walls.

Hope this helps,


Actually, I found a temporary solution, that makes my fps jump from 20 to 60.

What I did for that was try to stay extremely clean on the implementation, plus, not consider culling the meshes I didn't use rather than purely deleting them from the scenegraph. Typically, when I started before with my new map, it was a single layer of quads (tops of each square), but also it was containing a set of culled quads representing walls, so that was N x N x 4 additional quads, that even if culled, were eating the memory. So, this plus using a nice and clean mesh locking at the level of the general node that contains all quads (locking each quad node by each actually gives slightly poorer performances), made me manage to get a good result. One possible improvement could be to organize my main node containing all the quad nodes into a quad tree.