Integrating Box2D with MonoTouch?

*Not quite sure if this is the right place to post this, the problem at its heart is related to getting the code to build but the nature of the problem is a bit more broad than that.

Hi Guys,

My problem is as follows: I made a Windows Phone 7 game using the Farseer Physics engine (a derivative of Box2D written for the .Net framework) and wrote a game using it: http://www.youtube.com/watch?v=US574pc-bzc

Now I'm trying to port the game to iOS based devices. Since the original game was written in C# I decided to use MonoTouch, which is basically a C# compiler for iOS devices. The problem I'm having now is one of performance, MonoTouch is not as fast as microsofts .net wrappers for iOS and because of this the physics in the port really drag down the performance.

What I was thinking of doing was compiling Box2D as a static library and linking it into MonoTouch (see the answer to the question here: http://stackoverflow.com/questions/6611 ... j-c-mixing), so basically while the game logic and drawing code will remain in C# Box2D will be referenced via a C# wrapper but will do most of the grunt work in native code.

Since Box2D is written in C++ and not C it means I might have to go through the entire code base and add 'Extern "c"' where it would be needed.

So my question is, is it worth doing this or should I use a straight C physics engine such as Chipmunk (which I don't want to do because Farseer has more in common with Box2D than Chipmunk)?

Or does anyone have any better suggestions for me to try instead?

Thanks for any help!
Maybe this will help: http://code.google.com/p/box2c/
Erin Catto wrote:
Maybe this will help: http://code.google.com/p/box2c/


Yep thanks for the info! Seems like a god source of info, hopefully it's relatively up to date 🙂

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