Saturday, June 11, 2011

(Mostly) Pure Python Physics


Continuing my work on the Pure Python port, I did a small amount of profiling with the outstanding runsnakerun to determine what was bogging it down. As expected, the slow speed of Python's math operations -- and especially the matrix and vector operations -- were the major bottleneck.

Having said that, it would appear that there's very little I can do for the Pure Python port to speed it up. If you followed the previous post, you'll know that I tried PyPy (it works after a large number of iterations) and Cython (faster, but still not so great). I considered using some library like NumPy to get its matrix and vector functionality, but including such a massive library just for this tiny physics library just felt wrong.

I stumbled upon quite a few matrix and vector C extensions for Python, notably Casey Duncan's excellent Planar project. However, there were always issues with all of the ones I found: not supporting tuples in place of vector and matrix types, immutable vectors (though this can be a good thing for other projects which don't expect it), and just the general headache of requiring restructuring all of the pypybox2d code that already relies on vector and matrix classes with certain properties and functions. [side-note: were it not for this project, I would definitely be using the Planar library.]

In short, and for better or worse, I re-invented the wheel, creating pure C extensions for the Vec2, Mat22, Transform, and AABB types (should be compatible with Python 2.5~3.2, but let me know your results). Performance significantly improved (sorry, I don't have any benchmarks right now -- but run any of the testbed tests and you'll feel it). Most of the testbed tests run "fast enough". Exceptions include the pyramid and vertical stack ones, which have altogether too many contacts, and the solver gets very slow.

After adding pickling support for the above classes, I then really wanted to give multiprocessing a go. I made a simple test with a set of processes dedicated to doing shape distance calculations (i.e., consumers). I passed in thousands and thousands of shapes and transforms, and it properly generated the results. Unfortunately, comparing it to the single process version, regardless of the number of input sets, the multi-process version was on the order of 10-50x (!) slower -- not even including the time it took to start the processes. All of the overhead, presumably from synchronization and pickling the objects to pass between processes is just too expensive. It looks as if this will not be a viable option for a real-time physics engine.

Now, where to go from here? I'm stumped -- err, I mean -- I'm open to suggestions!

Thursday, May 19, 2011

Pure Python physics?


Recently I tried to get pybox2d compiled and running with PyPy, but it failed for whatever reason. I had it in my head to just give up and port the whole bloody thing to pure Python and see how that would go. Not wanting to waste inspiration, I gave that a shot. Fast forwarding to today, and it's pretty much done.

So, what's in the port? (almost) All features of Box2D up to r175:
  • All shape types (polygons, circles, edges, and loops)
  • All joint types (distance, revolute, friction, prismatic, weld, rope, wheel, mouse, pulley, gear)
  • A dynamic tree class for AABBs
  • Collisions, contacts, shape distance calculations, etc.
  • A mostly Pythonic interface to all of the useful classes
  • The testbed, in simplified form

Before you jump for joy, there are many reasons to not use this:

  • It's slow.
  • It's really slow.
  • It has a bad name (pypybox2d -- changing it is on the TODO list)
  • It's still early, though almost everything has worked well enough in my tests. I'm positive there are plenty of typos and minor bugs.
  • Some source files are much too big, because I haven't gotten around to splitting them up
  • It uses __slots__ for my own debugging purposes. I have no qualms about (almost wholly) removing their usage eventually.
"Why do this, then, if it's so slow and unusable?" Do you really have to ask? Why not?

So, what of PyPy after all that hard work? Unfortunately, in my few tests, it's been slower than CPython **. Perhaps one day it will be sped up by another means. Or maybe I'll figure out a way to get Cython working with it such that it won't totally screw everything up. If you have any ideas, please do get in touch with me.

Find the source here. The testbed requires pygame, but there's a (very) simple graphic-less hello.py in examples/ if you simply must run something.

** edit May 20th: But those tests were superficial, only testing for a few iterations. Increase the number of iterations, and PyPy wins, hands-down. See Antonio Cuni's helpful comment below for more information.

Sunday, March 13, 2011

Simple examples? oh yeah, and an alpha release for you...

So, not everyone likes the testbed. It's big, C++-ish, and not so pretty. And we all hate searching around in multiple files for function definitions.

Making some simple examples has been on the back-burner since I started on pybox2d a few years back. I've finally started on some examples, but I need your input on how to make them easily digestible for everyone else:

Is it worth going down this path?

To hopefully rouse up some interest, I will provide another alpha release. This time, I'll make it available to a larger audience by including builds for the platforms I have access to (sorry, OSX users -- you might not get any installer release for 2.2 at all).

So, read the manual, download from below, and try it out. Without your help, this version will never see daylight, I assure you!


win32 2.6, 2.7, 3.0, 3.1
linux-i686 2.6, 2.7, 3.1


Edit 4/7/2011: OK, so -- not a single comment in a month, and I recently fixed a major leak affecting all versions since 2.0.x, so I just removed those versions from the svn. 2.0.x has also seen its first update in a few years.

Saturday, February 26, 2011

2.1 on the move?

test_Car.py

Hi,

So, I've moved the 2.1 branch into the trunk. I've also spent more than half my Saturday fixing and writing documentation.

Here's the 2.1 manual on the wiki! If you have some time, please read through it. It's a lot of work -- hopefully someone will appreciate it. :)

I also re-uploaded the 2.0.2 bugs-n-stuff that were on the Box2D wiki, here. A couple of other wiki entries got updated, too. Notice anything strange? Please do let me know.

There's a few changes upstream that I'll get around to including soon, but I'm a bit burnt out after the above. Nothing huge, though.

Warm wishes,

kne

Wednesday, December 15, 2010

Found in the wild: Bricks Knock Off

I just happened upon a decently polished little game called Bricks Knock Off (English translation here) that's actually using the 2.1 branch of pybox2d. Cool!


As you might have guessed, it's a game about bricks. Shooting them off some platform to get a decent enough score to continue to the next level. It features music, sound effects, a few levels, and even a scrolling background.

I only have one comment from the pybox2d-end of things, and it's that the position/velocity iterations need to be tweaked to get the bricks to stack stably. If you check it out, change main.py around line 115ish to be something like:

    vel_iters, pos_iters = 15,15 

Thursday, November 4, 2010

Progress

Yes, there has been some progress. Only a bit though. I know you love it when I make bullet points, so here you go:

  • Most importantly, I fixed up a few things thanks to issues pointed out by users. Thanks mikkelin, Fahri, dabski, and anyone else that I might have forgotten!
  • Updated to the latest Box2D SVN r141 -- there were some changes upstream, including:
    • A new RopeJoint (maximum distance constraint)
    • Allocator, joint and some other fixes and improvements
  • Working b2LoopShapes -- featuring smooth collision both inside and out (you can see these in the character collision test)
  • Added the rope joint test
  • PyQt4 framework fixes
    • Some properties are changeable now (*)
    • Fixed updated circle radii between calls
  • Epydoc documentation for the 2.1 branch was generated by using the Doxygen documentation for the C++ side (which, although it is included in the SVN, is usually not at all necessary for pybox2d users).
  • An up-to-date version of the compiled library is included on the SVN
    • It's here. For those of you who would like to help test, is this convenient enough? Or is it "give me an archive or test the damn thing yourself"? :)
I think it's almost time that the trunk from early last year to be finally overwritten. I don't think there are too many project requirements with the old library anymore. Thoughts?

(*) Any idea how to properly size a QListWidget in a QTreeWidget cell? I think sizing widgets appropriately is what most frustrates me about Qt.

Friday, October 1, 2010

Not quite what you were hoping for, but...

Recently, I haven't had much time to work on pybox2d. And when I say 'not much', I mean just about zero.

In any case, I know that there are probably a couple people out there that are anxious to try the new version but don't want to go through installing SWIG, compiling, etc. It's a pain, I realize.

The other day Fahri, creator of Mekanimo --- the only commercial product to use pybox2d that I know of -- asked me if I had a binary he could test of the new branch. I threw a simple Python 2.6 (win32) package together, and thought that the rest of you might like to give it a go also.

The library itself is contained in the archive, so there's no need to install it. The redesigned testbed examples are in there, and you can experiment with the new syntax to your heart's content. For any of the tests, simply run: python test_Web.py . You can also specify the (incomplete) pyglet or pyqt4 back-ends with: python test_Web.py --backend pyglet or '--backend pyqt4' for example.

I only ask that if you give it a try, please at least run python run_unit_tests.py and see if you get any errors. Also, please note that this is alpha-quality and does not have much documentation.

Download here.

Sunday, July 11, 2010

2.1.0 Branch Status


Hi!

How's everything? Make any games lately? Me? Oh, I'm still alive and kicking over here.

So anyway, here are some of the updates following my last post about r246 a good 6 months ago (all of those changes are still mostly true).

  • Updated to the latest Box2D svn, added loop/edge shapes (edges work, loops do not)
  • kwargs for all functions
  • Reworked the framework system to be more OO-friendly -- pyglet/pygame frameworks are derived from a base class now
  • Pyglet is basically working with the newest version 1.1.4 -- but it's got some major issues that need to be dealt with. If there are any Pyglet experts out there, let me know.
  • Added a PyQt4 framework with basic functionality. I have a few plans for it... [pictured above]
  • world.CreateCircleShape, world.CreatePolygonShape, and so on, which allow kwargs for both the shapes and the fixture, so that things like this are possible:
    world=b2World
    world.CreatePolygonFixture(box=(1, 1), friction=0.2, density=1.0)

    remember that 'box' is a property from the polygon shape, and 'friction' and 'density' are from the fixture definition.
  • Experimental 'b2' namespace:
    > from Box2D.b2 import *
    > vec2(1,1)
    b2Vec2(1,1)
  • CreateStaticBody and CreateDynamicBody, and other changes to CreateBody and CreateFixture. There's also world.Create*Joint(), body.CreateShapesFromFixtures, and probably some others
New tests:
  • Tiles
  • Pinball
  • CharacterCollision
  • Bullet
  • Most of the old ones, converted to the new style
Still needs a lot of work. But if you ever want this version to see the light of day, please do give it a try and let me know what you think (and of course if you have any issues, which you likely will):
% svn checkout http://pybox2d.googlecode.com/svn/branches/box2d_2.1/ pybox2d-svn

Also, given that the Box2D wiki has been down for ages, I guess it's a good time to find a new place to host a pybox2d wiki. Any recommendations?

Saturday, January 16, 2010

So, I've gotten this far...

I have spent a good month now redoing everything in the project, but I've hit a bit of a wall. It's pretty much in a "good enough" state for a release, minus a few of the testbed examples I have yet to port. Oh, and all of the documentation. Ugh. Now with Box2D's wiki down, it makes it even more difficult.

There's that old adage "release early; release often", but I find it hard to jump on that bandwagon. Releases are very difficult to do in the first place for multiple platforms and multiple versions of Python. And then support them afterward? Forget it. Oh well. I might continue at a slow pace for a while and wrap some more things up for a release whenever I manage to get a bunch of free time again, or maybe not. There's a bunch more changes on the SVN since the last blog post if you have any interest.

Perhaps this will take over in the meantime?

Sunday, January 10, 2010

svn r246 (2.1.0 branch)

As I mentioned in the previous post, I've been working on the new version of pybox2d, based on the work-in-progress C++ library Box2D 2.1.0.

With all of the upstream changes (see the previous post), it gave me a good opportunity to start anew. SVN r246 offers these benefits over previous versions of pybox2d, in no particular order:
  • Python 3k (3.1 tested) support. Many would argue that you wouldn't want to use it, but I have seen very little fps difference in my tests.
  • Significantly increased performance. I get a steady 55-60fps on test_Pyramid with the menu drawing disabled, on both Python 2.6 and 3.1. I never got above 40fps on 2.0.1.
  • The above is partly related to the new (optional) b2DebugDrawExtended class. It adds slightly to the base b2DebugDrawClass by doing world->screen coordinate conversions in C++ before passing them to Python. Possibly not very useful in the OpenGL case, but very useful for SDL-based systems. I think in my small tests it offered a gain of 5-10fps.
  • DebugDraw flags are also implemented as keywords now, so it's unnecessary to pass a bitmask to it.
  • Callback functions that used to get b2Vec2s now get tuples -- so you don't risk a crash when holding on to a b2Vec2 instance created on the stack.
  • kwarg support for all class __init__ routines. This means you can do things like:

    self.world.CreateBody(
          b2BodyDef(
              type=b2_staticBody,
              position=(0,3),
              fixtures=[b2CircleShape(radius=0.5),
                        b2PolygonShape(box=(0.5, 0.5))],
              )
          )



    Which would create a static body at (0,3) with a circle (of radius 0.5) and a box (with half-dimensions 0.5,0.5). You can still create things the old fashioned way, if you like. Just remember with the new Box2D there are no b2ShapeDefs.
  • kwarg support extended to allow for b2JointDef creation. In the past, you would have had to do b2RevoluteJointDef.Initialize(bodyA, bodyB, anchorpoint) to get all of the necessary elements properly set, but now the same is possible with b2RevoluteJointDef(bodyA=a, bodyB=b, anchor=pt, other_kwargs=blah).
  • Additional properties for polygon shapes, so that b2PolygonShape(box=(2.0, 2.0)) is sugar for:
    s=b2PolygonShape()
    s.SetAsBox( (2.0, 2.0) )

    (or in the current version, s.box = (2.0, 2.0) )
  • You can do: point in b2AABB to see if a vector is inside an AABB.
  • Unit tests. You should be able to tell just after installation whether or not the library is working properly.
  • A mechanism so that you don't have to keep a reference to the callback classes (e.g., b2DebugDraw). In most cases you would want to have access to it, but it shouldn't crash anymore without it being stored on the Python side. [still need to test this more to ensure it works properly]
  • dir() listings are clean for almost every class, so you should be able to see what's possible with a specific
  • Improved vector and matrix classes, with more operator support. b2Vec2s are also indexable -- so: b2Vec2(1,2)[0] = 1
  • b2Color has also been enhanced to allow for operators, and useful things like b2Color.byte to get color components clamped in the [0,255] range are also there.
  • getAsType() is no longer necessary. Joints and shapes are properly downcast in all instances.
  • Plenty of other things from the new C++ code.
  • I've been doing my best to keep everything accessible in properties when possible.
  • Unused classes are also hidden, and the rest have been gone through and at least basically checked for accessibility/usability.
  • [... and all of the other stuff that I've forgotten.]
Note that this version is largely source-incompatible with older versions.

You can try out this SVN version with:

svn checkout http://pybox2d.googlecode.com/svn/branches/box2d_2.1/ pybox2d
cd pybox2d
python setup.py develop test
cd examples
python test_ApplyForce.py

Or just browse the code here.

Keep in mind that this will overwrite your current installed version. The testbed is likely to go through more changes, but the basic API shouldn't be changing much more from now on (unless something unexpected comes from the upstream library).

Like it? Hate it? Lemme know.

Monday, December 28, 2009

End of the year status

Hello to the loyal couple of you who continue to refresh this lonely blog. :)

I scrapped the branch I started on 6 months ago of the new version of pybox2d. The upstream library Box2D (now also hosted on Google Code) has seen a good deal of changes since then.

The most notable changes are:
  • The new dynamic tree-based broadphase
  • This makes it such that there will no longer be a maximum proxy count. So, you won't see b2_maxProxies assertion errors when you try to create too many colliding shapes.
  • Normalized and simplified class interfaces
  • The improved interface makes for an easier time in creating Pythonic properties.
  • Kinematic bodies
  • These special bodies are essentially static in that they don't respond to collisions, but they can have their velocities set. I'd imagine they would be most useful as, for example, rotating platforms in some side-scroller.
  • The removal of shape definitions and the addition of fixtures
  • I don't see this as offering much benefit to us on the Python end, but it allows shapes to be created and used without being attached to bodies. It makes for a great deal of changes for those attempting to port their code to the most recent version.
  • One-sided platforms
  • No more SetMassFromShapes() nonsense
  • New collision callback system
  • Weld and friction joints
  • Controllers have been removed
  • This is unfortunate, but was anyone actually using them?

Here are some things I'm trying to do with the upcoming version of pybox2d:
  • Unit tests
  • I'm attempting to use unit tests (suggestions would be welcome on this, as I'm fairly new to it) as I go along to ensure all of the properties work and I don't break things along the way.
  • Hide all getters and setters, while keeping things accessible in properties
  • I like this a lot, but I hate seeing the ugly __ClassName_GetterHere-type things when doing a dir(). Should I just skip the hiding and make it semi-private with _Getter to avoid the lengthy name-mangling? Should I re-implement __dir__ to hide these? I would just rather not have users calling the functions when there are perfectly good properties in place.
  • Properly downcast joints/shapes
  • So calls like b2Joint.downcast() (or previously getAsType()) are no longer necessary.
  • Custom __setattr__?
  • I've been toying with the possibility of using a custom setattr to keep the user from trying to set shadow class instance variables that don't exist in the real class. Maybe I'll make it an option or decide after performance tests.
  • Eventual 64-bit and Python 3.x compatibility
  • Pythonic-ish initializers?
  • I've also been considering having the ability to do, for example:
    body.CreateFixture(b2FixtureDef(shape=b2CircleShape(radius=1), density=1, friction=0.3))
    Any interest in that? It's simple sugar, but it could be useful.
  • Scrapping deprecated stuff, hiding unusable classes, pickling, etc.



Any thoughts? What would you like to see in the new version? Yell at me and tell me what I'm doing wrong before I get too far into it.

Tuesday, June 9, 2009

Status?

pybox2d isn't dead just yet.

A few days ago, I started porting the bleeding-edge version of the library.

Some changes include the addition of b2Fixture, contact listener changes, a new way to create edge chains, and significant algorithm changes. More information on these C++-specific changes can be found on the forums and the Box2D SVN changelog.

As it is a departure from the previous builds, it will stay as a branch on here at least until it's significantly improved over the trunk. I'm not entirely happy about the significant API changes that are occurring, but I'm just bringing to Python what Erin Catto and others are making available to the C++-world. I guess what I'm trying to say is, well, don't shoot the messenger.

Friday, March 6, 2009

Project spotlight: Mekanimo


Mekanimo is a 2D physics simulator. In minutes, you can create simulations, interactive games and puzzles, dazzling graphics and share them with others through the Internet.
Mekanimo really surprised me with its professional-looking user interface. It allows for the creation of worlds with customizable scripting, various plots, and so many other things. I enjoyed trying out the exhibits like the marble pump, which require you to copy and paste the code into Mekanimo for now -- I think the author Fahri has been putting much more into the application itself than its website.

It's still got a ways to go and unfortunately is (for now?) closed source, but keep an eye on it. I expect it to turn into a really nice and polished learning/design tool some day.

pybox2d svn r184

Bugfix: Linux/x64 build issue.
Updated to Box2D r204:
b2Body now has these additional functions:
  • SetLinear/AngularDamping (additionally accessible by body.linearDamping = (x,y) )
  • SetStatic
  • SetFixedRotation (additionally accessible by body.fixedRotation = True)
b2Shape:
  • SetSensor
A few functions' names changed since some of the 2.0.2b1 accessor code was my own, but chances are you were using the properties anyway:

IsRotationFixed -> IsFixedRotation (property fixedRotation)
CanSleep -> IsAllowSleeping (property allowSleep)

Wednesday, February 25, 2009

2.0.2b1 Released!

Since 2.0.2b0, there have been a good deal of changes to pybox2d:

  • Code structure completely reorganized
  • Doxygen comments converted to docstrings (should be a bit more friendly now, but still a bit C++'ish in places)
  • Lists and tuples may be used anywhere in place of b2Vec2's, and all of the tests have been updated to reflect this
  • Save/load state (pickling support for worlds)
  • Bug fix: Seg faults during DebugDraw/etc callbacks
  • Bug fix: userData reference counting causing leaks
  • Bug fix: getType() didn't work on line joints
  • Bug fix: TestSegment now returns from (-1,0,1) and not a bool
  • b2PolygonDef.setVertices() added, supports either b2Vec2 or list/tuple, so no need to specify. Old setVertices_tuple/b2Vec2() are deprecated.
  • New pretty printing style. It takes up a good deal of space, but it's actually readable.
  • New examples: bezier edges with thin line segments, a simple belt, basic pickling example (might needs some updating)
  • (Optionally compilable) C++ assertion failures turned into Python exceptions
    Additional properties and accessors to make coding easier (see below)
  • Many tests were updated and rewritten to be cleaner
  • Added b2CheckPolygonDef and deprecated the Python ported version. This version adds (optional) additional checks to ensure that your shape is convex and properly sized to not have strange results
  • Added GetVertices() for b2EdgeShapes. Creating one b2ChainDef results in many b2EdgeShapes, so this properly loops through each connected shape and gets the vertices in order
  • Box2D source updated, b2GravityController fixed
  • A fix for not allowing b2Body/Joint/Controller/Shapes as dictionary keys. Don't know how I missed this one. Still won't be picklable unfortunately.
  • Basic iterators have been added: b2World (iterates over bodies), b2Body (iterates over shapes), b2Controller (iterates over bodies), b2PolygonShape (iterates over vertices)
There are several code-breaking features that you might run into:

  • The library is now called Box2D (and not the cumbersome Box2D2)
  • Controllers now follow the factory style (see the buoyancy test for more information)
  • b2Distance updated (see here if this affects you)
  • b2Body.GetShapeList() used to return only first shape, now returns actual list
  • b2World.GetBodyList/Joint() used to return only first body, now returns actual list
  • All occurences of the ugly 'm_' have been removed. This might require some changes in your code, since this applies to all b2Joint.m_* and others, not just testbed stuff.

The following are the additional properties added. Most are just for convenience and make the definition (e.g., b2ShapeDef) symmetric with the output (e.g., b2Shape). Ones with * are changeable; the rest are read-only:
b2Worldgravity*, jointList, bodyList, groundBody, worldAABB, doSleep
b2Shapefilter*, friction*, restitution*, density*
b2Jointtype, userData, body1, body2, collideConnected
b2CircleShape radius, localPosition
b2PolygonShapevertices, coreVertices, normals
b2Body massData*, position*, angle*, linearDamping, angularDamping, allowSleep*, isSleeping, IsRotationFixed, isBullet*, angularVelocity*, linearVelocity*, shapeList

Basic epydoc documentation is now available here. The testbed is no longer included in the installer, so please download it separately here.

Releasing for all these operating systems all by myself is time consuming, confusing, and tough at times. I'm sure I got something wrong, so please go easy on me. :) Do let me know if something doesn't work for you, though.

Enjoy!

Tuesday, January 20, 2009

Update on Pickling

As of this post, the latest svn revision, r148, has pickling support which is working great on the testbed. I'm rather excited about it, as it's somewhat of a powerful and unique feature.

For those who can compile the library, check out the testbed. It works like your regular quicksave (F5)/quickload (F7) system. There's an additional test, test_pickle.py, that shows how easy it is to load a pickled world. As far as the code itself goes, there's still some commenting to be done, but it should be readable.

Monday, January 12, 2009

SWIG and Pickle

I have yet to see any site that explains how to pickle swig objects well enough. SWIG objects exist both on the Python and C++ side.

Without calling the __init__ function on the Python class instance of a SWIG object, it doesn't exist as far as SWIG is concerned. So you'll get a TypeError on the 'self' parameter of your functions.

If we were using old-style classes, __getinitargs__ would work well enough. Since we aren't, as far as I can tell, it's necessary for us to call the initializer ourselves.
def generic_setstate(self, dict):
self.__init__()
for key, value in dict.iteritems():
setattr(self, key, value)

def generic_getstate(self):
return dict((var, getattr(self, var)) for var in
__pickle_vars__[self.__class__.__name__])
If you have the dict __pickle_vars__ set up such as:
__pickle_vars__ = { 'myclass' : ['x', 'y'], 'myclass2' : ['zz'], ... }
You can then set:
myclass.__getstate__=generic_getstate
myclass.__setstate__=generic_setstate


EDIT 2009/1/14:
If you use properties for all those C++ getters/setters (as you should be doing), you can then iterate over all of the properties for a much cleaner solution. It takes even more tweaking to get pickling to work with outputs from factory products (e.g., trying to pickle a b2Body instead of a b2BodyDef). Expect something like this to show up soon in pybox2d. :)

Friday, January 9, 2009

pybox2d svn r136

Added something I've wanted to for a long time.

Anywhere there's a b2Vec2, you should now be able to pass in a [length-2] list, tuple, or None -- (0,0). As I learn more about SWIG every time I try to throw some more functionality into Box2D.i, I'm more and more impressed with how much can be done with it.

Changes can be seen in test_ApplyForce.py and test_Web.py. I'll eventually update the rest of the testbed examples.

Oh yeah, also fixed a longtime standing bug with unset userData causing seg faults.

Any other things you can think of that would be convenient? I'll probably allow matrices in list format.

If you notice any side-effects, please let me know as always.

Friday, January 2, 2009

distutils, oh how I hate you...

It took me forever and a day to get the original setup.py working for pybox2d, and then some people came along and told me how it was unnecessarily complex. And that it didn't work in the standard way and was somewhat confusing. Great.

With a push from the user snickell, I worked on restructuring the code-base to get it to conform to standard distribution methods.

I've decided that I will no longer install the testbeds and things to c:\Python2x\Box2D for Windows users and will simply just offer them in a separate archive as I see some other libraries do.

*EDIT*
My problem has been resolved and everything is apparently working now. I'm ready for another release -- but with nothing really new on the Box2D end, I guess there's nothing to do but wait.

A few questions for you faithful few who reload this page every once in a while:
Windows users: Do you prefer MSI's or executables for your libraries?
Linux users: Any interest in an RPM distribution?

Any other comments/etc. about the releases are always welcome.

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 convert-from-pygame.py 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:

Old:
world.Step(timeStep, iterationCount)

New:
world.Step(timeStep, velocityIterations, positionIterations)

velocityIterations is usually 10, and positionIterations is usually 8.