Deeper is richer: about 4.7x the ore in a world, shallow layers unchanged (t3)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-24 17:30:51 -04:00
co-authored by Claude Opus 5.5
parent 1da33e3703
commit 26d17c2b1d
3 changed files with 56 additions and 8 deletions
+13 -7
View File
@@ -177,22 +177,28 @@ function generateWorld(seedIn, w, h, onProgress) {
}
// ores
if (m === STONE || m === DIRT || m === GRANITE || m === BASALT || m === CLAY) {
// Leave the shallow quarter unchanged; deeper rock has broader, richer lenses.
const rich = Math.min(1, Math.max(0, (fy - 0.25) / 0.6));
const c = nCoal(x / 13, y / 9);
if (d > 6 && fy < 0.45 && c > 0.5 && m !== CLAY) m = COALV;
if ((d > 6 && fy < 0.45 && c > 0.5 - 0.55 * rich && m !== CLAY) ||
(m === BASALT && fy > 0.6 && c > 0.58 - 0.4 * rich)) m = COALV;
else {
const cu = nCu(x / 9, y / 8);
const cuBand = d > 14 && fy < 0.48;
if (cuBand && (m === STONE || m === DIRT) && cu > (d < 140 ? 0.5 : 0.56)) m = CUV;
if ((cuBand && (m === STONE || m === DIRT) && cu > (d < 140 ? 0.5 : 0.56) - 0.65 * rich) ||
(fy > 0.48 && fy < 0.8 && (m === STONE || m === GRANITE) && cu > 0.6 - 0.46 * rich)) m = CUV;
else {
// iron and zinc are harder than the stone around them, so they come in fewer, chunkier
// lenses rather than a scatter of specks that a stone bit would leave in the way
const fe = nFe(x / 24, y / 13);
if (fy > 0.28 && (m === STONE || m === GRANITE || m === BASALT) && fe > (m === STONE ? 0.55 : 0.47)) m = FEV;
if (fy > 0.28 && (m === STONE || m === GRANITE || m === BASALT) && fe > (m === STONE ? 0.55 : 0.47) - 0.55 * rich) m = FEV;
// rarer ores in deeper bands: tin, then zinc, silver in granite, gold deepest
else if (fy > 0.15 && fy < 0.55 && m === STONE && nSn(x / 8, y / 7) > 0.62) m = SNV;
else if (fy > 0.35 && fy < 0.78 && (m === STONE || m === GRANITE) && nZn(x / 22, y / 13) > 0.6) m = ZNV;
else if (fy > 0.5 && fy < 0.88 && m === GRANITE && nAg(x / 7, y / 6) > 0.66) m = AGV;
else if (fy > 0.68 && (m === GRANITE || m === BASALT) && nAu(x / 6, y / 5) > 0.7) m = AUV;
else if (((fy > 0.15 && fy < 0.55 && m === STONE) ||
(fy >= 0.55 && fy < 0.8 && (m === STONE || m === GRANITE))) &&
nSn(x / 8, y / 7) > 0.62 + Math.max(0, fy - 0.55) * 0.4 - 0.425 * rich) m = SNV;
else if (fy > 0.35 && fy < 0.78 && (m === STONE || m === GRANITE) && nZn(x / 22, y / 13) > 0.6 - 0.49 * rich) m = ZNV;
else if (fy > 0.5 && fy < 0.88 && m === GRANITE && nAg(x / 7, y / 6) > 0.66 - 0.32 * rich) m = AGV;
else if (fy > 0.68 && (m === GRANITE || m === BASALT) && nAu(x / 6, y / 5) > 0.7 - 0.18 * rich) m = AUV;
}
}
}