Add spatial queries for destructables and rects - #469
Conversation
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9c523c0bed
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| function createCellLists() | ||
| for i = 0 to gridWidth * gridHeight - 1 | ||
| cellContents.add(new ArrayList<DestructableSpatialRecord>(4)) |
There was a problem hiding this comment.
Allocate empty cell buckets lazily
On large maps, initialization executes this allocation once for every grid cell, even when most cells contain no destructables. Each ArrayList(4) creates an object and advances the specialized backing store by four slots, so the default 256-unit cells can produce tens of thousands of objects and substantial Lua startup/memory overhead based solely on map dimensions. Store null buckets initially and instantiate a cell list only when the first record is added.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in d38e529: cellContents now starts with null entries, and each bucket is allocated only when its first destructable is registered. Empty map cells no longer allocate ArrayLists.
|
@codex review |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Codex review loop complete.
PR #469 is ready to merge; merging remains a maintainer decision. |
Summary
destructablesInRectanddestructablesInRangeSparseSet queries.unitsInRecton top of the existing unit spatial index, preserving native rect lower-bound semantics.Checks
grill typecheck --quiet— passed.grill test --quiet— passed.git diff --cached --check— passed.The full
grill buildcould not run because the Wurst compiler is not installed in the environment.Scope and known gaps
registerSpatialIndex()and unregister before removal.