Files
tokyo-wangan-racing/tools/probe_ramp_geo.luau
T
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

83 lines
2.1 KiB
Luau

-- READ-ONLY geometry probe for the ramp redesign. Does NOT call MapBuilder.build().
local rs = game:GetService("ReplicatedStorage")
local cm = rs:FindFirstChild("Shared") and rs.Shared:FindFirstChild("Circuit")
if not cm then
return "Circuit module not found at ReplicatedStorage.Shared.Circuit"
end
local Circuit = require(cm)
local c = Circuit.PA_CENTER
local R = Circuit.PA_RADIUS
local S = Circuit.samples
local out = {}
local function log(...)
table.insert(out, table.concat({ ... }, " "))
end
log(
("PA_CENTER = %.0f, %.0f, %.0f PA_RADIUS = %.0f ringR = %.0f samples = %d"):format(
c.X,
c.Y,
c.Z,
R,
R + 130,
#S
)
)
-- Apron extent from the LIVE map (no rebuild).
local m = workspace:FindFirstChild("Map")
if m then
local f = m:FindFirstChild("PAFloor", true)
if f then
log(
("PAFloor centre %.0f,%.0f size %.0f x %.0f -> X %.0f..%.0f Z %.0f..%.0f"):format(
f.Position.X,
f.Position.Z,
f.Size.X,
f.Size.Z,
f.Position.X - f.Size.X / 2,
f.Position.X + f.Size.X / 2,
f.Position.Z - f.Size.Z / 2,
f.Position.Z + f.Size.Z / 2
)
)
end
-- Orientation anchors: which world direction the buildings sit in.
for _, n in ipairs({ "PAHonkan", "PANibankan" }) do
local b = m:FindFirstChild(n, true)
if b then
log(
("%-12s at %.0f, %.0f (dX %+.0f, dZ %+.0f from PA centre)"):format(
n,
b.Position.X,
b.Position.Z,
b.Position.X - c.X,
b.Position.Z - c.Z
)
)
end
end
end
-- Mainline samples near the PA: index, world pos, deck height, distance and
-- bearing from the PA centre. Bearing is atan2(dZ,dX) in degrees.
log("")
log("idx X Z deckY dist bearing note")
for i, s in ipairs(S) do
local dx, dz = s.pos.X - c.X, s.pos.Z - c.Z
local d = math.sqrt(dx * dx + dz * dz)
if d < 1000 then
local br = math.deg(math.atan2(dz, dx))
if br < 0 then
br += 360
end
local note = ""
if s.tunnel then
note = "TUNNEL"
end
log(("%4d %7.0f %7.0f %6.1f %6.0f %6.1f %s"):format(i, s.pos.X, s.pos.Z, s.pos.Y, d, br, note))
end
end
return table.concat(out, "\n")