pygame is
Python
Simple DirectMedia Layer
 
 
pygame.org is
Site Swing
Wiki

SpatialHash_for_Pygame

      
Search:  
 
 

This class is very fast compared to the Quadtree I was using in Gummworld2. I solved some of the problems and limitations the original author encountered, and I found it suitable for a high quantity of mobile objects. In stress tests I had around 600 objects / 2000 collision checks going at 30 fps, a scenario which would require nearly 400K brute force collision checks.

It's got a builtin optional collision check (see _extended_collided()) to support fast custom shape1-vs-shape2 and pixel-perfect collisions.

The intersect_*() methods are ideal for tile culling.

The Gummworld2 "tiled2" branch has some better demos than the one in __main__ here.

-- Gumm

Errrrk. Sorry, I guess there is a size limit to wiki pages or something. The editor is truncating my input. The full source is available here, or you can SVN the repo at the address above.

spotlight

 
our projects
pygame.org welcomes all python game, art, music, sound, video and multimedia projects. If they use pygame or not.
 
recent releases
Oct 21, 2014


Oct 20, 2014

Oct 16, 2014

Oct 9, 2014

Oct 8, 2014

Oct 7, 2014

Oct 4, 2014

Oct 1, 2014

Sep 19, 2014

Sep 17, 2014

Sep 9, 2014

... more!
 
for pygame related questions, comments, and suggestions, please see help (lists, irc)