StandardGame performance issue

Hello everybody!

First time posting at this forum. I'm new to JME. I've been sitting for a few days now experimenting with it and I must say it's a really great tool!  :smiley:

I usually do all my stuff like most examples in JME; i.e. extending SimpleGame class. I have been looking into StandardGame because I want to eventually move on to multithreaded coding but there are some things I don't yet understand. I have been looking around the forum but I haven't found any information about this (yet).

When using SimpleGame my application loads in approx. 3 seconds. The game is halted until everything has loaded (ofcourse, since it's single threaded!).

When using StandardGame my application takes around 10-15 seconds to load but the main window is shown almost immediately. I know the window is supposed to be shown directly. I guess the longer loading time is because most of the process time is spent in the rendering thread.

I need to know how to make things go faster when loading, i.e. put more priority to the loading and less on the rendering.

Maybe I am missing something trivial here but please point it out to me then  :slight_smile:

If you render something useful in the window while loading (loading screen for example), the rendering thread will be waiting for GPU and thus wasting less cycles. Another thing you can try is increase the priority of the loading thread:


Just make sure you have only one thread executing all your initialization and setup code, otherwise, if you use several calls for each thing you want to do, then it will be done interleaved with the render thread… that would be a killer.  :expressionless:

I have tried changing the priority of the thread but I doesn't make any difference.

But the thing here is that is not a problem with my code. When I try darkfrog's example the loading time is very long (considering it's just loading a box and a debugstate).

        StandardGame game = new StandardGame("TestGame");   // Create our game
        game.start();   // Start the game thread
        DebugGameState gameState = new DebugGameState();   // Create our game state
        GameStateManager.getInstance().attachChild(gameState);   // Attach it to the GameStateManager
        gameState.setActive(true);   // Activate it
        Box box = new Box("TestBox", new Vector3f(), 1.0f, 1.0f, 1.0f);      // Create a Box
        box.setRandomColors();   // Set random colors on it
        box.updateRenderState();   // Update the render state so the colors appear (the game is already running, so this must always be done)
        gameState.getRootNode().attachChild(box);   // Attach the box to rootNode in DebugGameState

This thing takes several seconds to load.