Optimizing Orb Pickup Detection in Large Spatial Grid

Context:
We’re developing a game where 10+ players (represented as red blobs) move across a 1000x1000 stud area divided into pre-existing spatial chunks (for optimized management). Players need to collect orbs placed on the ground.

Current Challenge:
We need an efficient way to detect when a player picks up an orb. A naïve approach using :GetPartsInBoundsInBox()/:GetPartsBoundsInRadius() in a per-frame loop for all players causes performance issues.

Goals:

  1. Minimize computational overhead for orb-player collision detection.
  2. Leverage the existing chunk system for spatial partitioning.
  3. Ensure scalability for 10+ players and potentially hundreds of orbs.

Proposed Solutions?

  • How would you implement chunk-aware proximity checks?
  • Are there optimized Roblox APIs or patterns for this?
  • Should detection happen client-side (with anti-cheat) or server-side?

Key Details:

  • Orb positions are static until collected.
  • Players move continuously.
  • Chunk system already tracks orb placements.

Looking for architecture/algorithm recommendations to reduce redundant checks while maintaining responsiveness.

Here is an image to see how this looks:
image

Sounds like a good use for quadtrees (if you don’t care about the up axis) or octrees (for 3d). Depending on how many nodes you have, you shouldn’t face any performance issues if even you radius search every frame.