Good resource on spatial data structures

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
clofresh
Citizen
Posts: 87
Joined: Sun Jul 26, 2009 4:21 pm
Contact:

Good resource on spatial data structures

Post 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
----------------------------------------
Sluicer Games
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Good resource on spatial data structures

Post by raidho36 »

TL;DR:
Article explains how to put your stuff to grid, and then explains how to put it into sparse quadtree.
Germanunkol
Party member
Posts: 712
Joined: Fri Jun 22, 2012 4:54 pm
Contact:

Re: Good resource on spatial data structures

Post 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.
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
User avatar
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

Post 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.
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests