hi,
Francesco has tested with me, so here what we get:
the test has been done on a win 7 64bit intel laptop, 32bit ubuntu laptop, 32bit (but 64bit cpu) arch linux desktop, an eeepc with celeron ~800MHz and arch linux 32bit.
All SUN JVM, no openJDK tested. JVM architecture was the same of the SO, so actually we can say Jbox2D IS deterministic, at least more than 1000 tick of DominoTower test.
Now another friend of mine gift me an very old mac ( Power Macintosh G4 867 (Quicksilver) ) and i'm going to resurrect it and then test it.
Ah the error in the test was that we "strictfp"ed all jbox2d engine, but not the test class where the body was created and translated
we found this out starting from the fact that the simulation was diverging since turn 0 (only creation, no update). Also probably there was an error in the recording "trigger"..
1. strictfp all jbox engine class
2. in DinamicTree, MathTest e MathUtils, change all "new Random()" to "new Random(5)" (it's important it's 5 if you want test against my file)
3. ypu shoul make the org.jbox2d.testbed.tests.DominoTower strictfp
4. add this function to TestbedTest:
Code:
public int getStepCount(){
return m_stepCount;
}
5. in TestPanel, run method, after
Code:
render();
update();
paintScreen();
frameCount++;
put:
Code:
if (currTest!=null && currTest.getStepCount()%100==0) {
stepMondoFisico++;
Body body = currTest.m_world.getBodyList();
File file = new File("Unknow Test "+fileCount+".txt");
System.out.println("Saving file...");
FileWriter writer = null;
try {
writer = new FileWriter(file);
} catch (IOException ex) {
Logger.getLogger(TestPanel.class.getName()).log(Level.SEVERE, null, ex);
}
while (body != null) {
try {
writer.append("X " +Float.toHexString( body.getPosition().x ) );
writer.append(" Y "+Float.toHexString( body.getPosition().y) );
writer.append(" A "+Float.toHexString( body.getAngle() )+"\n");
} catch (IOException ex) {
Logger.getLogger(TestPanel.class.getName()).log(Level.SEVERE, null, ex);
}
body = body.getNext();
}
try {
writer.close();
} catch (IOException ex) {
Logger.getLogger(TestPanel.class.getName()).log(Level.SEVERE, null, ex);
}
System.out.println("Should have wrote "+currTest.m_world.getBodyCount()+" bodies");
System.out.println("File saved as: "+file.getAbsolutePath());
fileCount++;
}
test the results of the 10000 turn (file number 100).. it should be equal for everyone!