Game Development Community

Level building: suggestions on optimization & improving performance

by Mack · in Torque 3D Public · 08/01/2010 (6:33 pm) · 7 replies

Hey Guys!

img28.imageshack.us/img28/5420/mackisworking7small.jpg(This is the map I've been working on for the last few days, learning T3D. I just got the ruined buildings in last night.)

My game is a 3d action platformer, so all the background scenes are packed with nice background objects to give the level it's detail and depth. 90% of my levels are designed to have open backgrounds. What I've been noticing is drops in performance. My backgrounds have quiet a bit of objects (50+ in a given screen), which are all custom placed TStatics (anyway I can organize these in folders in the Scene?). Anything that isn't in the immediate foreground to the player (the buildings behind those front buildings) are all hardcore LODs (no more than 200 poly for some of the more complex ones) with small textures (256x currently, thinking of going down to 128x or lower, depending). I have terrain on the foreground layer only, with a single plane to cover anything in the distance.

I've tried a couple different things and I'm going to further LOD closer to the foreground and drop some of the foreground texture resolutions. I wanted to hear if you guys have had any suggestions for performance improvements or if the only option I have is greatly controlling LODs. I may have to wait for 1.1 (I'm using Binary 1.0.1) to see if the Forest Editor and Sketch Tool will help.

#1
08/01/2010 (7:45 pm)
First type...

metrics( "fps gfx" );

... into the console. The key numbers to look at there are your frame rate and number of draw calls. If your draw calls should usually be around 2000 or so... much more and you will start to really hurt performance. Of course the lower the better.

The key to getting less draw calls is having LODs that reduce the number of materials a model uses. Also adding "null LODs" by adding a final detail node into your model that doesn't contain a mesh lets you completely disable a mesh when its gotten small on screen.

Other than that 1.1 final has hardware mesh instancing which will significatly reduce your draw calls in scenes with lots of instanced meshes. That plus other improvements in 1.1 should help you alot.
#2
08/01/2010 (7:48 pm)
Whilst 1.1's instancing should help quite a bit, it's important to remember that every texture on an object adds to the drawcalls, so if you have an object with 10 textures - that object is the equivalent of 10 objects with a single texture -- now have 10 of the first object and you've got the equivelent of 100 objects. I wrote a couple of really boring blogs on redesigning my art assets to significantly improve performance (if you're that desperate, look for the word drawcall in the title!).

Try taking castShadows off textures of lower LODs (by giving them a new material) or reducing the shadow range considerably so it doesn't interact with anythign in the distance.

[edit]world's slowest typer here - lol! What Tom said
#3
08/01/2010 (9:04 pm)
scattersky is also known for bogging down performance.
#4
08/01/2010 (10:02 pm)
It really makes me wonder why performance is bogged so bad in this engine. I can get 30 FPS in 1080p crysis with fairly close to maxed settings yet with T3D maxed on an empty terrain I get 30 FPS. I don't understand why it is so poorly optimized or if I am missing something.
#5
08/01/2010 (11:00 pm)
Thanks for the suggestions guys! Here's my stats based on the scene I posted above:

Basic Lighting:
FPS: 140fps
Draw Calls: 170
Polycount: 28,000

Advanced Lighting:
FPS: 20fps
Draw Calls: 1450
Polycount: 2m

Only the foreground elements have diffuse+normal, everything else is just diffuse. No specular maps.

1.1 Mesh instancing will help me greatly, I can't wait for us Binaries to get it. I am wondering if I may be forced to work within Basic Lighting with a light map bake for the environment and forgo my precious normal maps to stay within my system requirements.
#6
08/03/2010 (4:13 pm)
I dropped the normal maps, decreased the shadow range, decreased the shadow size, increased the soft shadowing.

I've run the scene on 3 different machines now, my primary work machine the performance has tripled. On my 2 year old gaming notebook I'm sitting at 40fps. On my dual core, 2gb, 2600pro machine I'm at 40fps as well. I ran the tests at 16x12 rez on my primary machine and notebook (prior tests were 1280x1024) and 1280x1024 on my old machine.

The draw calls and polycount are about half of what they were before.

What I'm running into now is sudden drops in fps by 20 or even 30 frames at a time. I'm not entirely sure what it is. I haven't optimized my foreground building textures yet. I'm going to try and identify which areas have the issues and see what's up.
#7
08/03/2010 (6:06 pm)
Mack, Texture Atlases come in good use.

Neill, it's Torque, it cost you $1k..it's not going to save the Earth or defend the Milky Way against the Borg. If you can license Crytek tech for $1k, let me know.