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
Good resource on spatial data structures
Good resource on spatial data structures
----------------------------------------
Sluicer Games
Sluicer Games
Re: Good resource on spatial data structures
TL;DR:
Article explains how to put your stuff to grid, and then explains how to put it into sparse quadtree.
Article explains how to put your stuff to grid, and then explains how to put it into sparse quadtree.
-
- Party member
- Posts: 712
- Joined: Fri Jun 22, 2012 4:54 pm
- Contact:
Re: Good resource on spatial data structures
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.
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.
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
- Roland_Yonaba
- Inner party member
- Posts: 1563
- Joined: Tue Jun 21, 2011 6:08 pm
- Location: Ouagadougou (Burkina Faso)
- Contact:
Re: Good resource on spatial data structures
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.
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.
Who is online
Users browsing this forum: No registered users and 2 guests