So I’m making good progress on my game which is a Age of empires style RTS. At the moment i have about 25 units X 2 sides. I have merged the static structures together and I’m getting a nice frame rate except when I’m around other characters
So here when there is about 14 characters in the viewport the FPS drops to about 9 when usually its about 40+
While all the characters are the same they will be doing different animations so i cant merge them. I had a play with LOD but that had negligible effect. Should i be looking at batchNodes?
Is that the best way to go?
Are the characters animated?
If yes you should consider to use hardware Skinning.
SkeletonControl.setHardwareSkinningPreferred(true), for each character.
This will switch to hardware skinning if it’s supported on the hardware (most probably if you’re on desktop).
Also the material on the characters have to support it. If you use standard lighting.j3md, it’s ok.
Edit also according to the stats, you have 589 objects and 5 million triangles, in the scene. That’s a lot. Are you sure the static objects are batched properly?
thanks for your response… Much appreciated
I had a look at the character models again and i found a small mesh with 90,000 of the 100000 triangles, which i removed. and the frame rate improved significantly
Yea the characters are animated
So i tried setHardwareSkinningPrefered (to see if it can improve more) and it improved the frame rate quite a bit more, however the animations are now very sporadic, if the character is walking from a to b and can see the walk animation about 10% of the time, plus i have a single model with different weapons kinda like a swiss army knife all as a single mesh in blender. The weapons don’t seem to animate at all. (they work fine when i turn hardware skinning off)
I have attached my model bellow, incase its of any help
Im not 100% sure but I’m fairly sure i have batched the static objects, I have 1 kind of grass, 1 kind of tree and 3 kinds of house (all batched individually) plus 5 other structures which i have just one each of (these i hanvent batched)
grassLayer = (Node) GeometryBatchFactory.optimize(grassLayer, true);
treeLayer = (Node) GeometryBatchFactory.optimize(treeLayer, true);
a = GeometryBatchFactory.optimize(a, true);
I used the SDK to create my sceneGraph of my town so i have to remove all the houses and attach them to a node depending on the house type and optimise the new parent nodes…
And when i move just a few steps away from the characters the frame rate recovers immediately
as seen here