ShitboxInfinity/tools/build_all_junctions.sh
m3ultra 65da434678 Real terrain: DEM elevation under every level
tools/fetch_dem.py pulls the open AWS terrarium elevation tiles for each
level's bbox (derived from the OSM geometry itself -- the fetch bboxes were
never recorded) and writes an f32 heightmap. The builder bilinear-samples it:
roads/footpaths/crossings drape (subdivided to ~8 m so long OSM segments stop
chording across curved ground), buildings lift rigidly to the lowest terrain
under their footprint with a 2 m foundation skirt, trees/props/planters ride
their own base heights, and the flat ground slab becomes a real terrain mesh.
Bridges get an explicit deck profile (lerp between end heights plus a hump)
instead of draping down into the river, the truss follows the deck, and the
Bradfield Highway now genuinely flies over Kemp Place -- the game has an
underpass. Kangaroo Point's cliffs are an actual 20 m drop, Edward Street
climbs to 55 m at Spring Hill.

Junction events bake spawn/convoy heights (osm_junction.py grew a pure-python
DEM sampler); the game respects marker heights everywhere it used to hardcode
ground=0.

Bugs the terrain surfaced, all found by measurement:
- Long road segments chorded across curved ground: the car visually sank to
  its windows mid-block. Fixed by subdividing draped ribbons.
- The 9 m terrain grid aliases cliff edges and bulged metres ABOVE the finely
  draped roads: a car spawning there was inside the terrain sheet and got
  depenetrated through the floor into the void (y = -710). Fixed by giving
  roads real collision and carving the terrain grid down wherever a draped
  road sample lands (11k+ carve samples on Kangaroo Point alone).
- The junction validator and tuner drove throttle-only, which cross-slope
  drift turned into 40-86 m misses; they now hold aim like a player would.
- Edward x Elizabeth launched down a 17% grade, went airborne at the crest
  and wedged off-street: unwinnable geometry, not a bug. Swapped for
  Elizabeth x George on the flat lower CBD. All 9 junctions validate.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-30 15:08:42 +10:00

24 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
# Regenerate every OSM crash-junction event. The spec strings live here because
# they were previously nowhere -- the original invocations weren't recorded, and
# recovering "which two streets is this event?" meant re-deriving them from the
# generated geometry. Don't let that happen twice.
#
# woolies_carpark/junctions.json is hand-authored (Trolley Run) and not touched.
set -e
cd "$(dirname "$0")/.."
C="${OSM_CACHE:-$HOME/.cache/burnout_osm}"
[ -d "$C" ] || { echo "no OSM cache at $C -- see README"; exit 1; }
while IFS='|' read -r id json lat lon specs; do
[ -z "$id" ] && continue
IFS=';' read -ra SPEC <<< "$specs"
python3 tools/osm_junction.py "$C/$json" "levels/$id/junctions.json" "$lat" "$lon" "${SPEC[@]}"
done <<'EOF'
queen_st_mall|brisbane_cbd.json|-27.4699|153.0251|Albert x Adelaide|Albert Street|Adelaide Street;Elizabeth x George|Elizabeth Street|George Street
southbank|southbank.json|-27.4775|153.0215|Melbourne x Merivale|Melbourne Street|Merivale Street;Grey x Glenelg|Grey Street|Glenelg Street
albert_parklands|albert_parklands.json|-27.4740|153.0280|Alice x George|Alice Street|George Street;Margaret x Edward|Margaret Street|Edward Street
story_bridge|story_bridge.json|-27.4635|153.0355|Bridge Approach|Bradfield Highway|Kemp Place
kangaroo_point|kangaroo_point.json|-27.4780|153.0345|Cliffs Corner|River Terrace|Main Street
EOF
echo "junctions rebuilt (woolies_carpark left alone -- hand-authored)"