Birdoggydog's Builds

Fixing the wall edging on slopes and a wall gap in Godot

The hazard band at a wall's foot now follows ramps and stairs, and walls on floors sunk below zero are drawn again. Two bugs I spotted in films.

Both of these came from watching the films of earlier dungeon work. In one the yellow and black hazard band at a wall’s foot ignored the ramps and stairs beside it, and in the other the sky showed through a gap in a wall.

Why didn’t the hazard band follow the ramps?

On floors with heights, the band along a wall’s foot now slopes with a ramp beside it, climbs along a stair, and is never drawn on the faces of a stair or ramp. At the foot of a ledge it runs along the floor of the hall below.

30 seconds on the test sheet: the band sloping down beside the ramp, climbing beside the stair, running along the hall at the gallery’s foot, and the kerb on the ledge’s edge.

When I merged the interior pieces on floors with heights, I noticed the band at the bottom of the walls was wrong. The walls are squares, and the band was part of the wall’s picture, which starts at the wall piece’s foot. So it was always level, and it showed up on stairs where it shouldn’t.

The wall pieces stay square. Where the floor beside a wall isn’t level (the sides of a stair or ramp, a smoothed step’s wedge, and the foot of a ledge’s face), the pieces now wear the same picture without the band. The band is a separate strip, 0.5 m tall, standing 0.17 m in front of the wall. Its foot is cut to the floor’s line.

To find that line, the code reads the walking floor along each side of a square, 0.3 m in from the wall, every 0.125 m, using DungeonPlan.floor_under(). If any reading is more than 5 mm from the square’s foot height, the side gets a strip. A stair’s floor line is the line through the feet of its risers, not its treads, and that is what makes the band climb along a stair as one slope. I put stepping with each tread against sloping on the Review Desk and kept the slope.

The strip is one ArrayMesh built with a SurfaceTool, with points every 0.25 m along the wall. Its face reaches 1 cm under the floor’s line so no light shows beneath it, and its picture is laid from the grid’s lines, as the wall’s is, so the stripes of the strip and the wall beside it line up.

I also wanted a test for future pieces. Every part the interior kit lays is named in one of two lists in InteriorEdging: parts that meet a floor and how, and parts that don’t. A new piece in neither list fails the test by name. For the ones that meet a floor, the test checks the edging’s lower line against the floor every 10 cm and requires it to be within 2 cm. It also checks that no strip lies over a walking surface. On the old code the test failed 5 checks, with 295 points off the floor. It passes 11 of 11 now. Sheets with no heights lay exactly as before.

Eight film frames from a first-person view of a gray metal corridor, a stair and a ledge, each with a yellow and black band along the foot of the walls.

Contact sheet of the film, with its captions.

Why was there sky showing through a wall?

The film of round rooms and curved corridors showed a wall that stopped, with the void behind it, where a ramp comes down into a sunken round room. I said to merge it but fix the gap, and it’s fixed.

30 seconds: the same spot as the earlier film, now with the ramp’s side walls drawn, then a slow turn around the room rounded on one square and a curved corridor corner.

I thought a curved wall was stopping short of a straight one, but the curve wasn’t the problem. DungeonShape.wall_faces() makes each wall in runs of squares with the same foot height, and it used -1.0 to mean “no wall here”. A wall standing on a floor sunk below the dungeon’s zero has a foot under zero, so it counted as no wall and was never made. The ramp’s two side walls and the sunken room’s way in are exactly that. It affected every sheet built from plain flat faces, which means every curved sheet and any sheet with heights and no interior theme. The fix was changing the no-wall value to negative infinity, which ledge_faces already used.

The old gap check passed because rays were cast against the collision rock, and rock stands behind a wall that isn’t drawn. The new check puts every drawn triangle on a separate probe body on physics layer 32, so a ray sees only what the eye sees. Eyes are every walkable square of every curved room, at five spots in each square and two heights. Rays go out in 32 directions at eight pitches from -60 to +75 degrees, and each must hit a drawn face no more than 0.15 m beyond the rock. On the old code 1,224 of 166,959 rays saw the sky on the curved sheet, and 25,934 of 209,431 on the same sheet with no curves. Now it’s none.

Eight film frames. The first two show a dark ramp wall and sunken room, then a slow turn around a round room and a curved corridor, all with walls drawn up to the ceiling.

Contact sheet of the film, with its captions.

While checking this I found that furniture backed onto a rounded wall can poke through the arc by up to 0.26 m. I haven’t built a fix for that. It’s on the work list.