Box2D for Android NDK

Doug Schafer mentioned an Android port: http://cdtdoug.blogspot.com/2009/07/qt- ... sings.html
tehdanish, it's cool you have Box2D working with the ndk!
How is the performance? Did you try it with some demos from the testbed?
Cheers
g
Performance is good, especially in comparison to JBox2D with multiple objects on screen.
See: http://groups.google.com/group/android- ... 2c5d6857cb
The last post by Aki contains a link to some of his sources and an APK. The apk is a bit of a performance testbed for JBox2D and NDK Box2D.. in NDK Box2D you can add 46 balls all bouncing off of each other without any (noticeable) lag.
JBox2D it starts chugging after a couple of balls (garbage collecting).

I haven't had a chance to port the Testbed as I'm currently working on a game (with a friend) using NDK Box2D for the Android Developer Challenge 2, not sure if we'll finish in time as it is.
Would be good to define a JNI Box2D interface enough to be able to handle all of the testbed demos though.
hi guys!

i realize this is an old post, just wanted to contribute with performance tests real quick. This isn't very formal so sorry about that. Code is run on the G1, HTC Dream.

A elapsed (ns) 12551361066 ticks: 201 .... JBox2DWorld@432a4de8
B elapsed (ns) 12445343015 ticks: 201 ....JBox2DWorld@432a4de8
C elapsed (ns) 13418609617 ticks: 201 .... Box2DWorld@432a4de8
D elapsed (ns) 1508514408 ticks: 201 .... JBox2DWorld@432a4de8

A elapsed (ns) 2824676514 ticks: 201 .... JNIBox2DWorld@4322d5f0
B elapsed (ns) 2314758303 ticks: 201 .... JNIBox2DWorld@4322d5f0
C elapsed (ns) 2784484863 ticks: 201 .... JNIBox2DWorld@4322d5f0
D elapsed (ns) 246185304 ticks: 201 .... JNIBox2DWorld@4322d5f0

Elapsed times are elapsed duration of 201 world.step's

Speed factors:
A 4.44 - things are just starting to fall and statics objects are put to sleep
B 5.38 - more collisions
C 4.82 - ...
D 6.13 - with even more collisions and libbox2d performs over 6 times!!

I'm having approximately 20 objects. Period A is longer because half of the objects are put to sleep.

The initial setup is identical for both JBox2D and JNIBox2D. I'm timing only the world.step(...)
method. Note this test does not account for updating java bodies' positions through JNI, which is not required
for JBox2D.

Note that while this is very very cool, running physics simuli 4.5 times faster, things get clumsy very quickly.
Passing data back and forth between java and libbox2d.so is cumbersome and another performance killer. But
I'm still going for the jni version!

Hope this can give at least a performance overview.

Kris
Hi,
I am very interested in tehdanish work. But unfortunately, the download links are down... I would like know if it is available elsewhere ? If not, maybe somebody could put the two projects somewhere ?
Thx !

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