Search found 16 matches

by Rick Astley
Tue Sep 14, 2021 9:45 am
Forum: Libraries and Tools
Topic: array - a library for tables
Replies: 0
Views: 11980

array - a library for tables

This library is a useful collection of functions to work with Lua tables in a array fashion. There are other libraries around which have the same intent, and this one does not aim to outclass them. A quick example array = require 'array' -- create an array object from a set of items a = array.from(0...
by Rick Astley
Sat Aug 07, 2021 8:54 am
Forum: Libraries and Tools
Topic: rstar - an advanced space indexing library
Replies: 20
Views: 18533

Re: rstar is here for you!

Gunroar:Cannon() wrote: Thu Aug 05, 2021 9:05 pm :o SO SORRY. Already knew that one. Though still useful(but in a way still collision detection, like bump.lua, not a bad thing). Anything else?
Anything focused on space. I think that with some immagination, it could also have other original uses... but dunno
by Rick Astley
Sat Aug 07, 2021 7:59 am
Forum: Libraries and Tools
Topic: rstar - an advanced space indexing library
Replies: 20
Views: 18533

Re: rstar is here for you! - now with demo

BrotSagtMist wrote: Fri Aug 06, 2021 10:51 pm Sounds awesome.
Sadly the Demo doesnt run here.
I get: game.lua:290: attempt to call field 'mod' (a nil value)
Try replacing that line with

Code: Select all

math.fmod(i-1, 3)
or

Code: Select all

(i-1) % 3
One of these should fix the error, depending on your Lua version.
by Rick Astley
Thu Aug 05, 2021 6:25 pm
Forum: Libraries and Tools
Topic: rstar - an advanced space indexing library
Replies: 20
Views: 18533

Re: rstar is here for you!

Gunroar:Cannon() wrote: Wed Aug 04, 2021 7:01 pm Nice. Can it be used for something other than collision detection.
Off course, a example is reducing the number of drawing calls to the strictly nececessary. You can think about your window as a rectangle, which can be used to search in the tree to get only objects that are visible on screen.
by Rick Astley
Tue Aug 03, 2021 11:08 pm
Forum: Libraries and Tools
Topic: rstar - an advanced space indexing library
Replies: 20
Views: 18533

Re: rstar is here for you!

I imagine the R* technique covers that case better, but I'm concerned about insertion/deletion time. I've just remebered that I forgot to mention a important thing, my bad. :death: Before the release of this library, version 1.1 was alredy planned, because I wanted to add another feature in a later...
by Rick Astley
Tue Aug 03, 2021 8:18 am
Forum: Libraries and Tools
Topic: rstar - an advanced space indexing library
Replies: 20
Views: 18533

Re: rstar is here for you!

I'm struggling, out of my own ignorance, to understand how storing rectangles in a tree can be useful. I looked through the original post and don't 'get it'. Perhaps I've yet to uncover a problem that is breast solved by R trees. (I don't mean to devalue your library. All new libraries are good lib...
by Rick Astley
Mon Aug 02, 2021 5:21 pm
Forum: Libraries and Tools
Topic: rstar - an advanced space indexing library
Replies: 20
Views: 18533

Re: rstar is here for you!

Haha. no. I don't think the algorithm was made by him, just this implementation. Stands for rectangle (?) Really liking the sound of all this :awesome: . And then does that mean it's really fast in getting, let's say, all objects touching/inside an entity? You're right. I'm going to add a demo proj...
by Rick Astley
Mon Aug 02, 2021 5:07 pm
Forum: Libraries and Tools
Topic: rstar - an advanced space indexing library
Replies: 20
Views: 18533

Re: rstar is here for you!

GVovkiv wrote: Mon Aug 02, 2021 3:01 pm Does rstar stands for Rick Star?
I really wish it was like that haha :rofl:
by Rick Astley
Mon Aug 02, 2021 12:52 pm
Forum: Libraries and Tools
Topic: rstar - an advanced space indexing library
Replies: 20
Views: 18533

Re: rstar is here for you!

If you don't mind I would like to answer both your questions in a single post. R-Tree seems to be the king in handling rectangles (R stands for Rectangle). It's so popular that there are a lot of variants, which are improvements of the base idea. I chose R* variant because in my opinion it is the on...
by Rick Astley
Sun Aug 01, 2021 8:24 pm
Forum: Libraries and Tools
Topic: rstar - an advanced space indexing library
Replies: 20
Views: 18533

Re: rstar is here for you!

All search queries share the same base idea. Starting from the root: for each child see if it satisfies the input condition (intersects with rectangle or circle/contains a point); if yes, repeat on its children the same loop and go on until leaf level is reached. On the average case, that loop is do...