This commit is contained in:
33333-33333 2026-05-28 16:45:00 +09:00
commit c523bf4380
8 changed files with 76 additions and 26 deletions

View file

@ -168,13 +168,13 @@ const TERRAIN_TYPES = [
mountainOffsetRange: [0.47, 0.53],
baseHeightRange: [0.56, 0.82],
primaryLengthRange: [0.76, 0.96],
primaryWidthRange: [0.13, 0.22],
systemCountRange: [12, 16],
beltCountRange: [3, 4],
angleSpread: 0.14,
crossSpread: 0.38,
primaryWidthRange: [0.18, 0.30],
systemCountRange: [14, 18],
beltCountRange: [4, 5],
angleSpread: 0.18,
crossSpread: 0.58,
lengthScale: 1.22,
widthScale: 0.92,
widthScale: 1.16,
heightScale: 0.86,
coastStrength: 0.90,
plainBiasRange: [0.16, 0.34],
@ -283,7 +283,12 @@ const TERRAIN_TYPES = [
},
];
function pickTerrainType(seed) {
function pickTerrainType(seed, requestedType = "auto") {
if (requestedType && requestedType !== "auto") {
const normalizedType = requestedType === "touhoku_spine" ? "tohoku_spine" : requestedType;
const selected = TERRAIN_TYPES.find((type) => type.id === normalizedType);
if (selected) return selected;
}
// Terrain type selection is intentionally uniform. Individual terrain
// templates still contain their own parameter ranges, but there is no
// terrain-type appearance weighting.
@ -299,8 +304,8 @@ function rangeInt(seed, salt, [lo, hi]) {
return Math.round(lo + rand(seed, salt) * (hi - lo));
}
export function buildTerrainTemplate(seed) {
const terrainType = pickTerrainType(seed);
export function buildTerrainTemplate(seed, options = {}) {
const terrainType = pickTerrainType(seed, options.terrainType || options.generationType || "auto");
const mountainMode = terrainType.mountainMode === "mixed"
? (rand(seed, 12) < 0.42 ? "range" : rand(seed, 13) < 0.72 ? "mixed" : "massif")
: terrainType.mountainMode;
@ -1132,7 +1137,7 @@ function enforceLandGradient(elevation, sea, seaLevel) {
}
}
export function generateTerrainAndRivers(seed) {
export function generateTerrainAndRivers(seed, options = {}) {
const fields = createMapFields();
fields.visibleRavineField = new Float32Array(SIZE);
fields.surfaceTextureField = new Float32Array(SIZE);
@ -1145,7 +1150,7 @@ export function generateTerrainAndRivers(seed) {
passSuitability,
} = fields;
const terrainTemplate = buildTerrainTemplate(seed);
const terrainTemplate = buildTerrainTemplate(seed, options);
const systems = buildMountainSystems(terrainTemplate, seed);
const allRidges = systems.flatMap((system, id) => buildScratchRidges(system, seed, id));