Files
jesse 1d23c187ad Daikoku PA: two perimeter ramps, far side served by the median opening
Rework the PA junction to match the reference drawing: yellow = PA -> highway
(entry), red = highway -> PA (exit). Entry and exit swap sides (entry now
EAST, exit WEST) and both trunks hug the PA perimeter instead of running
concentric spirals.

The simplification: both carriageways sit at the same deck level, adjacent,
so the median opening IS the far-side access path. The under-deck crossing
and merge runs are deleted outright -- 8 runs collapse to 4, and the
girder-soffit ceiling logic that constrained the crossing goes with them.
Part count 24,210 -> 21,691.

The median opening is now load-bearing rather than cosmetic (it is the only
route from the far carriageway to the ramps), so it widens from 6 to 9
samples per junction.

Orientation is a single flip-able constant (ORIENT) so a mirrored result is
a one-line correction, not a rewrite.

Measured on the built map (not asserted):
  - 600 entry + 600 exit ramp parts
  - max grade 8.00% / 8.27%, under the 9% limit
  - 0 collisions with piers/masts/girders (558 structural parts)
  - segment continuity <= 2.5 studs; trunk->merge handoff <= 1.7 studs
  - merge lands at dY 0.0 (exact deck level), 33 studs lateral
  - median open at junctions: 0 parts vs. control ~7 on plain mainline

Two traps worth recording, both caught by controls:

1. Studio's require() cache silently rebuilt STALE code. The first "passing"
   build reported 17,575 parts and zero ramps, and the map contained
   PAOffRamp/PAOnRamp parts whose names exist nowhere in the current source.
   Every measurement taken before this was describing an old map. Added
   tools/rebuild_fresh.luau, which clones the module to bust the cache; use
   it rather than requiring MapBuilder directly.

2. A reported "median never opens" bug was a bad probe, not a defect. It
   counted `Barrier` (the outer edge parapet, which must NEVER open) instead
   of `Median_<i>`. Re-run against the right name: control 7, junctions 0.

Both were only visible because the probes carry controls -- a 0-hit result
with no control is vacuous. The verification harnesses are kept in tools/
with their controls built in.
2026-08-03 11:53:40 -04:00

72 lines
1.8 KiB
Luau

-- Median opening test, now against the CORRECT part name. The centre divider
-- is "Median_<i>"; "Barrier" is the outer edge parapet (which must NOT open).
local ws = game:GetService("Workspace")
local map = ws:FindFirstChild("Map")
local medians, roads = {}, {}
for _, d in ipairs(map:GetDescendants()) do
if d:IsA("BasePart") then
local b = d.Name:gsub("_?%d+$", "")
if b == "Median" then
table.insert(medians, d.Position)
elseif b == "Road" then
table.insert(roads, d.Position)
end
end
end
local anchors = {}
for _, d in ipairs(map:GetDescendants()) do
if d:IsA("BasePart") and (d.Name == "PAEntryRampNear_200" or d.Name == "PAExitRampNear_200") then
table.insert(anchors, { d.Name, d.Position })
end
end
local WIN = 220
local function countNear(pos, list)
local n = 0
for _, bp in ipairs(list) do
if (Vector3.new(pos.X, 0, pos.Z) - Vector3.new(bp.X, 0, bp.Z)).Magnitude < WIN then
n += 1
end
end
return n
end
local out = {}
table.insert(out, ("medianParts=%d roadParts=%d window=+/-%d"):format(#medians, #roads, WIN))
local ctrl = {}
local step = math.max(1, math.floor(#roads / 14))
for i = 1, #roads, step do
local p = roads[i]
local far = true
for _, a in ipairs(anchors) do
if (Vector3.new(p.X, 0, p.Z) - Vector3.new(a[2].X, 0, a[2].Z)).Magnitude < 700 then
far = false
end
end
if far then
table.insert(ctrl, countNear(p, medians))
end
end
table.sort(ctrl)
local sum = 0
for _, v in ipairs(ctrl) do
sum += v
end
table.insert(
out,
("CONTROL plain mainline (n=%d): min=%d median=%d max=%d mean=%.1f"):format(
#ctrl,
ctrl[1] or -1,
ctrl[math.max(1, math.floor(#ctrl / 2))] or -1,
ctrl[#ctrl] or -1,
#ctrl > 0 and sum / #ctrl or -1
)
)
for _, a in ipairs(anchors) do
table.insert(out, ("JUNCTION %s: mediansInWindow=%d"):format(a[1], countNear(a[2], medians)))
end
return table.concat(out, "\n")