How about this library.

Can I use this library..
http://www.pygame.org/projects/9/207/
It implements per pixel collision and I need its feature on the game.
 

(log in to comment)

Comments

Perfectly acceptable.

Uh, while it's legal to use that library, there's a note on that page that worries me:

There is a bug in the current PyGame release that prevents this example from working. But if you check out the latest PyGame version from CVS it should work just fine!

Does the note apply to just the example game, or to the whole library? If it's the whole thing, I would either work around the bug or avoid the library. I'm not planning to get the latest pygame version from CVS and I bet lots of other people don't have it either....
I'll agree with Cosmologicon with this tiny bit of experience: a few PyWeeks ago, this team decided to make a 3D game. They worked really hard and reached the deadline as expected, but they couldn't (obviously) test their game on every single configuration, and it eventually turned out that under some configurations the game crawled to a terrible 6 fps. So, while they completed a very complicated game with all details ready, a tiny problem with the library ended up in a lot of "I couldn't play it" comments, and this affected their score really bad.

What I'm trying to say is: if your game requires something exotic to play (and I'm including "download your latest version of pygame from the website because Ubuntu doesn't have it yet" as exotic), your game may end up ranking badly. While you are free to use the library (it's not against the rules), please think really hard before using something that is not available on 90% of the computers out there.
Alternatively, as a messy hack solution, maybe you can figure out what recent changes to PyGame are required to make PixelPerfect work, and see whether you can include just that portion of PyGame along with your game source. (or is PyGame small enough to bundle along with your game binary distributions?)
I tested it on my pc ( WIndows pygame 1.9 python 2.6) and Mac ( same) and there is no problem and i think its just the sample that doesn't run be the note said "There is a bug in the current PyGame release that prevents this example from working. But if you check out the latest PyGame version from CVS it should work just fine!". It was released on 2006 so most of the people has already updates, i'll also try on other operating system but as soon as I found a problem, I will not use this probably.
I'd be cautious about using little known libraries from pygame.org. They aren't likely to have as much scrutiny or be tested in as many corner cases as something well-known.

"Pixel-perfect collisions" sets alarm-bells ringing anyway, because a) there are often quite a lot of pixels on a screen to check and b) objects often move at several pixels per frame, which can allow the pixels of objects to skip past each other without a collision being detected.
 
This library is using Pygame's collision detection for the broad phase and brute-forcing the pixel-perfect bit. Pygame's broad phase algorithm is undocumented so I don't know how that performs. Brute-forcing is naïve and can be expected to be costly when the number of broad-phase collisions is high. Also it's poorly written with a clumsy inner loop, which won't help performance. And yes, fast-moving objects will easily pass through one another.