Adam's Lair Forum

game development and casual madness
It is currently 2020/02/17, 12:23

All times are UTC + 1 hour [ DST ]

Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 2013/11/20, 00:07 

Joined: 2013/11/14, 13:48
Posts: 2
Role: Hobbyist

I wrote a little application to get used to Duality.
The main goal of that application was to have a basis for a performance test against the original Duality and my fork.

I noticed two things that are not very clear to me.
I disabled gravity as well as any kind of damping.

I expected the overall speed of the balls should be constant.
If you start my application you can see that all balls gain speed over time and got faster and faster.

There seems to be some chaos factor in the collision routine.
The balls never act the same way.
Sometimes a ball got stuck in a corner and sometimes not.
I assumed that the balls should act the same way every time the application is started.

I uploaded my application to

Last edited by swtrse on 2013/11/20, 00:54, edited 1 time in total.

PostPosted: 2013/11/20, 00:34 
Site Admin
Site Admin
User avatar

Joined: 2013/05/11, 22:30
Posts: 2073
Location: Germany
Role: Professional
In general, physics in Duality is non-deterministic. There are various reasons for this, starting with variable timesteps and ending with machine-dependent floating point inaccuracy. I've researched a little on this topic, and it appears that there is no way to guarantee that, in the .Net environment, a given floating point operation will yield the exact same results across all machines and situations. You should however be able to improve the likelyhood of a locally deterministic behavior by switching on fixed-timestep physics in the Settings / Application Data menu - at the cost of visual glitches due to interpolation inbetween fixed physics frames.

I've also been able to reproduce the issue with increased energy in the closed system you've created, but unfortunately I don't have a complete explanation on this. Duality uses a custom port of the Farseer Physics engine - I think I've read something similar on some Farseer or Box2d forum where this exact behavior was discussed and I seem to remember that the answer was something along the lines of "There may always be a tiny energy increase". My suggestion would be to lose a tiny bit of energy using restitution values slightly below 1.0 or adding a very low damping value.

If your own research yields some insightful results, I'd be happy to hear them! Maybe there is a better workaround than the ones I've suggested, or even a solution somewhere out there.

Blog | GitHub | Twitter (@Adams_Lair)

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour [ DST ]

Who is online

Users browsing this forum: No registered users and 3 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group