Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am making a bullet hell game in Python and am looking for a suitable collision library, taking the following into consideration:

  • The library should do 2D polygon collision.
  • It should be very fast. As a bullet hell game, I expect to do collision checks between hundreds, likely thousands of objects every frame at a consistent 60fps.
  • Good documentation
  • Permissive license (like MIT, not GPL)

I am also considering writing my own library in C/C++ and wrapping with python ctypes in the event that no such library exists, though I do not have experience with collision detection algorithms, so I am not sure if this would be more trouble than it's worth.

Could someone provide some guidance on this matter?

share|improve this question
I'd expect a bullet hell game to do simple AABB collision checks and then perhaps a circle check. Keep in mind though that partitioning your objects gives you a major boost. You could always look at Box2D. This tool should also come in handy. But you probably don't want to apply complete physics to your objects. – Sidar Aug 17 '12 at 13:37
i was in a class where someone did a ridiculous bullet hell game in python and they could not find a suitable library. i think they actually made their own in c/c++ too – TMP Sep 9 '12 at 6:48
up vote 1 down vote accepted

Given the simplicity of typical projectiles in "Bullet Hell"-type games, it'd be pretty simple to roll your own collision detection code.

Collision detection would be a simple line segment to polygon intersection (basic linear algebra). Iterate through all your projectiles and game entities, and you're done.

If after that point, performance needs to be increased, then check AABB collision prior to each polygon intersection.

If after that, performance still needs a boost, then construct a quad-tree out of your entities and projectiles to do "macro"-AABB checks prior to the checks above.

Also, if your implementation/hardware is good, I wouldn't be surprised if doing it in Python turns out fast enough to achieve your needs.

share|improve this answer
This is good advice but a grid-based spatial partition will probably give you much better performance since your projectiles move a lot and all have the same size: – Ryan Badour Mar 3 '15 at 18:51

I love box2D as much as the next indie developer, but in this case its way overkill.

Try rabbyt its not maintained much anymore but its still pretty sweet. Its super fast also, it is however an entire 2D engine but can be used in pygame and pyglet. It takes advantage of hardware acceleration, and can do some pretty intense collision checks.

Pygame has a decent collision library, however having used pygame in the past and recently discovering much better 2D libraries, I've grown to hate it. As for pyglet, its pretty cool but its not a game engine just media engine sort of like SDL(but not SDL based).

I'd say check rabbyt out, theres a google group for support.

EDIT: Rabbyt IS indeed MIT licensed.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.