Thursday, October 23, 2008

2.0.2b0 Released!

With nearly no response from the community, this time-consuming project might end at this version.

I'm also hoping that the OS X installers work well enough for everyone. It took a good amount of time to figure out how to (properly?) release for it.

In any case, here's the changelog:
First release that's not based on a major Box2D release. It combines Box2D SVN r177 and contributions from shaktool (thin line segment) and BorisTheBrave (controllers/buoyancy).

* Thin line segment support (forum post)
* Buoyancy with generic controller support (forum post)
* Pyglet 1.1 testbed (still has some issues. run to convert the tests from pygame)
* OS X Installer
* Python 2.6 support
* Line joints (see LineJoint test)
* Raycasts (see RayCast test and BoxCutter test)
* TestSegment support
* BreakableBody test (forum post)
* Fixed: == was working, but != comparisons weren't.
* Access to polygon normals, core vertices, etc.
* cvar list fixed
* Off by one bug fixed for vertices

New time step will require a few minor updates to your code:

world.Step(timeStep, iterationCount)

world.Step(timeStep, velocityIterations, positionIterations)

velocityIterations is usually 10, and positionIterations is usually 8.

Friday, October 10, 2008

pybox2d r86 - Thin Line Segment Shapes


Thanks to shaktool, thin line segments are now available for Box2D! I've ported them to pybox2d, which you can see if you use svn r86. It's still in beta in the C++ form, so API changes can be expected.

This is great news for creating platformer games, and even terrain in general. No longer will you have to worry about tesselating non-convex shapes to get the slopes and such that you want. See the new testbed demos,

They are very simple to use, also:

(Assuming a b2Body, body, at the origin)
verts = [ (50.0,0.0), (-50.0,0.0) ]
edgeDef = box2d.b2EdgeChainDef()
edgeDef.isALoop = False

Creates a big, static line at the bottom of your world. If you want to make a dynamic one, simply use body.SetMassFromShapes() afterward. However, there are some problems with the dynamic versions (see the forum post)

Tuesday, September 16, 2008

pybox2d svn r70

Totally restructured the SVN. The full Box2D source is now included, making compiling from SVN very easy. Python 2.6rc1 is also verified working and the steps are in place for a release on that version.

On another note, I think the next actual Box2D release will be a long way off, given that Erin Catto is so busy. Perhaps once b2BuoyancyController makes its way into the C++ port, I'll make an interim release for win32 Python 2.4-6 and OS X.

I like the way pymunk has binaries for all platforms included in his redistribution version. I don't think I could do that with pybox2d, given that SWIG will create a different library for each Python version. Plus, the size would just be too big. Any thoughts?

Anybody out there? もしもし・・・?まっ、いいや。

Sunday, September 14, 2008

pybox2d svn r60

fluiDemo from Blaze My UFOCatcher Test 

svn r60 changelog:
b2PolygonShape: getNormals_b2Vec2, getNormals_tuple added added.

fluiDemo: Port of Blaze's fluid physics. Too slow in Python to be used in a game. More of a proof of concept. Mostly works, some kinks still there though.

UFOCatcher: Sprites working with Rabbyt, looks pretty but the grip is still not great.

Both require a copy of the data/pgu directories from trunk/testbed to work.

GetNormals() for b2PolygonShape was previously not wrapped, so it was inaccessible from Python. There was always box2d.b2Dot() available for use, but having it built into the b2Vec2 is perhaps more convenient: dotproduct = instead of dotproduct = box2d.b2Dot(vec1, vec2).

The fluiDemo, ported from Blaze, is pretty fun to play with. Hopefully the last few bugs can be squashed. I'm sure it'll end up in Box2D itself eventually, at which point we'll be able to use it at full speed! It's just a proof of concept, really, or an extra example of how to use pybox2d.

As far as using Rabbyt for the UFOCatcher game/test, I didn't want to really add another dependency, but it was just too pretty to pass up. If I can find out a good way to get the grip joints working, maybe I'll make an actual little game out of it. I'd like to port it to the XO, but that'll require not using Rabbyt or OpenGL.

Tuesday, September 2, 2008

OLPC Physics Jam

The jam (which used pybox2d on the One Laptop per Child XO) finished up this past weekend. Their final presentations are here.

I'm rather partial to the Rollcats. :)

pybox2d svn r57

* Updated to Box2D SVN r173.
* Note that r173's Makefile needs to be modified to include b2LineJoint.cpp
* Line joints! Testbed ported, formatting updated.

Saturday, August 23, 2008

pybox2d svn r51

So, I figured I'd detail some of the changes made to pybox2d a bit more in detail here. Here's the changes in r51:

* RayCasts working!
* Fixed some cvar confusion:
Since you can't do dir(box2d.cvar), I added a (mostly complete) list in box2d.cvars:
for c in box2d.cvars:
print c, getattr(box2d.cvar, c)

will show plenty of information:
b2_pi 3.14159274101
b2_maxManifoldPoints 2
b2_maxPolygonVertices 8
b2_maxProxies 512
b2_maxPairs 4096
b2_linearSlop 0.00499999988824
b2_angularSlop 0.0349065884948
b2_toiSlop 0.0399999991059
b2_maxTOIContactsPerIsland 32
b2_maxTOIJointsPerIsland 32
b2_velocityThreshold 1.0
b2_maxLinearCorrection 0.20000000298
b2_maxAngularCorrection 0.139626353979
b2_maxLinearVelocity 200.0

pybox2d svn up until r50

(pictured: running on the Pyglet 1.1 testbed)

Recent changes up to r50: Allow for CXXFLAGS to be used (OS X -> Universal Binaries, Linux -> x64) (r47)
TestSegment works (thanks for the tip, neonnds!) (r35)
Backported the testbed to pyglet 1.1. (r50)
test_BreakableBody and TriangleMesh added (thanks nimodo!) (forum post)
OS X guide added (thanks neonnds!)
Added more comments, documentation, fixes. Various cleanups.

Everything should now be updated to Box2D r172 (r162 typo in commit log), with new Step function and slingshot in the testbed.

Friday, July 25, 2008


Thanks to the user neonnds, there is now a really nice guide on how to build pyBox2D under OS X! See it here on the wiki: OSXInstallation

Starting the next release (2.0.2, I'd assume) there will be a full OSX installer to make the installation as easy as in Windows!

Tuesday, July 15, 2008


The pybox2d library should of course allow access to the standard box2d-style API. Maybe it should also have a secondary Pythonic, easy to use interface.

What would you like to see in the library? How should it work?

Please share your ideas!

(Originally the comments were put in this issue)

Update: This has been indefinitely put on hold.

Sunday, June 1, 2008

2.0.1b4 Released!

Here's the change log:
* Supports comparing shapes, joints, bodies. Doesn't require using userData anymore.
* Major clean ups with Box2D.i
* Added some docstrings to Box2D.i functions
* Added b2PolygonDef.checkValues(): checks the Polygon definition to see if upon creation it will cause an assertion to fail (raises ValueError)
* Wrapped shape.GetCoreVertices() like GetVertices() (for test_TimeOfImpact)
* test_Web fixed
* All stuff prettily printed by a semi-automated process now
* Updated to SVN rev 156
* Added many comments to test_main