CPU load optimization

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Post Reply
Haddayn
Posts: 4
Joined: Mon Apr 28, 2014 4:49 am

CPU load optimization

Post by Haddayn »

Hey everybody,

I'm developing an RTS game, and there can be hundreds of units. My current implementation is very naive and causes a lot of overhead because of large amount of nodes.

Code: Select all

 
    irr::scene::IAnimatedMesh* mesh = scnmgr->getMesh(meshpath + meshname)
    return scnmgr->addAnimatedMeshSceneNode(mesh);
 
To test I created different amounts of nodes, each a textureless model consisting of 2000-3000 polygons. After creating 500 nodes CPU core gets 90% loaded and fps drops to 15.
Also I found that even if I move camera away, performance stays the same.

So, what is the best way to handle that this with Irrlicht?
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: CPU load optimization

Post by mongoose7 »

This is not an Irrlicht problem as such. Maybe look into level-of-detail? Models at a certain distance from the camera should be swapped out in favour of low-poly models (though I guess these would need to be combined). You may also be able to cull (remove) models that can't be seen because of the modles between them and the camera.
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: CPU load optimization

Post by hendu »

3k polys is a lot for a RTS unit, usually covering an area like 50x50 pixels.
Haddayn
Posts: 4
Joined: Mon Apr 28, 2014 4:49 am

Re: CPU load optimization

Post by Haddayn »

Thank you for response.
mongoose7 wrote:You may also be able to cull (remove) models that can't be seen because of the modles between them and the camera.
Hmm... I thought that Irrlicht would do that automatically. I guess I need a custom scene node for this, right?

hendu wrote:3k polys is a lot for a RTS unit, usually covering an area like 50x50 pixels.
mongoose7 wrote:This is not an Irrlicht problem as such. Maybe look into level-of-detail? Models at a certain distance from the camera should be swapped out in favour of low-poly models (though I guess these would need to be combined).
Oh, I didn't think about that. :) I'll look into it.
mongoose7
Posts: 1227
Joined: Wed Apr 06, 2011 12:13 pm

Re: CPU load optimization

Post by mongoose7 »

node->setVisible(false)?
Granyte
Posts: 849
Joined: Tue Jan 25, 2011 11:07 pm
Contact:

Re: CPU load optimization

Post by Granyte »

reducing poly count to reduce load on the cpu... let's not talk about it this is not where the issue lies.

I'm quite sure the issue comes from the amount of draw calls one way to optimize it would be instancing but atm irrlicht does not support it so you could use shader instancing
Post Reply