[SOLVED] Strange Performance Issues


I'm having strange performance issues in my scene.

One scene is a much higher FPS, although the number of meshes, tris and verts is much higher.

The problem:

  • A scene with less tiles, but more cities is much slower than a larger scene consisting of more tiles.

    A scene with less tiles contains less meshes, and less tris/verts but still is slower.

    Scene buildup:
  • the Hexagonal Tiles you see are Geometry batch instances, so the number of meshes is always the same as the number of type of tiles in the scene (around 9). Changing this does not change the FPS
  • the Beach addon on the Tiles, is a Geometry batch instance, 1 mesh, does not change
  • the Cities on the tiles are seperate nodes. So more = more meshes/nodes, n cities = n nodes

  • On each corner of a Hexagonal Tile is a Building position node, with a Box. But this entire Node is set to CULL_ALWAYS.
  • On each side of a Hexagonal Tile is a Road Position node, with a Box. But this entire Node set to CULL_ALWAYS.

    Both are used in the UI construction process to position a building.

    Speed ups implemented:
  • Backface Culling
  • SharedMesh (at first, now switched to:
  • Geometry Instancing.
  • No Lighting -> Lightmapped to texture
  • Opaque Render setting
  • Waterpass -> No reflection
  • Locking all meshes
  • setTwoPassTransparency(false);

    Update looks like:

public void update(float tpf) {
        // Update the InputHandler
        if (input != null) {

        // Translate SkyBox
        Vector3f location = DisplaySystem.getDisplaySystem().getRenderer().getCamera().getLocation();
        skybox.updateGeometricState(0f, true);

        // Translate WaterPass
        if (waterEffectRenderPass != null) {
            waterQuad.updateGeometricState(tpf, true);
            setTextureCoords(0, location.x, -location.z, textureScale);

        // Update the passes

Disabling Water Render Pass or the updatePasses from Manager gives almost no speed bonus. (1-2FPS)

Game implemented using StandardGame.
jME 1, jME 2 gives no significant speed bonus.

The only thing I can think of, is that the amount of nodes within a scene increases, but these do not necessarily contain any meshes. They are used for positioning etc.

That's about all, any help would be greatly appreciated because I've been banging my head on this one for the past few days.

do you add things to your scene and it gets faster as you add things?

OR: do you remove things from your scene and it wont get faster (or even slower)?

I had a similar problem once, and it turned out to be the following:

I removed things from the scene graph but i still updated them manually in the various update() methods. Like that even if you remove things that you dont need anymore from the scene graph, they still cost you FPS. plus: it seemed that i was lazy and had a lot of garbage still referenced somehow -> no garbage collection -> high memory consumption -> PC starts writing to the page file -> Performance goes down  :expressionless:

Another possibility: since shaders and textures are more expensive (performance-wise) than loads of triangles, even less triangles can be much more expensive when you apply bit textures or even the simplest shaders on them.

Which texture format do you use?


The scene gets slower if I add Tile OBJs, but not City OBJs.

The only difference is that the Tile OBJ also create (empty) Nodes.

But not in a huge bizarre number. First picture has about 100 empty nodes (grouped under 1 node which is set to CULL AUTO, and lockBranch(). The second picture has about 25 empty nodes in the same setup.

The first picture is after a one-time setup, the second after a different one-time setup and manually adding meshes ("cities"). The framerate does not drop if I add the cities, which adds about a 20.000 tris/verts + 20 meshes/nodes.

Garbage collection is not an issue, the game runs on about 40-60mb vm and does not get larger.

I have 4GB RAM, so no paging-file issues.

The textures and model setup for the Tiles and Cities are the same:

  • Obj export, MTL Texture import of: 1024x1024 PNG texture.

    (1 Texture per Tile type / City Type, so about 11 Textures total)

    Both setups use the same OBJ/MTLs.

    System setup:

    Q6600 (4x3.3Ghz)

    4GB RAM

    ATi Radeon 2900XT, 512mb

    Here is the first scene, with 3x more verts/tris and 5x more Meshes, only by adding the cities,

    but only a small slow down. A FPS drop of about 4-5:


Is it purely graphical - as in does adding a city add in any extra processing such as game logic?

Do you get the same difference results without water?

Is does not add in any gamelogic that is in the update cycle.

But the City does not give any slowdown.

Removing water gives a very small fps boost, around 1-2fps. As stated in the first post.

Perhaps a profiling tool can help where the bottleneck is…

And to completely destroy all reason:

Here’s a screenshot with the city obj replaced by the ForestTile Object, as a sharedMesh.

But no FPS drop…


So again, I opened a thread before going through all posibilities, damnit all  :stuck_out_tongue:

Because this cannot be a rendering issue…

I’m just going to deconstruct every part of the application to see where the problem lies.

Oh glorious jME, how could I ever have doubted thee  :D  :mrgreen:

I found the problem, and it seems the extreme drop in FPS is the fault of the Chat like TextField from FengGUI.

And when I mean extreme, the difference on scene 1 is around 160 FPS. (from 90 to 240-280 FPS)

But, because I thought the source was jME I applied every speed up I could think of, and gained an increase of around 90 FPS on the original version.  So all the effort was not in vain… :smiley:

I think it has to do with text rendering, but I'm not all too sure. Gonna look into it now.

Please advise what it is in fenggui causing the fps drop

At the moment I am still looking into it.

The problem lies with the TextAreaObject.

The bigger the text within the TextArea, the larger the FPS drop.

And no, I am not updating it too often. Even an update every 20 seconds gives the drop.

The drop happens the moment the TextAreadisplays it's text, and is linearly connected to the amount of text within the TextArea.

I'll try to revert back to the FengGUI SVN to see if the drop is because of the TextAreaitself, or changes I made to the ContentFactory to support textstyles and emoticons.

(In theory they shouldn't be a problem, because the construction only takes place on text updates to the TextArea.)

Scene optimizing is fun… :slight_smile:

FPS: 136 Tris: 678552 Vertices: 926407 Meshes:112

Nodes: around 5k

For anyone interested in the capabilities/speed of jME.

does the same happen with a label ??. If so it may be related to keystrokes and inputs

No, the TextArea is not updating or being accessed/changed at all.

It is only updated now when there is a change in the GameLogger, which then transfers the Strings to the Text value of the TextArea.

Just by setting the Text to a too large value will trigger the slowdown.

The FPS label, and the rest of the labels give no (noticable) slowdown at all.

Is there a blinking caret?  :slight_smile:

No, TextArea is read only. It is used and set up for display purpose only.

I will just restrict the TextArea to display only the latest 50 lines.