Page 1 of 1

Searching Physics Library for Java Me

Posted: Sun Sep 03, 2006 9:45 am
by gkvoelkl
Hello,

I am writing a game for mobile phones with Java Me (J2Me).

Does anyone know a physics library that I can use?

Thanks.

Best Regards

Gerhard

Re: Searching Physics Library for Java Me

Posted: Sun Sep 03, 2006 5:38 pm
by SteveBaker
I have my doubts that a mobile phone would have enough CPU horsepower to run a pure physics solution...at least not if there are more than a small number of physically active objects or much scenery for them to collide against. I presume you'd need a pure Java library too - that makes matters even worse because Java code is slower than C/C++.

How many objects are you planning to have driven by the physics engine? How complex is the 'world' they'd have to interact with?

Posted: Sun Sep 03, 2006 8:05 pm
by gkvoelkl
Hi!

At the moment I am planning to do two different games:

Game 1:
like Marble Madness: One sprehre and some cubes as obstacles

Game 2:
Racing Game: One player car and three oponent cars and a terrrain.

Best Regards

Gerhard

Posted: Sun Sep 03, 2006 9:17 pm
by SteveBaker
For game 1, you can do really simple stuff yourself - the only force is gravity and there is only one moving object (essentially) - so do collision detection yourself (a sphere is the simplest object of all to do collisions with) - when you detect that you've collided and penetrated, it's trivial math to back the object back up along it's path until it's just touching - reflect the motion vector in surface normal of the surface you collided with and carry on with life.

If you get multiple collisions within one frame - calculate when in time you hit each one, deal with the first one - then rerun the physics when you've figured out what to do about it.

For game 2...you have a problem.