Border the placement highlight along the footprint perimeter (#47) #133

Merged
liamjd merged 1 commit from 47-highlight-perimeter-border into main 2026-09-27 20:27:30 +01:00
Owner

Draws a border around the building placement highlight, outlining the footprint along its actual shape.

Changes

  • BuildingFootprint.open_sides(cells, cell): static helper next to calculate_bounds(). It returns the sides of a cell whose neighbour is not in the footprint (the #37 perimeter rule). It checks cell membership rather than bounds, so an L's notch and a C's hollow are outlined too.
  • PlacementController._rebuild_highlight() draws the border as quads in the same ImmediateMesh, surface and material as the fill. The border differs only in vertex alpha (highlight_border_alpha, 0.9). Quad emission moved into _add_highlight_quad().
  • tools/screenshot_placement_border.gd: headed check that drives the real _rebuild_highlight() at near and max zoom.

Decisions

  • One outline around the footprint (the issue's option 2), not one per tile. It runs along the true cell edge, so the inset gaps sit inside the frame. Chosen because the acceptance criteria describe the L being outlined along its actual shape. The per-tile variant was not tried for comparison.
  • Width is a tile ratio: highlight_border_ratio = 0.1, which is 0.2 m on a 2 m tile. The ticket's 0.06 m is sub-pixel at the camera's max_zoom of 120, whereas 0.2 m is still about 2 px there.
  • Corners: north/south edges own the corners and east/west stop short, so no corner is drawn twice and doubles in alpha.
  • Steps: the outline follows each cell's own height. It breaks at the vertical face between levels, because nothing is drawn on that face.

Verification

  • Three new tests in test_building_footprint.gd (a lone cell, a block's interior, the cell beside an L's notch). They were red before open_sides() existed.
  • Full GUT suite: 751/752 passing, 1 existing pending (#85).
  • Headed screenshots at zoom 30 and 120 of a 3x3, the L, the thick C and a 3x3 across a two-level step. The border reads at both zooms, the notch and hollow are outlined correctly, and nothing is drawn across the interior.
  • Checked in game.

Closes #47

🤖 Generated with Claude Code

Draws a border around the building placement highlight, outlining the footprint along its actual shape. ## Changes - `BuildingFootprint.open_sides(cells, cell)`: static helper next to `calculate_bounds()`. It returns the sides of a cell whose neighbour is not in the footprint (the #37 perimeter rule). It checks cell membership rather than bounds, so an L's notch and a C's hollow are outlined too. - `PlacementController._rebuild_highlight()` draws the border as quads in the same `ImmediateMesh`, surface and material as the fill. The border differs only in vertex alpha (`highlight_border_alpha`, 0.9). Quad emission moved into `_add_highlight_quad()`. - `tools/screenshot_placement_border.gd`: headed check that drives the real `_rebuild_highlight()` at near and max zoom. ## Decisions - **One outline around the footprint** (the issue's option 2), not one per tile. It runs along the true cell edge, so the inset gaps sit inside the frame. Chosen because the acceptance criteria describe the L being outlined along its actual shape. The per-tile variant was not tried for comparison. - **Width is a tile ratio**: `highlight_border_ratio` = 0.1, which is 0.2 m on a 2 m tile. The ticket's 0.06 m is sub-pixel at the camera's `max_zoom` of 120, whereas 0.2 m is still about 2 px there. - **Corners**: north/south edges own the corners and east/west stop short, so no corner is drawn twice and doubles in alpha. - **Steps**: the outline follows each cell's own height. It breaks at the vertical face between levels, because nothing is drawn on that face. ## Verification - Three new tests in `test_building_footprint.gd` (a lone cell, a block's interior, the cell beside an L's notch). They were red before `open_sides()` existed. - Full GUT suite: 751/752 passing, 1 existing pending (#85). - Headed screenshots at zoom 30 and 120 of a 3x3, the L, the thick C and a 3x3 across a two-level step. The border reads at both zooms, the notch and hollow are outlined correctly, and nothing is drawn across the interior. - Checked in game. Closes #47 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Adds BuildingFootprint.open_sides(), the #37 perimeter rule: a side of a
cell is outlined iff the neighbour across it is not in the footprint. It
walks cell membership rather than bounds, so an L's notch and a C's hollow
are outlined along their real shape.

_rebuild_highlight() draws the border as quads in the same surface and
material as the fill, differing only in vertex alpha. It runs along the
true cell edge, so it frames the whole plot and the inset gaps sit inside
it. Width is a tile ratio (0.1, so 0.2 m) rather than the ticket's 0.06 m,
which is sub-pixel at the camera's max zoom. North/south edges own the
corners so no corner is drawn twice and doubles in alpha.

tools/screenshot_placement_border.gd drives the real _rebuild_highlight()
at near and far zoom, across a 3x3, the L, the thick C and a stepped site.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
liamjd merged commit 1c9733da03 into main 2026-09-27 20:27:30 +01:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
liamjd/UntitledColonyBuilder!133
No description provided.