Bullet in BGE performance issue

Post Reply
mirkovich
Posts: 3
Joined: Mon Mar 31, 2014 2:59 am

Bullet in BGE performance issue

Post by mirkovich »

Hello.

I'm using the Bullet that comes with the Blender Game Engine (using last Blender, 2.70). I found a place that says that it's a modified Bullet 2.80 (correct me if I'm mistaken).

I have a couple of complex shapes that uses triangle mesh, and also I have a LOT of constraints with other bodies. So, in the Blender Game Engine I spend A LOT of time doing physics. In fact, it doesn't reach out the FPS that I put.

What I'm observing is that, at least in Windows, it's using only one core (CPU use reports 25% on a quadcore). This is has a MAJOR impact on the work I'm doing (having 20FPS, if I could have all four cores, I could easily have 60FPS and still have some margin). I've read that collision detection and constraint resolution uses parallelization, but this doesn't seem to work ok. Am I mistaken or there's some configuration that needs to be done?

Thank you.
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: Bullet in BGE performance issue

Post by Basroil »

It's not really a blender or bullet issue, rather the fact it's just single threaded. Last I knew the collision detection was never modified in blender to allow multithreaded collision detection. They also don't implement multithreaded island solver (calculating each island separately in parallel or using the multithreaded solver) despite the fact it's not all that hard to brute force (when assuming a few islands with many items each it's not that bad).

Basically, until bullet 3.0 is ready (and included in blender) or blender decides to implement their own threading solutions, your only choice is to make the changes yourself and then recompile blender.
mirkovich
Posts: 3
Joined: Mon Mar 31, 2014 2:59 am

Re: Bullet in BGE performance issue

Post by mirkovich »

Basroil wrote:It's not really a blender or bullet issue, rather the fact it's just single threaded. Last I knew the collision detection was never modified in blender to allow multithreaded collision detection.
I've read: "Parallelization, Optimizations (Playstation 3 SPU, XBox 360, Win32 Thread support for collision detection and constraint solver)" on http://www.bulletphysics.org/mediawiki- ... ously_Done

Doesn't that mean that it supports multiple threads on Windows?

Thank you.
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: Bullet in BGE performance issue

Post by Basroil »

mirkovich wrote: Doesn't that mean that it supports multiple threads on Windows?
That means it CAN support multiple threads, but only if set up that way. Blender has never really considered Bullet performance and stability to be a priority, and they won't be changing their stance any time soon (too many anti-windows people to make sure more complicated things like multithreaded bullet work on all platforms)
mirkovich
Posts: 3
Joined: Mon Mar 31, 2014 2:59 am

Re: Bullet in BGE performance issue

Post by mirkovich »

Basroil wrote:
mirkovich wrote: Doesn't that mean that it supports multiple threads on Windows?
That means it CAN support multiple threads, but only if set up that way. Blender has never really considered Bullet performance and stability to be a priority, and they won't be changing their stance any time soon (too many anti-windows people to make sure more complicated things like multithreaded bullet work on all platforms)
I've found that Bullet User Manual says
Win32 Threads, pthreads, sequential thread support
Basic Win32 Threads, pthreads and sequential thread support is available to execute the parallel
constraint solver and parallel collision dispatcher. See Demos/BulletMultiThreaded for an
example.
If I recompile it should I be able to make it work? Is that easy?
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: Bullet in BGE performance issue

Post by Basroil »

mirkovich wrote: I've found that Bullet User Manual says
Win32 Threads, pthreads, sequential thread support
Basic Win32 Threads, pthreads and sequential thread support is available to execute the parallel
constraint solver and parallel collision dispatcher. See Demos/BulletMultiThreaded for an
example.
If I recompile it should I be able to make it work? Is that easy?
Bullet is not a single pipe to solve physics, you can use what you need to, one of those options is Sequential Impulse solver (the most worked on, and what Blender uses), but there are other solvers like MLCP solvers and Multi-Threaded PGS. If you were to actually look at the demo you would see why it's different, and you should check the code.

As for recompiling Blender... Just getting a project file set up to work with VS2010/2013 is a pain, since most of the developers are linux junkies that absolutely hate Windows (despite most of their user base using it). If you can manage that, it literally involves rewriting a half dozen lines of simple code. That doesn't mean it will work 100% though, the multi-threaded code is fairly old and was dropped in favor of 3.x
Post Reply