bah.box2d update would be great

BlitzMax Forums/Brucey's Modules/bah.box2d update would be great

Lobby(Posted 2012) [#1]
Hello, I'm currently working on a project that uses the bah.box2d physics engine. It's a really nice engine but the wrapped version of box2d is 2.0.2 while there's 2.2.1 out.
Where's the problem? The problem is that the old version isn't optimized for manuel position changing (using SetXForm). If you've more than 100 bodies (I think this should be expectable in a 2d game) you want to move at once to another position this needs more than 100ms. For a realtime game this is unacceptable and it's a known issue of the old box2d version.
So I hope that a new version of bah.box2d will be released because it seems to be really difficult to update the wrapper oneself (in addition there are also other great new features of the new version).


Armitage 1982(Posted 2012) [#2]
I tried to update it to 2.3 myself here :
http://blitzmax.com/Community/posts.php?topic=97835#1138772

But I got a small problem of C++ object.
I never was able to hire someone to port it to BlitzMax so I guess we are stuck.

Extending BlitzMax: that's really something Blitz Research Ltd should think about! Like a premium service or something...
When I ask a bit about this they answer me that we are not supposed to mess with the C++ side of things.

Ok, then what ?

I don't understand why they stopped adding cool modules and improving BlitzMax. I thought that Monkey would be the answer but in fact no.


Lobby(Posted 2012) [#3]
Nice try you've done. Unfortunately, I also have no knowledge how to solve the problems. It would be a pity if I've to abort my project in BlitzMax only because the wrapper is out of date.

As you already implied, it's sad that the support to BlitzMax seems to be dead.


Armitage 1982(Posted 2012) [#4]
I wasn't aware of the SetXForm problem during the development of my engine.

I'm not 100% sure of that but I tried to replicate this thanks a Teleporter object in my game. It's using SetXForm to teleport objects.

Pushing an extreme amount of objects inside (around 500) didn't impact the FPS much.

So I build a small test using SetXForm where a specific object would move randomly at each frame.

For 1024 objects:
The one using SetXForm give me 70 FPS
The one without SetXForm give me 140 FPS

So effectively there is a noticeable differences between the 2.


I don't know about your game but the Box2D Manual discourage manual positioning during simulation because it's disturbing it.
Now maybe you can find a way to decrease the number of call during each frames. SetXForm 20 objects per frames for example?

But it's clear that soon or later, if we want to continue using Box2D the Module will have to be updated.
After all: http://www.develop-online.net/news/37171/GDC11-How-the-Box-2D-hero-caught-Rovio-out


Lobby(Posted 2012) [#5]
Thank you for testing. I think the problem in my game is that I use a lot of shapes per body (up to 100 in common). So I've to decrease the number of shapes of a body to solve this, although that may cause other issues (the box2d intern commands for every shape are really useful).

Here a little testcode that shows that it need more than 100ms to reposition 100 bodies with 16 shapes per body:


To move the bodies separately could be a solution, but it seems to cause easily physic toubles when collision doesn't work in this short time of movement. The point is that my world is splitted into chunks so that I've only to reposition (all) things when the chunk is changed (I've to do this because the box2d world have to be not too big, otherwise physics fail).

Last edited 2012


Russell(Posted 2012) [#6]
I don't think Brucey has posted anything at all since last year, so I wouldn't hold my breath on getting Box2D updated (unless someone else wants to give it a shot...).

I imagine he has moved on to bigger and better things. With his programming talents, he could work anywhere he wants really.

Sad for us, but good for him!

Still, it would be nice to hear from the 'ol boy...

Russell