Showing posts with label svn. Show all posts
Showing posts with label svn. Show all posts

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.

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.

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.

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, 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,
test_DynamicEdges.py
test_PyramidStaticEdges.py
test_StaticEdges.py

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.setVertices(verts)
edgeDef.isALoop = False
body.CreateShape(edgeDef)

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:
Interface:
b2PolygonShape: getNormals_b2Vec2, getNormals_tuple added
b2Vec2.dot(v2) added.

Miscellaneous:
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 = vec1.dot(vec2) 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

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: test_TheoJansen.py running on the Pyglet 1.1 testbed)

Recent changes up to r50:

setup.py: 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.