Page 1 of 1

Multithreading with BEPUphysics 14.3

Posted: Tue Nov 23, 2010 3:12 pm
by Yakmo
Hello,
I am a beginner in BEPUphysics and I try to understand it.
First I worked with the samples here http://bepu-games.com/BEPUphysics/documentation.htm
but I noticed that there were used different BEPU versions.

In the "Multithreading sample" is a .dll BEPUphysicsDrawer?
In a another sample (i think the first) is a other method to draw the Boxes..
It looks that the BEPUphysicsDrawer is easier.. but should I use the method (with a class (EntityModel)) in the first sample or the method in the multithreaded sample?

I want to programming a simple game using multithreading, because its important.
And in the using directives I can add "BEPUphysics.Threading". What is it?
If it a easier way to make multithreading, why isnt it used?

I hope someone can enlighten me..

and: Sorry for my english, I know it isnt good :oops:
i am from Germany.

LG, YAKMO

Re: Multithreading with BEPUphysics 14.3

Posted: Tue Nov 23, 2010 11:27 pm
by Norbo
It looks that the BEPUphysicsDrawer is easier.. but should I use the method (with a class (EntityModel)) in the first sample or the method in the multithreaded sample?
The "getting started" demo was made with the goal of exposing every step of the process, so the renderer used was pretty much the simplest possible implemented-from-scratch option.

The other demos are about setting up the physics themselves, so the focus isn't on the rendering. In those demos, the BEPUphysicsDrawer from the BEPUphysicsDemos is used. You can take a look at the source for the drawer within the BEPUphysicsDemos source.

The BEPUphysicsDrawer isn't intended to be a game's graphics engine, though. It's for prototype visualization and debugging mainly. You can use it to get stuff set up, but I highly recommend that you create a custom solution for your game if you intend to do anything other than multicolored blocks :)
And in the using directives I can add "BEPUphysics.Threading". What is it?
If it a easier way to make multithreading, why isnt it used?
BEPUphysics.Threading is the namespace containing the engine's thread task library and supporting classes.

It is used internally in the engine. You can use it externally too if you want, but when you enable multithreading, you're basically just telling the engine to use the stuff in the BEPUphysics.Threading namespace.

And enabling multithreading itself is pretty easy. You just have to tell the engine to use some threads and turn it on:

Code: Select all

            if (Environment.ProcessorCount > 1)
            {
                for (int i = 0; i < Environment.ProcessorCount; i++)
                {
                    Space.ThreadManager.AddThread();
                }
                Space.UseMultithreadedUpdate = true;
            }

Re: Multithreading with BEPUphysics 14.3

Posted: Wed Nov 24, 2010 12:18 pm
by Yakmo
Thanks!
Your post has helped me :)
I will use then a class like the "EntityModel" in the first demo.

I hope you will help me, if I get other problems.
And.. sorry for my english^^

LG
Yakmo