Page 1 of 1

Good resource on spatial data structures

Posted: Tue Jul 09, 2013 1:36 am
by clofresh
Found this good link on reddit about using special data structures to improve the efficiency of finding things in 2d space:

http://gameprogrammingpatterns.com/spat ... ition.html

The example code is in C++ but it's easily translatable to Lua.

Original reddit thread

Re: Good resource on spatial data structures

Posted: Tue Jul 09, 2013 7:36 pm
by raidho36
TL;DR:
Article explains how to put your stuff to grid, and then explains how to put it into sparse quadtree.

Re: Good resource on spatial data structures

Posted: Tue Jul 09, 2013 10:41 pm
by Germanunkol
Good article, thanks for sharing!

Somehow I think some of those more complex versions of spacial organization would be quite annoying to implement in Lua though. Possible, of course, but I wouldn't like doing it... I think I'll stick to the non-resizable grid or sector version if I ever need it.

Re: Good resource on spatial data structures

Posted: Wed Jul 10, 2013 1:57 pm
by Roland_Yonaba
Very good link, thanks for sharing.
I'll mention my work on the topic, see here (Demo here).

Also, take a look at Vrld's spatialHash module in HardoncCollider, it's a nice example. We have a similar implementation, mine's a bit uncommon, though, see here for more details.