Page 1 of 1

get physics frame by frame and for precise instants

Posted: Fri May 11, 2012 10:58 pm
by deveroper
Hi!
I'm developing a little software to simulate the behavior of some launch...
I've seen BEPU and i'm wondering if this engine can do precise and real calculations userful for a simulation (i should extract data like position, rotation etc and put it in a serious report)...

If yes, as i don't really need live-calculations and probabily i will have to set a very highr FPS (maybe more than 1000fps) (again, i will let the computer all the time to calculate all frames), how can i make BEPU perform calculation for precise and determined (by me) time instants? i mean, i want to make BEPU calculate the physics for the time 0,01224sec 0,01228sec etc...

thanks

Re: get physics frame by frame and for precise instants

Posted: Sat May 12, 2012 2:07 am
by Norbo
I've seen BEPU and i'm wondering if this engine can do precise and real calculations userful for a simulation (i should extract data like position, rotation etc and put it in a serious report)...
It may be doable, depending on the simulation's requirements. This engine's focus is games and performance instead of perfect fidelity, so there are areas to watch out for. For example:
-In the default speed-focused multithreaded form, it is not deterministic. Disabling threading on the solver, broad phase, and narrow phase will ensure that threads do not interfere with determinism, but platform nondeterminism can still exist.
-It uses single precision floating point arithmetic by default. The math libraries could be swapped out (most easily with the dependency free version), but the numerical tolerances used by the engine would also need to be adjusted.
-Contact manifolds are simplified down to no more than 4 contacts associated with a single convex-related pair for performance. This isn't usually a problem even for very high accuracy requirements, but it is fundamentally still an approximation.
-Contact constraints are built from the manifolds and are themselves approximations- especially the 'twist vs. slide' friction model.
-Some rotational behavior is ignored by default for performance and stability. Enabling the MotionSettings.ConserveAngularMomentum can bring it closer to reality.

There are other things, though whether or not they matter depends on what you need. Decreasing the time step duration and increasing the solver quality while managing any relevant numerical issues will give some very high quality, though.
how can i make BEPU perform calculation for precise and determined (by me) time instants? i mean, i want to make BEPU calculate the physics for the time 0,01224sec 0,01228sec etc...
Each Space.Update() call performs a single time step of length Space.TimeStepSettings.TimeStepDuration. So, if the desired time falls precisely on one of these timestamps, the information can be found quite easily by taking the required number of steps. If it doesn't land on one of these steps, interpolation would be required between the neighboring steps. Frame-by-frame state logging to be useful for post-simulation analysis.

One very necessary disclaimer:
I would strongly advise against relying on the results of these simulations for anything critical to life, limb, or property. I wouldn't want a person to get blown up because of a sneaky bug in the engine somewhere :)

Re: get physics frame by frame and for precise instants

Posted: Sat May 12, 2012 7:36 am
by deveroper
Thanks much for your reply!
don't worry... bad calculations in my case couldn't kill anyone... except me because my client could kill me when discover that my software printed reports that do not have affinity with reality... hahaah

Ok, so i to understand there is much work to do to make this engine work for my scopes... and this is normal as this is a game-oriented engine...

Could you suggest me some other library/engine (free/opensource would be perfect) that is naturally results-oriented ?

Re: get physics frame by frame and for precise instants

Posted: Sat May 12, 2012 2:29 pm
by Norbo
Could you suggest me some other library/engine (free/opensource would be perfect) that is naturally results-oriented ?
Sorry, I don't know of any off the top of my head. All of the engines I know of perform similar approximations (but not necessarily the same ones).

Strong guarantees of realism usually come with industrial simulation software, but those typically aren't both free and open source as far as I know. :)