Hey there : )
First off, thanks for all of the hard work you all do with Bepu. I've used it for about a year now across a couple of projects and have loved it. You guys rock!
I'm doing my first Xbox project with Bepu and have gotten to the point where we need to start optimizing. We are only really using the physics system to detect collisions (Wall detection, detection between bullets/enemies, etc.) and don't need many of it's advanced features. We started by attaching entities to our game objects, a couple of collision groups/rules to prevent collision between certian objects, and handling collision events. Are there any docs or examples out there to start getting better performance out of our Xbox project? I guess my question is "where do I start"?
Thanks!
Question about starting optimizations.
Re: Question about starting optimizations.
Thanks!First off, thanks for all of the hard work you all do with Bepu. I've used it for about a year now across a couple of projects and have loved it. You guys rock!
Not specifically dedicated to that, but there are some general pointers.Are there any docs or examples out there to start getting better performance out of our Xbox project?
First, using multithreading is very important. It's also important to manage the threads so that they aren't fighting each other or other systems while updating. More information can be found in the internal multithreading documentation: http://bepuphysics.codeplex.com/wikipag ... umentation
Apart from that, you could check out the BEPUphysicsDemos' ConfigurationHelper. It shows a variety of different tuning parameters you can use to adjust the simulation.
Some other common things are:
-ConvexHulls with too many points. Minimize the number of points for better performance.
-Collision mesh detail. If an object colliding with a mesh has tons of triangles intersecting its bounding box, it will be a lot slower. However, don't make individual triangles TOO gigantic. It's okay/recommended to tessellate the mesh a bit to avoid excessively large triangles.
-Keep to a good scale. 0.5 to 10 units per object (such as a triangle) is a good range to strive for. Going a bit above it is fine, but going too far (100, 1000..) will stress the collision detection system and slow things down (and harm simulation quality).
-If the game can run at 30 fps, it may be worth trying to run at a timestep length of 1/30 instead of 1/60. Quality will be noticeably worse, though.
-If there are update stages that are completely unneeded by your game, you can turn them off. For example:
Code: Select all
space.Solver.Enabled = false;
To really drill down into the problem, you'll have to first identify what you're being bottlenecked by. Downloading the source will help you profile in more detail. It's extremely difficult to guess the causes of performance problems without good measurements. ANTS/SlimTune/CLR Profiler and others will be very valuable. Traditional high level per-frame or per-stage timings are useful too.I guess my question is "where do I start"?