Uncommenting the random-seed line left its trailing prose 'if 0 also
randomizes' as code, which stopped the whole project compiling. Only the
comment marker is restored — the choice of random-vs-fixed seed is left as set.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Task 17 corrected the density sign convention in §1-§2 but left §4's worked
example on the old inverted convention, so the doc contradicted itself. §4 now
matches: negative is underground, positive is air. Also corrects a stale
16x16x64 chunk reference to 24x24x256.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A* was searching almost the whole island for every road. Godot's stock
estimate-to-goal is plain straight-line distance, which assumes every step
costs 1 — but a step through mountains costs up to 401 and a step near an
existing road cost 10,001. With the estimate that far below reality, A* cannot
rule anything out, so it degenerates toward Dijkstra.
Two changes, both aimed at that:
1. RoadPathGrid overrides the estimate to scale it by HEURISTIC_WEIGHT (3.0),
i.e. weighted A*. Paths may be up to 3x costlier than the theoretical best
in exchange for exploring far less. This does NOT push roads over mountains:
a ridge costs hundreds of times more than going around, which a 3x bias
nowhere near pays for.
2. ROAD_REPULSION_PENALTY replaces the hardcoded +10000 with 250. The old value
made ground near a road effectively infinite, and it compounded — each road
drawn made the next search slower. 250 still strongly discourages roads from
running alongside each other.
Terrain weights are untouched: the mountain curve (1 + elevation^3 * 400),
beach and wasteland costs are exactly as before, so mountains remain expensive
and roads still avoid them. Routing, tiers, smoothing and grid resolution are
also unchanged.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Every road path search — highway, branch, county — now goes through one
function instead of three direct GetPointPath calls. The function body is
exactly the call it replaced, so behaviour is unchanged.
This exists so the next commit's pathfinding change can be judged on its own:
if the generated map changes after this point, it was the heuristic, not a
refactor slip.
Routing is untouched: which towns connect, loop order, Prim's daisy-chain,
tier assignment and the abandon protocol all deal only in town positions and
never touch the grid.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Every README was read first, checked against the code in its directory, then
rewritten to describe what the code actually does now.
Corrected throughout: map size is config-driven (8192 default) not a fixed
4096; chunks are 24x24x256 not 32x32; road carving is implemented for all four
tiers, not a 'next step'; Data/ and Resources/ are empty, not populated.
Also fixed MATH_MARCHING_CUBES.md, which documented the density sign convention
exactly backwards — it claimed positive was underground, where the code treats
positive as above the surface and counts a corner inside when density < iso.
Getting that backwards inverts every normal, a bug this project has hit before.
The root README now carries accurate run steps: F5 runs the map generator (not
the game), F6 on Scenes/Main.tscn runs the 3D world, and ChunkRadius is a load
radius that should be dropped to 4-8 while iterating.
Docs only. No code changed.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
All four road tiers now carve into the 3D world. Rugged and Trail were
generated, exported and parsed all along, but nothing ever consumed them —
which is why county roads visible on the 2D map did not exist in 3D.
Tier identity is now carried into the carve via a RoadSegment struct, so each
tier gets its own width, shoulder and grade-smoothing from one tunable block in
Constants: highways widest and holding a grade, trails narrow and hugging the
land. Rugged and Trail surface as dirt rather than asphalt.
Because tiers now have different reach, nearest-by-distance was no longer a
sound way to pick the governing road — a nearby footpath could shadow a highway
whose shoulder still covered the column. The carve now considers only roads
whose shoulder actually reaches, and takes the closest of those.
The per-chunk cull pad is derived from the widest shoulder plus a margin, so
widening a road cannot silently truncate it at chunk edges.
Untouched: density field, Marching Cubes interpolation/welding, chunk dims,
the .dat contract, the 2D A* generation, and mesher normals.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
HeightAtPixel read a single heightmap cell after truncating the coordinate with
(int). Road path points are fractional and spaced under a metre apart, so
consecutive points truncated into the same cell (flat), then tipped into the
next one (a full inter-cell jump) — a metre-scale staircase under F2's fix.
It now reads the four surrounding cells and blends them bilinearly using the
fractional part of the coordinate, so height varies continuously with position.
Edge clamping is preserved: at the map border the second cell clamps back onto
the first, making the blend a no-op rather than an out-of-range read.
Only the sampling helper changed. Signature and both callers are untouched.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Road elevation is now sampled at the point on the road segment nearest the
column being carved, instead of at the segment's midpoint. The old behaviour
gave every column near a segment that segment's single midpoint height, so each
stretch of road was one flat plank and consecutive planks stepped like a
staircase wherever the road crossed a gradient.
Elevation now varies continuously along the segment, and because neighbouring
segments share an end point the height matches exactly at the joins. A new
ROAD_GRADE_SMOOTHING constant dials between holding a straight grade
(cut-and-fill) and hugging the land, per D-021.
Untouched: density field, Marching Cubes, chunk dimensions, the .dat contract,
and the 2D A* road network itself. Only how existing paths are carved into 3D.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Vertex colour is now chosen from the true, unrounded surface height and faded
between adjacent materials across a tunable band, instead of switching at one
rounded integer depth. This removes the horizontal contour banding.
Colour path only: density field, Marching Cubes interpolation/welding, chunk
dimensions, the .dat contract and all road logic are untouched. BlockID
classification is unchanged and still drives non-visual use.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>