Sunday, 2 June 2013

C++ How to implement a spatial hash (for a 2d Game)

C++ How to implement a spatial hash (for a 2d Game)

I feel kind of silly for asking this question, but are there examples or tutorials on how to implement a spatial hash (grid/cell-based partitioning), preferably in C++?
I'm stuck and I have no idea how to tackle this problem. I've searched all over but all I get are people saying "gosh that's easy to do", which I'm sure is true if you've seen another implementation or have done so yourself.
Instead of quadtrees I'd like to have a spatial hash to query areas of my game which has a very large world.
Thinking it probably wouldn't even have to account for sizes, merely points, as the type of game mine is that isn't that big of an issue. And if it is, I could always add that.

No comments:

Post a Comment