[OLPC-Games] Physics with Python and Pygame (Chipmunk 2D Physics Engine)

Joshua Minor j at lux.vu
Mon Mar 10 03:55:59 EDT 2008


Chris, this is most excellent!

I have a demo activity written in C/C++ that uses the same underlying  
engine, box2d, and SDL for drawing.  I wanted to port it to python, so  
I spent several hours over the past week trying to use SWIG to make  
some python bindings for box2d - with minimal success - so I am very  
relieved to see that this hard work has already been done :)

It should be easy to port the activity over to use pymunx.  In fact  
I've just bundled together a starting point using olpcgames this  
evening.

Here is the C/C++ based one: http://lux.vu/olpc/physics-sdl.xo
   press 'w' to toggle wireframe for speed
   press 1, 2 or 3 for different scenes (mixer, piston, pong)
   click and drag to move stuff around
   press escape to quit

Here is the pymunx-based starting point: http://lux.vu/olpc/physics.xo
   click to make circles

This should give everyone an idea of what sort of frame rates are  
possible.

-josh

On Mar 9, 2008, at 7:35 PM, Chris Hager wrote:

> Hey all.
>
> Recently I did some research on 2D (SDL) physic engines, and found  
> that
> one of the most popular (called Chipmunk) with python bindings  
> (pymunk)
> recently got an update. I had a look into it, and am totally amazed :)
> The chipmunk engine is easy, stable, fast, fun, open-source -- and now
> it's getting really possible to use it with python and especially  
> pygame.
>
> To support these efforts I've started writing a little API class  
> (called
> pymunx), to make it even easyier to implement pymunk physics in  
> pygame.
> Screenshots of the examples and a documentation I've put in the wiki:
>
>  http://wiki.laptop.org/go/Pymunx
>  http://wiki.laptop.org/go/Pymunx/Documentation
>
> It supports x,y gravity, elasticity, mass, density, friction,  
> inertia --
> it is possible to draw polygons by hand, ... And it is real fun to try
> :) (especially demo6 and demo7). So, long talk little action... let's
> have a look now:
>
>  svn checkout http://pymunk.googlecode.com/svn/trunk pymunk-read-only
>
> This download includes:
>  - precompiled chipmunk libs
>  - pymunk bindings
>  - pymunx api class
>  - lot of demos
>
> I think this physics implementation could be interesting for a variety
> of purposes. Games (of course), Screensavers, but also for Simulations
> and in educational and playful-learning meanings. I'm quite hooked on
> playing with demo6 and 7 (elasticity) -- and learned a lot about  
> physics
> in the last days :)
>
> Any feedback is welcome!
>
>  Chris
>
>
> _______________________________________________
> Games mailing list
> Games at lists.laptop.org
> http://lists.laptop.org/listinfo/games



More information about the Games mailing list