Skip to content

Instantly share code, notes, and snippets.

@appgurueu
Created January 16, 2022 18:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save appgurueu/80031bb650f614df472e58722241992d to your computer and use it in GitHub Desktop.
Save appgurueu/80031bb650f614df472e58722241992d to your computer and use it in GitHub Desktop.
R-tree based box stores

R-tree based box stores

Aspect AreaStore ObjectBoxStore
Purpose Storing "voxelareas" for fast spatial queries Storing objects by (collision
Engine-internal use: Server No (only Lua API) Yes (object-object collision, raycasting, objects in area)
Engine-internal use: Client No Yes (object-object collision, raycasting)
Main use case Protection Obtaining nearby entities, raycasting
Queries Point query, area query Area query, raycasting
Serialization Yes Not reasonable (IDs aren't persistent)
Caching Yes, mapblock-based Not reasonable

minetest.get_objects_in_area and minetest.get_objects_inside_radius may not have their compat broken.

They may not take into account selection- or collisionboxes therefore.

A PointStore might be useful to store their positions to speed up those queries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment