map/archive/generated-history/FIX_LARGE_ADDITIONAL_GENERATION_NOTES.md
2026-08-08 17:41:30 +09:00

2.9 KiB

Large additional-generation fix

Symptoms

  • A moderately larger patch selection could appear to stop during generation.
  • A larger selection could return no visible preview or leave part of the selected area untouched.

Root causes

  1. app.js requested qualityTerrainAttempts: 1, but generatePatchAttempt() did not forward that option into the expansion candidate selector. An interactive click could therefore run extra terrain searches and a second complete production generation. On larger selections this could keep the patch worker busy long enough to look interrupted or be terminated under memory/CPU pressure.
  2. Expansion candidates are production-sized (258 x 183) but patch selections had no corresponding upper bound. A selection larger than the candidate window caused source indices outside that fixed candidate to be skipped, so portions of a large selection could remain effectively ungenerated.
  3. The first large-selection tiling prototype over-overlapped slightly oversized ranges, multiplying work. Tiling now evenly distributes the range with ~28-cell overlap.
  4. Internal tile seams initially treated roads/rails created by an earlier tile as pre-existing portal contracts. A later tile could then hard-fail on a road that did not exist before the user's operation. Only transport present before the entire large patch is now protected by the hard portal contract.

Changes

  • Forward qualityTerrainAttempts to the expansion candidate selector. Interactive generation now actually performs one requested full candidate per click.
  • Keep selections up to 258 x 183 on the existing single-candidate fast path.
  • Automatically split larger Expansion selections into overlapping production-sized tiles, including freeform/lasso selections via polygon clipping.
  • Process tiles outward from already-generated geography and merge all tile results into one preview world.
  • Soft per-tile quality floors may use best-available results; hard seam failures still reject the operation.
  • Preserve only the pre-operation road/rail set as a hard seam portal baseline across internal tiles.
  • Worker-owned previews avoid an unnecessary second large field snapshot; synchronous/API calls retain atomic rollback snapshots.

Validation

  • Direct near-limit patch 250 x 180: PASS, one full candidate, not tiled.
  • Large patch 280 x 200: PASS, 4 tiles, 56,000/56,000 selected cells covered by generated records, seam clean.
  • Worker large patch 280 x 200: PASS, outer worker result and inner patch result both successful, 4 tiles, seam clean.
  • STEP17 validation: PASS for Alternative variants 0 and 1; variants remain distinct.
  • STEP15 validation: PASS; Expansion seam clean, escaped footprint cells 0, unresolved road/rail portals 0.
  • Previous reported-geography regression: PASS; river-on-sea 0, duplicate capitals 0, tiny generated prefectures 0, admin/prefecture frontier breaks 0, established-frontier max elevation jump 0.0268.