fix: lowland and mountain clamping on Terragen, which was an issue persisting like 5 yrs

This commit is contained in:
minjaesong
2023-05-16 00:43:15 +09:00
parent 3911f86446
commit 28c45b5756
2 changed files with 8 additions and 21 deletions

1
.gitignore vendored
View File

@@ -2,6 +2,7 @@
out/* out/*
bin/* bin/*
build/* build/*
assets_release/*
.gradle/* .gradle/*
TerrarumBuild.jar TerrarumBuild.jar
buildapp/out/Terrarum* buildapp/out/Terrarum*

View File

@@ -157,13 +157,9 @@ class Terragen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par
lowlandShapeFractal.setFrequency(0.25) lowlandShapeFractal.setFrequency(0.25)
lowlandShapeFractal.seed = seed shake lowlandMagic lowlandShapeFractal.seed = seed shake lowlandMagic
val lowlandAutoCorrect = ModuleAutoCorrect()
lowlandAutoCorrect.setSource(lowlandShapeFractal)
lowlandAutoCorrect.setLow(0.0)
lowlandAutoCorrect.setHigh(1.0)
val lowlandScale = ModuleScaleOffset() val lowlandScale = ModuleScaleOffset()
lowlandScale.setScale(0.125) lowlandScale.setSource(lowlandShapeFractal)
lowlandScale.setScale(0.22)
lowlandScale.setOffset(params.lowlandScaleOffset) // TODO linearly alters the height lowlandScale.setOffset(params.lowlandScaleOffset) // TODO linearly alters the height
val lowlandYScale = ModuleScaleDomain() val lowlandYScale = ModuleScaleDomain()
@@ -184,14 +180,9 @@ class Terragen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par
highlandShapeFractal.setFrequency(2.0) highlandShapeFractal.setFrequency(2.0)
highlandShapeFractal.seed = seed shake highlandMagic highlandShapeFractal.seed = seed shake highlandMagic
val highlandAutocorrect = ModuleAutoCorrect()
highlandAutocorrect.setSource(highlandShapeFractal)
highlandAutocorrect.setLow(-1.0)
highlandAutocorrect.setHigh(1.0)
val highlandScale = ModuleScaleOffset() val highlandScale = ModuleScaleOffset()
highlandScale.setSource(highlandAutocorrect) highlandScale.setSource(highlandShapeFractal)
highlandScale.setScale(0.25) highlandScale.setScale(0.5)
highlandScale.setOffset(params.highlandScaleOffset) // TODO linearly alters the height highlandScale.setOffset(params.highlandScaleOffset) // TODO linearly alters the height
val highlandYScale = ModuleScaleDomain() val highlandYScale = ModuleScaleDomain()
@@ -211,14 +202,9 @@ class Terragen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par
mountainShapeFractal.setFrequency(1.0) mountainShapeFractal.setFrequency(1.0)
mountainShapeFractal.seed = seed shake mountainMagic mountainShapeFractal.seed = seed shake mountainMagic
val mountainAutocorrect = ModuleAutoCorrect()
mountainAutocorrect.setSource(mountainShapeFractal)
mountainAutocorrect.setLow(-1.0)
mountainAutocorrect.setHigh(1.0)
val mountainScale = ModuleScaleOffset() val mountainScale = ModuleScaleOffset()
mountainScale.setSource(mountainAutocorrect) mountainScale.setSource(mountainShapeFractal)
mountainScale.setScale(0.45) mountainScale.setScale(1.0)
mountainScale.setOffset(params.mountainScaleOffset) // TODO linearly alters the height mountainScale.setOffset(params.mountainScaleOffset) // TODO linearly alters the height
val mountainYScale = ModuleScaleDomain() val mountainYScale = ModuleScaleDomain()
@@ -239,7 +225,7 @@ class Terragen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par
terrainTypeFractal.setFrequency(0.125) terrainTypeFractal.setFrequency(0.125)
terrainTypeFractal.seed = seed shake selectionMagic terrainTypeFractal.seed = seed shake selectionMagic
val terrainAutocorrect = ModuleAutoCorrect() val terrainAutocorrect = ModuleAutoCorrect() // absolutely required
terrainAutocorrect.setSource(terrainTypeFractal) terrainAutocorrect.setSource(terrainTypeFractal)
terrainAutocorrect.setLow(0.0) terrainAutocorrect.setLow(0.0)
terrainAutocorrect.setHigh(1.0) terrainAutocorrect.setHigh(1.0)