Pure Java Port of ODE - planning/feasibility

If this class is simply matrix and quaternion mathematics, why not just cut and paste from javax.vecmath? Aside from euler angles, I’d imagine most of this work is already done.

It might also be a good idea to treat ODE as a guide and use it to shape your overall architecture rather than try to duplicate each individual line of code. Perhaps, if this is to be a community project, a good aproach woudl be to design an ODE like architecture, publish a UML document or write interfaces for the most important classes and packages, and open it up to folks at large to develop the individual parts?

Also, how goes the progress with the dev.java.net account? It’s akward to look at your code and difficut to contribute anything unless we can access a CVS repository. (If you’re hung up in admin issues, if you post to the java-net board, some admin folks will help you out).

Mark McKay

[quote]If this class is simply matrix and quaternion mathematics, why not just cut and paste from javax.vecmath?
[/quote]
Becuase the storage mechanisms are not the same and ODE uses alot of functions not in vecmath. It also does magic things like use the vector functions with its matrices and stores lists of matrices and vectors all in the one storage mechanism (and then mixes all the functions that are applied to them). I think the port will be very difficult trying to neaten it up as we go along. I think what would work though is implement it and then do some clever wrapping to provide uses with nice interfaces to the mess.

[quote]how goes the progress with the dev.java.net account?
[/quote]
Dunno. I did seem to be making progress but now alas nothing. I don’t know where Jeff is. I have been trying to email him :frowning:

[quote]It’s akward to look at your code and difficut to contribute anything unless we can access a CVS repository
[/quote]
Yeah I know. I don’t really expect anyone to do anything with that code I posted. Not even read it.

On a general project coding front I have jsut implemented the LCP algorithm (only the slow version), and also the test harness. Unfortunatly the tests are failing :frowning:


LCP internal error, s <= 0 (s=-0.0)
A*x = b+w, maximum difference = 29.995323
FAILED: i=3 x=0.33648005 w=0.0 lo=-Infinity hi=0.0
FAILED: i=7 x=0.75172126 w=0.0 lo=-Infinity hi=0.0
FAILED: i=10 x=0.31791627 w=0.0 lo=-Infinity hi=0.0
FAILED: i=11 x=0.5623604 w=0.0 lo=-Infinity hi=0.0
FAILED: i=12 x=1.1555656 w=0.0 lo=-Infinity hi=0.0
FAILED: i=14 x=0.40152782 w=0.0 lo=-Infinity hi=0.0
FAILED: i=17 x=0.07633107 w=0.0 lo=-Infinity hi=0.0
FAILED: i=18 x=1.1700702 w=0.0 lo=-Infinity hi=0.0
FAILED: i=21 x=0.3868724 w=0.0 lo=-Infinity hi=0.0
FAILED: i=22 x=0.27218696 w=0.0 lo=-Infinity hi=0.0
FAILED: i=26 x=1.0934172 w=0.0 lo=-Infinity hi=0.0
FAILED: i=29 x=0.057841647 w=0.0 lo=-Infinity hi=0.0
FAILED: i=32 x=0.02228606 w=0.0 lo=-Infinity hi=0.0
FAILED: i=34 x=0.9545406 w=0.0 lo=-Infinity hi=0.0
FAILED: i=35 x=0.8431248 w=0.0 lo=-Infinity hi=0.0
FAILED: i=39 x=0.8896973 w=0.0 lo=-Infinity hi=0.0
FAILED: i=41 x=0.49647236 w=0.0 lo=-Infinity hi=0.0
FAILED: i=44 x=0.44761813 w=0.0 lo=-Infinity hi=0.0
FAILED: i=45 x=0.69401413 w=0.0 lo=-Infinity hi=0.0
FAILED: i=46 x=0.5576692 w=0.0 lo=-Infinity hi=0.0
FAILED: i=48 x=0.27824977 w=0.0 lo=-Infinity hi=0.0
FAILED: i=49 x=0.22342157 w=0.0 lo=-Infinity hi=0.0
passed: NL=7 NH=2 C=69
time=117876000 ns  avg=64194725000

Not in all cases (100 are run each test case and in this case 69+2+7=78 have passed) but obviously something is not right somewhere. I wonder if anyone has a working copy of ODE they coudl tell me if any at all fail in normal testing operation. The function is dTestSolveLCP(). That method may even be available in javaODE. I don’t know though.

Damn it is 3.30a.m. and I am in my office! I have a half hour walk home yet :frowning:

Still JOODE is shaping up! :slight_smile:

I’m sorry I don’t answer very often, but I’m present and follow this so interessant discussion.
I agree with kitfox, that ODE should be a guide for how to shape the architecture of JOODE.
I continue to study physics and maths (unofficially) and I’ve done a mini-“physics engine” with :

  • Sphere / Sphere collision detection (not that hard…)
  • Rectangle / Rectangle collision detection (needed for a 2D platform game I work on)
  • Basic reaction :
    • First, I implemented the “go last step but one when a collision happens” method
    • I replaced it with a separate X / Y detection collision, that permits to slide along X or Y axis
    • And now I’m making a slightly better slide algorithm using the collision normal (rectangle represented by four planes)
      It’s really not a big work, as I’m implementing just what I need for my game, but I’m thinking further, for example how to check collisions with irregular objects (trimeshes ?) :
  • May it’s a good idea to make OBB trees that shape the mesh ?
  • Maybe for terrain we can deal directly with heightmap values ? That would avoid the “pass-through” bug in ODE (the dTerrain class was supposed to correct that, huh ?)

I will continue to learn all the physic-related material that I can find, and I will contribute as soon as we have a CVS somewhere.
Oh, and maybe should we make an account on sourceforge.net, and that for two major reasons :

  • Jeff seems to be in vacation… :smiley:
  • Maybe it’s time to reconciliate Java and the Open source world… That’s another debate but… I’m not sure java.net should host projects like JOODE, Xith3D, LWJGL… these are open source projects, and sourceforge.net is made for that.

LWJGL is on sourceforge.net

You did? Isn’t that called swept collision detection? How did you manage to construct the convex bound around the last step and this step in real time? Looks like people might pay you alot of money for that… :o

DP

[quote=“Jeff,post:3,topic:24170”]
It seems like it’s going to take loads of time for our project to get approved. So we really should switch to sourceforge then.

Arne

[quote]It seems like it’s going to take loads of time for our project to get approved. So we really should switch to sourceforge then.
[/quote]
myeah. What a pain. I shall start the admin now…

Oh and as for.

[quote]I agree with kitfox, that ODE should be a guide for how to shape the architecture of JOODE
[/quote]
I also agree somewhat with Kitfox. The overall archetecture should be improved. There are multiple implementations of different algorithms in ODE, selected with preprocessing. There are differently optimized versions fo the stepping algorithm and LCP algorithm for example. I am thinking these will be tinkered with using an AbstractFactoryPattern in Joode.
The choice for data representation for the underlying vectors and matrices is a totally different situation though. Changing how they are stored creates a major porting headache becuase they are used and abused everywhere in the ODE source. Changing the high level architecture is not a big implementation issue, changing the fundamental mathmatical framework the code is built apon is. I also beleive that benifits of changing the way vectors are stored can be obtained using a simpler implementation option. Instead of changing all the ODE code to use a new mechanism we can write a wrapper to their mechanism and make it look as pretty as we like for the users of the library. Thus we can easily port the code, and provide a nice interface to the system, a win-win situation.

Right…

OK. So sourceforge is pending now. Max of 2 business days they say (If no problems are highlighted).

Hey, does Source-Forge support Subversion repositories yet? If so, I suggests using Subversion over CVS.

(Funny that Java.net doesn’t seem to have Subversion support, given that it is a produyct of Collabnet, the group behind subversion.)

No subversion for sourceforge :frowning:

Oh, so LWJGL is still better than I thought… :slight_smile:

I wish I had ! No I simply tested collision at each step, no swept collision detection in here. However, it shouldn’t be so difficult to do… maybe too time-consuming in real-time… but not impossible.

I also agree somewhat with Kitfox. The overall archetecture should be improved. There are multiple implementations of different algorithms in ODE, selected with preprocessing. There are differently optimized versions fo the stepping algorithm and LCP algorithm for example. I am thinking these will be tinkered with using an AbstractFactoryPattern in Joode.
The choice for data representation for the underlying vectors and matrices is a totally different situation though. Changing how they are stored creates a major porting headache becuase they are used and abused everywhere in the ODE source. Changing the high level architecture is not a big implementation issue, changing the fundamental mathmatical framework the code is built apon is. I also beleive that benifits of changing the way vectors are stored can be obtained using a simpler implementation option. Instead of changing all the ODE code to use a new mechanism we can write a wrapper to their mechanism and make it look as pretty as we like for the users of the library. Thus we can easily port the code, and provide a nice interface to the system, a win-win situation.

Right…
[/quote]
+1
for having the ODE structure and the clean structure together.
We could have a class like a RealArray, that can contain Matrices, Vectors…, but works like the ODE Real.
RealArray on the other hand could work also like a normal array of Objects of type Real.

I would like to suggest that the JOODE team gives java.net another try. It looks like the JOODE account has been set up; it’s simply not been logged into by the project owner yet. I’ve set up several projects on java.net, and everything’s been set up and working well in a couple of days. If the owner is having problems with the java.net account, simply post to the forums at https://java-net.dev.java.net/, and the staff who read it are quite friendly and capable of guiding folks who are setting up accounts there.

The account alway get’s created, but it’s only accesable by the project owner, until it got approved. But because Jeff has so much to do, he can’t approve and do all this stuff, so the project is there, but it doesn’t get approved. -> We aren’t able to acess it, so it’s as if it doesn’t exist.

indeed. The holdup is on getting approval. We can switch over to java.net once it finally gets approved and sourceforge can be the intermediate. Although maybe we will get entrenched in sourcforge so who knows. I don’t know the feature comparisons.

I have emailed Jeff directly (and CC’d Tom). Java.net would be best - have everything in the one place. If it doesn’t get approved soon though, going with SF is a good alternative.

Sorry I havn’t been replying more, I have just got a job (more details later) and thus am rather busy.

Will.

Woo! I have the first simualtion running! Mind you I have not plumbed in any graphics so I cannot see if it is working ???

Jeff is making no promises on how long he will take to approve our project. The sourceforge one should be valid soon. I have an assignment in 2morrow which I have neglected and it is now 2.30a.m. Hmmmmmm. Oh well, if I can cobble it together as fast as this physics engine I might be ok :stuck_out_tongue:

Right. Well the basic archetecture is running now.
You can access the source be downloading
http://homepages.inf.ed.ac.uk/s0570397/joode-src.tar.gz

OR

you can get it from…

At the moment I have only uploaded the source, I did not want to spend hours uploading to their CVS repository if we are gonna switch Jeff willing, sourceforge do not suppor the -r command so its incredibly tedious uploading files.

To test the functionality I have currently put a dependancy on Xith3D. So you will need those packages in your runpath and you will need to set you java.library.path system variable with the -D VM option before you will be able to run the jaw dropping demo:

net.java.dev.joode.test.step.SphereCollisionTest

Under the bonnet I have struggled to get this working. I have implemented two stepping algorithms, x1 and x2. x2 is the highly optimized stepping algotihm but it does not work, and x1 only works when it uses the SlowLCP implementation (although that is the best option for it to use, you will see the options at the top of the source for that class)
I have only implemented the unoptimized version of the LCP algorithm, though I do beleive that is working.

The Space architecture is in place currently, but only simple space exists.
The geom architecture is in place, but only spheres are in place
The collision architecture is in place, but only a SphereSphere, and a GeomSpace collider is implemented.
The Joint implementation is messy but in place, but only collision (i.e. Contact) joints exist.
Bodies and dynamics are working.
Mass is partially implemented (the core is there but loads of minor methods are missing).

So I dunno if people want to get started yet, or to wait until we get java.net. The damn package names are all wrong >:(

If you want to get eased into development then I suggest implementing some geoms. There are fairly straightforward and you can copy the style of the Sphere class easily. Slightly more advanced would be to implement extra Joints. Or better yet get rid of all the crazy virtual tables and suchlike, they are this crazy way ODE used to store all joint information in one data area. I think it is fairly easy to turn all the virtual functions into abstract methods of a joint superclass.
Hardcore people might want to try and tackly the stepIsland_x2 method or the LCPFast (and abstract the LCP class so it can be switched)

The stepIsland_x1 method shows how easy it can be to translate ODE source when using the RealPointer class. It was necissary becuase the code got so painfully obscure, though simple ports of functioanlity perhaps won’t need to use this class.
All the diverse math functions have been lumped into a class called MathUtils. Almost all math methods I could find have been cut and pasted into there (and then hidden from the compiler in comment) so if a math method is missing, its source is probably hidden in that file. I have heavily overloaded some of the methods so it might look a bit bizairre how to use some of the methods but I will clarify that when required.

To Joode!

Prospective developers:-
Please PM me with sourceforge account details so I can give you developers access. I don’t think Jeff is gonna do anything this week again so I think we should just work on sourceforge for the time being.

Ok I registered now at sourceforge - I should have my account tomorrow then. I’ve seen, we’ve got forums there, too - so we could also use those, but actually I think this is a bad idea, because if we keep posting here more people are reading the stuff, so more people are able to answert the question. Who implements what questions should of course discussed there.