Box2D Nintendo DS

I've been playing with Box2d for a while on the DS. Up until now, using the floating point emulation code in the compiler.

This week, I sat down and wrote a FixedPoint Floating point class, which I now use instead of float's in the engine.

The good news is that the I have successfully gotten a large number of objects to be simulated at 30fps.

Anyway if anyone needs help for the FixedPoint Floating point class, let me know and I can share the code.



Phil
I was actually thinking of putting together a J2ME/Android version of Box2D, which would require some fixed point stuff, so I would definitely be curious to see your code. Unfortunately with Java on phones, it tends to be necessary to inline all fixed point stuff to have any shot at it running well, however I was considering writing a preprocessing step to handle this instead of doing it by hand, so I'd love to take a look at your code and see if it provides a good place to start that process from.

30 fps, huh? That actually gives me a bit of hope, the DS is comparable to the coming generation of phones, apart from graphics.
filharvey wrote:I've been playing with Box2d for a while on the DS. Up until now, using the floating point emulation code in the compiler.

This week, I sat down and wrote a FixedPoint Floating point class, which I now use instead of float's in the engine.

The good news is that the I have successfully gotten a large number of objects to be simulated at 30fps.

Anyway if anyone needs help for the FixedPoint Floating point class, let me know and I can share the code.



Phil


Hi Phil,

We are working on a casual AS3 game with Box2DFlash. We would like to port it to Nintendo DS. Could you share your "Box2DDS" code with us.
Thanks in advance!

Jozsef Trencsenyi
CEO
http://www.CasualGameStore.com
Mahjong Zodiac, Happy Melodies
You should really get in touch with the Crayon Physics author since this seems like the perfect use of Box2D on DS..
filharvey wrote:I've been playing with Box2d for a while on the DS. Up until now, using the floating point emulation code in the compiler.

This week, I sat down and wrote a FixedPoint Floating point class, which I now use instead of float's in the engine.

The good news is that the I have successfully gotten a large number of objects to be simulated at 30fps.

Anyway if anyone needs help for the FixedPoint Floating point class, let me know and I can share the code.



Phil


Would be really useful as I want to port Box2D to Symbian as a project to school:)

EDIT: Oh and a question...have you expirienced some overflow or low precision issues?
ewjordan wrote:I was actually thinking of putting together a J2ME/Android version of Box2D, which would require some fixed point stuff, so I would definitely be curious to see your code. Unfortunately with Java on phones, it tends to be necessary to inline all fixed point stuff to have any shot at it running well, however I was considering writing a preprocessing step to handle this instead of doing it by hand, so I'd love to take a look at your code and see if it provides a good place to start that process from.

30 fps, huh? That actually gives me a bit of hope, the DS is comparable to the coming generation of phones, apart from graphics.


I am playing with physics on mobile phones for some time. I implemented very simple rigid body engine in J2ME (dymix.hardwire.cz), however for some reasons I can't make it opensource (yet...I am working on a game using it and the company does not want to open it's source until the game is out). However, there are really not many things to see. My aim was to make it as fast as possible, so I didn't care about accurancy.
It uses uniform grids for broad phase, SAT for narrow phase, impulse based collision reaction (only one "iteration", so it is not iterative at all:D).
It runs on CX65 and N6600, but it's the limit.

I was really thinking about porting Box2D to J2ME before I made my engine, but from my expiriences the "average" mobil phone is currently still not able to run it.
However, if your target phones are N70 or better it will be no problem.
I too would be interested in this code for some stuff I'm playing around with.
I also ported Box2D to the DS. The modified library (which also includes the new convex decomposition code by ewjordan) is available from here:

http://blog.dev-scene.com/0xtob/2007/12/23/box2d-for-the-ds/

I'd still be interested in your code, since it would be interesting to see how you overcame some of the problems that porting to fixed point causes.
0xtob,

I took your fixed point code and tried to apply it to the current SVN code. I may have missed some stuff though.

I took a slightly different approach in that I redefined float32 to be either float or Fixed, depending on the compile time flag TARGET_FLOAT32_IS_FIXED. The result requires minimal changes to the existing SVN code. Compile the code with -DTARGET_FLOAT32_IS_FIXED and it should workl, although I did see a ball go through a wall in CCDTest!

I'm hoping that this code, or something like it, can be permanently added to the SVN code but I don't have write permission to do it.

BTW, I don't really know C++, so I may have made some subtle errors in adapting your Fixed.{h,cpp} code to the SVN code.
I have an updated version of the patch and Fixed definitions from my previous post. I also included 5 Makefiles that will build lots of stuff including float, fixed and nds versions of the library and float and fixed versions of the TestBed.

Original thread: https://box2d.org/forum/viewtopic.php?t=124