[Tutor] Fastest (x,y) distance calculation

Zak Arntson zak at harlekin-maus.com
Fri Sep 12 20:27:17 EDT 2003


> Yes.
>
> Divide the world wap in to a n-by-n grid (perhaps with n=20);
> build a dictionary that mapping each intersection to a list of the
> closesest temples (with the farthest being no more than a grid
> step away from the nearest).
>
> Raymond Hettinger

I was considering this for the Temples. It's a great idea, because the
Temples don't move. I'm also planning on implementing the Mover objects
being able to find the closest Mover object. I may try to do something
similar with those, but I'm not sure what performance would be like, with
the grid being updated constantly by moving objects.

I hadn't imaged exactly how it would work, though. Thanks!

BSP Trees have also been suggested to me, and I'm still studying up on
them. I may finish this project and use BSP's on the next one, so I can
better figure them out.

---
Zak Arntson
www.harlekin-maus.com - Games - Lots of 'em



More information about the Tutor mailing list