Hi there
I have a rather simple question, i think.
I have a very simple system set up - a few rectangles, circles etc. I then fire small "balls" with a "cpBodyApplyImpulse" out into this field of simple objects. There's no gravity or anything - and everything has elasticity and friction of 1. The balls behave rather randomly, i'm afraid - and i'd like a very deterministic setup.
I've tried setting a very high amount of iterations - but that doesn't help, I'm afraid. Any ideas?
greetz!
deterministic behaviour?
-
- Posts: 5
- Joined: Thu Jul 23, 2009 9:17 am
- Contact:
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: deterministic behaviour?
You can get deterministic behavior if you reset the shape id counter. Read here: http://code.google.com/p/chipmunk-physics/wiki/cpShape
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 5
- Joined: Thu Jul 23, 2009 9:17 am
- Contact:
Re: deterministic behaviour?
That helped! It's not 100% - but might be close enough.
thx!
thx!
-
- Posts: 5
- Joined: Thu Jul 23, 2009 9:17 am
- Contact:
Re: deterministic behaviour?
Hmm. The system is still a bit too un-deterministic. Is there anything else I can do to tighten it up?
-
- Posts: 157
- Joined: Mon Aug 20, 2007 12:53 pm
- Location: London, UK
- Contact:
Re: deterministic behaviour?
It should be easy to get it completely deterministic. Make sure you're adding the shapes in the same order and using a fixed timestep.
- Tam Toucan
- Posts: 141
- Joined: Tue Jun 23, 2009 4:26 pm
- Contact:
Re: deterministic behaviour?
Chipmunk doesn't have any random code in it i.e. the same code runs the same way each time. So if you are getting non-deterministic behaviour it must be introduced from your use of it e.g. as maximile says, adding the shapes in a different order, calling it with different timesteps.
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: deterministic behaviour?
Be careful of trying to achieve too much determinism though. While you can make it run the same way on the same machine, change the processor or compiler or compiler flags and it will be different because of subtle changes in floating point behavior.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 5
- Joined: Thu Jul 23, 2009 9:17 am
- Contact:
Re: deterministic behaviour?
allrighty... i'll drill further down to get a bit more determinism. Thanx for your input, folks!
Who is online
Users browsing this forum: No registered users and 18 guests