test(octree): smoke tests for the 2.5D pattern (Camera3d + same-Z gameplay)#1477
Merged
Conversation
…eplay) Add three smoke tests guarding the architectural claims in the wiki's new 2.5D-games section (Working in 3D — Paper Mario-style): - `world.sortOn = "depth"` swaps the broadphase to an Octree - Two entities sharing a Z plane surface as broadphase candidates of each other so SAT can resolve the XY overlap (or non-overlap) exactly as in a 2D world - A Renderable inserted via `world.addChild(child, 0)` is retrievable through the broadphase's 2D-Rect path that `adapter.queryAABB(rect)` uses internally These guard against regressions in the World → broadphase pipeline for the 2.5D use case before issue #1476 lands a worked example on top. Notably absent: a "parallax-Z items are pruned from gameplay-Z queries" test. The wiki's initial draft overpromised free Z isolation, but the Octree's strict midpoint test (`rz < mid`, `rz > mid`) keeps items at exactly the depth midpoint stuck at root, so a z=0 gameplay plane under the default ±10000 root box doesn't actually get parallax isolation from the broadphase. Wiki has been corrected to recommend `isKinematic`/`collisionType` for deterministic gameplay-vs-parallax filtering — same advice that already applies to 2D Camera2d + QuadTree. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds three smoke tests in `tests/octree.spec.js` guarding the architectural claims in the wiki's 2.5D Games section:
These guard against regressions in the World → broadphase pipeline for the 2.5D use case before #1476 lands a worked example on top.
What this PR also fixes (in the wiki, not code)
The initial draft of the 2.5D wiki section overpromised "free Z isolation" between gameplay and parallax via the Octree. Writing the test surfaced that this isn't true: the Octree's strict midpoint test (`rz < mid`, `rz > mid`) keeps items at exactly the depth midpoint stuck at root and visible to every query. Under the default ±10000 root box, gameplay at `z = 0` is at the midpoint, so the broadphase walk doesn't isolate it from parallax. The wiki page has been corrected on the same day to recommend `isKinematic` / `collisionType` for deterministic gameplay-vs-parallax filtering — same advice that already applies to 2D Camera2d + QuadTree.
The missing test ("parallax-Z items pruned from gameplay-Z queries") is not added — it would have failed against the actual behavior, which is documented behavior, not a bug.
Test plan
Related
🤖 Generated with Claude Code