Hello everyone,
I seem to have one of the most common problems when creating a game. It’s not running well, and I need to optimize it. (Some stats: At some point there are ~1000 objects, a GTX410M achieves up to 9 fps, a GTX750TI up to 72)
Any help or tips would be appreciated, also if you could just point me to the right direction.
Thank you in advance.
I think we’re gonna need more info, maybe a screenshot showing the game when it’s at the 1000 objects point, also make sure the f5 info overlay is on. I’m guessing some sort of batching, but I am probably not the one who is gonna be the most help here.
Right, 1000 objects is a hefty amount of objects. It’s not unhandleable but I’m guessing these also may be high in vertices.
Batching fixed things also helps. For example the static objects of your scene that do not move or need to be interacted with can generally be batched.
Try to have 100-200 Objects at Maximum.
a) Manual Batching: In Blender, Combine the Vertices into one Object (Join the Objects), where possible (When you only need one Material for all of them (You could also use a TextureAltlas))
b) Automatic Batching using BatchNodeFactory (See the wiki page on optimizations for that!): It will do the same
Batching means you can’t move them seperately again though and too much isn’t good aswell.
Manual Batching is prefered because it won’t slow down your games start up.
Edit: Also use simple tools like TaskManager and MSI Afterburner to see CPU and GPU Usage. Note: If you have roughly 25% Usage (Or 12.5%) still means your App is out of CPU (See the Diagrams in TaskManager: 25% means One Core running under full load. The UpdateLoop is SingleThreaded)
1000 Objects is about the max you should have but it SHOULD still be okay. Simply try and profile your app, either by using System.nanoTime at strategic points or by using a profiler (which can be easily installed in the SDK via the plugins menu).
1000 objects? Ok, but how many lights do you have?
@FrozenShade I have 5 lights in my scene, and counting. (Sun and 4 lamps)
@BigBob I already have most things batched. Although, does anyone know how to batch objects that are in a separate j3o which is linked in the main scene together with the other objects?
@normen Ok, I’ll try that. BTW, would it rather be the graphics card or processor?
I have zero information about your app except that it has about 1000 objects and 4 lights, how am I supposed to know?
What do you need to know?
Can you please provide a video ? I am curious to see what does your scene look like.
It will help others to give a better solution .
I don’t have a video right now (also I’m on my laptop so recording is impossible as I only get ~9 fps).
But there are some images on my blog, just look at the forum post “Steaming World”. Here’s the link anyway: http://robbi-blechdose.weebly.com/
In those images there were a few objects and all were low poly.
(anyway … You can record it with mobile camera )
The forum thinks this is an empty reply unless I type stuff.
“Hey guys, I’m holding this piece of red string… can someone tell me how long it is?”
Its red cm’s long duh
Ok,
here’s an image:
In the background, there is a big building consisting of lots of objects. It’s in a seperate j3o and linked in the main scene. It doesn’t seem to get batched itself (or rather the parts).
Another thing you can do is if you are using the latest JME, you can open the in-game render loop profiler with F6. The different colors tell you where time is spent the most per frame.
Is the wireframe part of the game or is that the physics debug mesh or for our benefit?
That is physics debug.
And I’m using JME 3.0.
Ah… that’s too bad. Some of our advice is bound to be too new then anyway.
The thing is, ray casting didn’t work in 3.1 for me so I switched back.
You will have to be more specific.
You will also have to use the latest build (you can easily build it yourself) to get the fix I checked in for one type of collision check.