<p>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. </p><p>It's got a builtin optional collision check (see _extended_collided()) to support fast custom shape1-vs-shape2 and pixel-perfect collisions. </p><p>The intersect_*() methods are ideal for tile culling. </p><p>The <a href="https://gummworld2.googlecode.com/svn/branches/tiled2"> Gummworld2 "tiled2" branch</a> has some better demos than the one in __main__ here. </p><p> -- Gumm </p><p> 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 <a href="http://code.google.com/p/gummworld2/source/browse/branches/tiled2/gamelib/gummworld2/spatialhash.py"> here</a>, or you can SVN the repo at the address above. </p>