Physics with Python and Pygame (Chipmunk 2D Physics Engine)

Chris Hager chris at linuxuser.at
Mon Mar 10 10:41:57 EDT 2008


Hey.

Chris Ball wrote:
> Hi,
>
>    > http://wiki.laptop.org/go/Pymunx
>
> Wow, how awesome!  Do you have an XO to test on?  Have you thought about
> releasing a standalone .xo, or throwing these into Pippy?  What are the
> dependencies and disk usage like for the underlying chipmunk library

Yeah, I have a XO around and tested demo6 for the framerates:

- starting at 43 fps with 2 Elements
- 5 Elements: 38 fps
- 12 Elements: 31 fps
- 21 Elements: ~ 25 fps
- 45 Elements: ~ 20 fps

The feeling is actually quite okay on the xo laptop! :) At least with 
not that many Elements. I'd say it's possible to integrate it into 
pygame xo activities.

The dependencies are:

1. Chipmunk Libraries compiled for the right platform.
   We currently bundle for linux 32 bit (48kb), linux 64 bit (65kb)
   and windows (66kb). Osx is also supported, but I have none around
   to compile the libraries

2. Pymunk: Python CTypes Bindings for Chipmunk (~80kb)

So all together the dependencies for the xo laptop (chipmunk, pymunk and 
pymunx) are ~ 150kb. (+6.7kb for the demo :)


Re: Releasing it as a bundle... that could actually be fun! With some 
kind of demo level chooser... :)

Integrating the physics examples it into pippy would be interesting -- 
my primary goal was to make it easy-to-use and to have examples anyway. 
I would be up to do that, are there any pygame examples for pippy yet?

Best regards!

    Chris


PS: To capture fps to the console in the demos, you can add some 
variation of this line to the main loop:

    if event.type == KEYUP and event.unicode == "x": print clock.get_fps()





More information about the Devel mailing list