Physics performance problems

Everything about development and the OpenMW source code.
User avatar
Site Admin
Posts: 1193
Joined: 05 Aug 2011, 22:21
Location: Wroclaw, Poland

Physics performance problems

Post by lgromanowski » 15 Aug 2011, 10:09

Sadler2 wrote: You have a performance hole in your physics code.

Code: Select all

bool OMW::Engine::frameRenderingQueued (const Ogre::FrameEvent& evt)
... engine.cpp:195: 
mEnvironment.mWorld->doPhysics (movement, mEnvironment.mFrameDuration);
... engine.cpp:204: 
Works on every frame. If I have 1000 FPS for video, it will calculate the physics 1000 times. It's huge work for CPU. For example, on my machine it dropped framerate from 60 to 20 FPS. Physics must be calculated periodically (maybe 25 times per second ? ), but not on every frame.
gus wrote: Bullet don't do the physic everytime the dophysic function is called. Bullet do a simulation 33 (or 50 don't remember) per second, and do some interpolation when the elapsed time is too short.

But we might me able to lower the number of simulation per second. Maybe 20 could do.
Zini wrote: Let's wait with this kind of optimisations until we have enough movement in the game to see, if it has negative effects on the smoothness of the movements.
Sadler2 wrote: @gus: oh, yeah, I forget...

I'm using the profiler to know, why framerate in Seyda Nenn on one of my machines looks like 3-4 FPS (while in original Morrowind it's significally higher). I can't test the OpenMW without optimisations like this. Now I'm see, that physics is very slow ( 90% of time spends on btVector multiplication! ). I think, this is not a problem with bullet, because I'm using the Bullet engine in my projects and I know, how fast bullet may work.

Specs of that machine:
CPU: AMD Athlon X2 3800+
Video: NVidia GeForce 9800GT
OS: Windows XP SP3 (x86)
Zini wrote: There is a problem with performance and other people's tests have indicated that it is located in bullet (probably a configuration problem). According to your own data limiting bullet updates would not cause a performance improvement (if you only have 3-4 fps, limiting bullet to 30 updates per second won't help, because you are already down to 3-4 updates per second).

Your problem is a known bug ( and gus has promised to look into it.
best regards,