Search found 17 matches

by Driscoll
Wed Jul 27, 2011 3:58 pm
Forum: Java
Topic: getBodyCount() returning incorrect numbers?
Replies: 1
Views: 845

Re: getBodyCount() returning incorrect numbers?

I figured this out, I was calling destroyBody on some bodies twice. I'm not sure if it was breaking anything, but it was definitely messing with the body count.
by Driscoll
Thu Jul 14, 2011 11:25 pm
Forum: Java
Topic: Can JBox2d be deterministic?
Replies: 22
Views: 7561

Re: Can JBox2d be deterministic?

Awesome man, thanks!
by Driscoll
Sun Jul 10, 2011 7:37 pm
Forum: Java
Topic: getBodyCount() returning incorrect numbers?
Replies: 1
Views: 845

getBodyCount() returning incorrect numbers?

In my app, I'm calling m_world.getBodyCount() just for testing purposes. But I'm seeing pretty weird results: Let's say I start with 100 bodies. If I add 10, it goes to 110. When those get deleted, it goes to 90. Every time I do that, it drops by 10, and eventually goes into negative numbers, even t...
by Driscoll
Sun Jul 10, 2011 7:32 pm
Forum: Java
Topic: Can JBox2d be deterministic?
Replies: 22
Views: 7561

Re: Can JBox2d be deterministic?

Strictfp shouldn't be necessary, at least from what I've found. Did you try this yet?

viewtopic.php?p=31266#p31266
by Driscoll
Sun Jul 10, 2011 7:30 pm
Forum: Java
Topic: Determinism and Jbox2d -- Problematic workaround found!
Replies: 2
Views: 1031

Re: Determinism and Jbox2d -- Problematic workaround found!

I had this same problem a while ago. The source of the problem turned out to be in DynamicTree.java There is an instance of Random there that's getting initiated without a seed. I changed it to this: private final Random rand = new Random(0); And that fixed all my problems. Just SVN the source and m...
by Driscoll
Sat Jun 04, 2011 11:00 pm
Forum: Java
Topic: Can JBox2d be deterministic?
Replies: 22
Views: 7561

Re: Can JBox2d be deterministic?

Thanks so much man, that fixed it. When I searched for all calls to Random in the source code, I only found the ones in MathUtils, which as far as I can tell, aren't ever called in the library itself. I missed the one in DynamicTree, which was the culprit. And to think I had given up hope on this pr...
by Driscoll
Sat Jun 04, 2011 12:19 am
Forum: Java
Topic: Can JBox2d be deterministic?
Replies: 22
Views: 7561

Re: Can JBox2d be deterministic?

Yeah. The problem is that I've made the test as simple as possible, and verified that the worlds are identical after they are created. Then they are left to run with no further input, but still diverge 50% of the time. I know the C++ version of Box2d is said to be deterministic, at least on one comp...
by Driscoll
Fri Jun 03, 2011 7:47 pm
Forum: Java
Topic: Can JBox2d be deterministic?
Replies: 22
Views: 7561

Re: Can JBox2d be deterministic?

I've spent a bunch more time on this. I still haven't gotten to the bottom of it. Using the vanilla 2.1.2 alpha, the simulations match about 50% of the time. I was generating the world with the same random seed (0). I also tried generating a world that is just a grid of boxes. In both simulations, I...
by Driscoll
Thu Jun 02, 2011 8:15 pm
Forum: Java
Topic: Can JBox2d be deterministic?
Replies: 22
Views: 7561

Re: Can JBox2d be deterministic?

Okay, actually it's only working some of the time. I have no idea.
by Driscoll
Thu Jun 02, 2011 7:34 pm
Forum: Java
Topic: Can JBox2d be deterministic?
Replies: 22
Views: 7561

Re: Can JBox2d be deterministic?

Also, I tested my framerate in a world with a few hundred objects, and it was unaffected by the use of strictfp.

Hopefully someone else will find this useful. Any chance of this being implemented in the main trunk of the library?

Go to advanced search