RFC: Fix straight-view draw order (walls bucket at their visible face) - #5068
Merged
Loobinex merged 2 commits intoJul 29, 2026
Merged
Conversation
RupixTalahone
force-pushed
the
review/frontview-depth-doctrine
branch
from
July 27, 2026 17:17
7f66893 to
0fa4342
Compare
Contributor
Community report: creatures show through the tops of walls they stand behind. Root cause: draw_element buckets a whole column at the tile's NORTH edge, but the visible wall face is the SOUTHERN boundary plane - one tile later in draw order. Any thing bias toward the camera (the size bias from dkfans#5062, or the legacy -3 for a thing in the southern strip of its tile) could out-bucket the wall directly south and paint the whole sprite over the wall top. - Wall-class columns (tall AND blocking) bucket faces and caps at the south edge. Walkable columns of any height (dungeon heart pedestal, room floors) are floors and keep the early bucket. - A wall whose screen-south neighbor is also wall-class shows no face at all, so its top draws over everything nearby - this also cuts wide sprites brushing a wall strip sideways. - The dig/place markers lift three rows to stay above those tops. - The shared bucket margin grows 64 -> 1024: bottom-screen rows spent the 1997-sized margin, clamped into bucket 0 and lost all ordering. Known residual: a wide sprite south of an EXPOSED end face can still overlap it; that case needs per-pixel depth and also exists today. RFC with full reasoning and test matrix accompanies this branch. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
RupixTalahone
force-pushed
the
review/frontview-depth-doctrine
branch
from
July 28, 2026 10:43
0fa4342 to
e4b7c46
Compare
RupixTalahone
marked this pull request as ready for review
July 28, 2026 10:57
Member
|
@RupixTalahone I tested it, and with this PR I can see the green boundbox through walls. (you get that when building rooms). In Alpha 5249 this goes correct, as does the seeing imps through walls bug. |
The frontview build-room volume box carries a depth bias that ducks its lines under wall faces. It was tuned against the old north-edge wall bucketing; with walls bucketing at their visible face the old 3.5-subtile compensation overshoots and the box bottom line shows through walls where unrevealed terrain lies beyond. The committed 2.75 subtiles was measured against a test matrix at 4K: box over walls, against walls with dark beyond, over open and unrevealed ground, both box render modes, across zoom. Co-Authored-By: Claude Fable 5 <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.


Draft on purpose: this fixes the reported bug in our testing, but it changes 29-year-old draw-order behavior, so we want the reasoning reviewed before it counts as ready. Tear it apart.
The bug
Community report: creatures visible through the tops of walls they are standing behind in the straight view (reproduces on alpha 1.4.0.5252). Same family as #5060 / #5062 / #5066: draw-order assumptions sized for 320x200 breaking at modern zoom.
Root cause
The straight view buckets by screen pixels. draw_element buckets the entire column at the tile's NORTH edge, but the visible wall face is the tile's SOUTHERN boundary plane, one tile later in draw order. Any thing bias toward the camera (the #5062 size bias, or even the legacy -3 for a thing standing in the southern strip of its tile) can out-bucket the wall directly south of it, and once the feet cross that line the whole sprite draws over the wall top. Separately, the +64 bucket margin was sized for the legacy -3 bias; at the bottom rows of the screen modern biases overspend it, everything clamps into bucket 0, and ordering collapses there.
The fix (one file, +45/-8)
Testing
4K, straight view, on two builds: this branch applied to current master, and the truecolor fork where it soaked first. Creatures behind walls are buried at every position including pressed against the wall; creatures in front keep their heads; lair rooms full of nests show no tile-boundary cuts; the heart is fully visible on its pedestal; markers stay visible on tagged strips; bottom-edge ordering holds. The max-zoom sprite vanish still present on this branch is #5066, not this change.
Known residual (pre-existing)
A wide sprite whose feet are south of a wall's EXPOSED end face can still overlap that face. The bucket list sorts on one axis and this case needs the second one; the honest fix for it is per-pixel depth, and it exists in current master too.
Review questions
SlbAtFlg_Blockingplusget_column_floor_filled_subtiles >= 3. Is there map content this misclassifies (walkable 3+ columns, blocking 2-cube ledges)?🤖 Generated with Claude Code
Update: volume box depth bias retuned (addresses the boundbox report below)
The build-room volume box carries a hand-tuned depth bias that ducks its lines under wall faces. It was calibrated against the original north-edge wall bucketing; with walls bucketing at their visible face, the branch's earlier 3.5-subtile compensation overshot and the box's bottom line showed through walls where unrevealed terrain lies beyond. The committed 2.75 subtiles was measured against a test matrix at 4K: box over walls, against walls with dark beyond, over open and unrevealed ground, both box render modes, across zoom levels.
Two things reviewers should know: