Very low FPS with 8000 nodes


I've been developing a game for a while now, and the development team recently decided the need to up the amount of tiles in the gameworld to 8000 (a 100*80 rectangular plane of Nodes). When I do this, the performance drops down to 2 fps. Is there a known workaround for this kind of thing or am I just screwed?

I'm developing on the following system:

iMac G5 iSight

1.25GB RAM

Mac OS X 10.4.5

Java 1.5.0_05-83



lock all static parts of your scene. The framerate drop is due to the merging of bounds, updating of vectors etc, if these tiles don't move, rotate or scale, lock the whole tree that contains them.

If you have tiles that are the same, make sure you use SharedMesh/SharedNode for them, which is mostly a memory savings, but some performance.

group your tiles in an efficient manner, if the tiles are laid out in the grid, you should set up your tree similar to a quad tree. This will make culling much faster.

Also it's worth considering to organise your tiles in such a way that it's easier to cull them. If you group together a number of tiles on the same node, and all the tiles are outside of the camera view, then only the bounds of that Node have to be tested to discard all the tiles attached to it (eg. TerrainPage does this). (so what Mojo said basically)

I've restructured it all into a quadtree now. The performance is still very bad. Every tile is in the picture, so, as far as I understand it, culling shouldn't be the solution now. The thing that surprises me most is that the fps number is very low even when the camera has been turned away from the tiles completely.

I've been testing this in a SimpleGame extension to give you an idea what the settings are.

This is the code generating the scene:

As Mojo said, lock the geomtry (look at the lock* methods).

Yes, I tried that. I've added all combination of lock* calls after the mesh creation, after finishing up the new node creation and after the whole map has been created, but the performance doesn't increase significantly. The only difference that I see is that, when locking the transforms, is that you see less Quads. Also, the triangle counter goes down to 0, but still the fps amount is very low.

I think I've implemented what you suggested, but still don't get that kind of performance. The machine you're using is pretty powerful, so maybe that's it? Could you send me the test to see if it's a hardware issue?

Isn't it possible for the renderer to just rerender the things that have changed? Now the framerate seems to be so low because the whole scene is being rerendered everytime. If it were possible to just rerender the JMEDesktop every render cycle and only rerender the tiled map when something actually changes that should be able to help things along.

I copied the code and ran it on my G5. In both 1024/768 fullscreen and windowed mode I get 2fps. After this is whipped out my MacBook Pro with the following specs:

Intel Core Duo 2x2GHZ

1 GB RAM (667 MHZ)

ATI Mobility Radeon X1600 with 256 MB

With the same screen settings this gave a fps count of 6.

As you can imagine this has been running up the walls :). Do you see any explanation or, even better, a solution?

8,000 nodes, if it's like in other engines are "objects", "entities", "meshes"…man, that is…way excesive. usually at job we allways tried to keep number of objects at a minimum. welding all we can, as is a performance killer in 3d in general. Often kills way more than huge polygon counts.

do a try, weld models in art software, and then try again. maybe a 3ds Max attach may be enough, not needing actual weld…maybe.

We need to be able to access the individual tiles for building objects on them, much like it is done in SimCity. Making it into one big Mesh doesn't seem to be the better option here, as you'd have to create the whole Mesh everytime something changes. Maybe this is a better option, but do you still suggest it knowing what we need the tiles for?

maybe asigning an specialnamed material to each quad-tile ? dunno if that'd kill performance for other reason...(many materials)Without texture, that is. If it were an obj, would be that it has an "usemtl" previous to the quad coords of that tile.

What I know is a whole mesh this way, would really be better fo rany engine...