[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pygame] pixel perfect collisions



Ulf Ekstrom has written some pixel perfect collision code, which looks 
fairly optimized. here are some messages he's sent which didn't quite 
make it to the list.
-------------------------------------------------------------
Hi all=2E
I=27m creating a small library for pixel perfect collision detection=2E
Since a lot of people seem to want this in pygame (I do=2C at least)=2C
I thought that maybe there could be some kind of organized effort=2E

Pixel perfect collisions really makes sense=2C especially in pygame=2E
Bounding box detection can be very frustrating for players when
they get killed or whatever even though the characters look safe =

on the screen=2E The overhead is so small that there is problably no
noticable difference in speed anyway=2E

I have written some C routines to perform the basics=3A
* Create bitmasks from SDL surfaces
* Test for overlap and report a point of intersection
(see http=3A//www=2Eifm=2Eliu=2Ese/=7Eulfek/bitmask/Bitmask=2Ehtml)

The code is fairly fast and bug-free=2C but there is no
pygame interaction yet=2C since I know too little of python
internals to do this just yet=2E

There should also be some kind of preliminary sorting
of the sprites to avoid doing O(N=B2) tests=2E Im working on
a quicksort based method=2C but its not ready yet=2E

If you=27re interested in creating a collision detection
library for pygame please respond or email me in private
so that we can get started=2E I=27m specially looking for someone
who can do the C/python interaction=2E


____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org