readjusted oregen params to preserve relative depth-to-spawn-rate scale

This commit is contained in:
minjaesong
2024-09-01 04:47:20 +09:00
parent cdfb5c4daa
commit aef5fd307a
4 changed files with 31 additions and 32 deletions

View File

@@ -72,12 +72,11 @@ class Cavegen(world: GameWorld, isFinal: Boolean, val highlandLowlandSelectCache
it.setBias(params.caveAttenuateBias) // (0.5+) adjust the "concentration" of the cave gen. Lower = larger voids
})}
val caveAttenuateBias = caveAttenuateBias0.let {
ModuleScaleOffset().also {
val caveAttenuateBias = ModuleScaleOffset().also {
it.setSource(caveAttenuateBias0)
it.setScale(params.caveAttenuateScale)
}
}
val caveShapeAttenuate = ModuleCombiner().also {
it.setType(ModuleCombiner.CombinerType.MULT)

View File

@@ -250,6 +250,7 @@ interface TerragenParams {
val caveShapeFreq: Double //adjust the "density" of the caves
val caveAttenuateScale: Double // used with the caveAttenuateBias, controls the "concentration" of the cave gen
val caveAttenuateBias: Double // 1.0: flattens the gradient (deep voids are less tend to be larger). Also controls the distribution of ores. Equation: x^(log(bias) / log(0.5))
val caveAttenuateScale1: Double // used with the caveAttenuateBias, controls the "concentration" of the cave gen
val caveAttenuateBias1: Double // 1.0: flattens the gradient (deep voids are less tend to be larger). Also controls the distribution of ores. Equation: x^(log(bias) / log(0.5))
val caveSelectThre: Double // also adjust this if you've touched the bias value. Number can be greater than 1.0
val caveBlockageFractalFreq: Double
@@ -269,6 +270,7 @@ data class TerragenParamsAlpha1(
override val caveShapeFreq: Double = 4.0, //adjust the "density" of the caves
override val caveAttenuateScale: Double = 1.0, // used with the caveAttenuateBias, controls the "concentration" of the cave gen
override val caveAttenuateBias: Double = 0.90, // 1.0: flattens the gradient (deep voids are less tend to be larger). Also controls the distribution of ores. Equation: x^(log(bias) / log(0.5))
override val caveAttenuateScale1: Double = 1.0, // used with the caveAttenuateBias, controls the "concentration" of the cave gen
override val caveAttenuateBias1: Double = 0.90, // 1.0: flattens the gradient (deep voids are less tend to be larger). Also controls the distribution of ores. Equation: x^(log(bias) / log(0.5))
override val caveSelectThre: Double = 0.918, // also adjust this if you've touched the bias value. Number can be greater than 1.0
override val caveBlockageFractalFreq: Double = 8.88,
@@ -291,6 +293,7 @@ data class TerragenParamsAlpha2(
override val caveShapeFreq: Double = 4.0, //adjust the "density" of the caves
override val caveAttenuateScale: Double = 0.94, // used with the caveAttenuateBias, controls the "concentration" of the cave gen
override val caveAttenuateBias: Double = 0.95, // 1.0: flattens the gradient (deep voids are less tend to be larger). Also controls the distribution of ores. Equation: x^(log(bias) / log(0.5))
override val caveAttenuateScale1: Double = 0.90, // used with the caveAttenuateBias, controls the "concentration" of the cave gen
override val caveAttenuateBias1: Double = 0.90, // 1.0: flattens the gradient (deep voids are less tend to be larger). Also controls the distribution of ores. Equation: x^(log(bias) / log(0.5))
override val caveSelectThre: Double = 0.915, // also adjust this if you've touched the bias value. Number can be greater than 1.0
override val caveBlockageFractalFreq: Double = 8.88,

View File

@@ -431,11 +431,9 @@ object Worldgen {
it.setBias(params.caveAttenuateBias1) // (0.5+) adjust the "concentration" of the cave gen. Lower = larger voids
})}
val caveAttenuateBiasForOres = caveAttenuateBias1.let {
ModuleScaleOffset().also {
val caveAttenuateBiasForOres = ModuleScaleOffset().also {
it.setSource(caveAttenuateBias1)
it.setScale(params.caveAttenuateScale)
}
it.setScale(params.caveAttenuateScale1)
}
val scale = ModuleScaleDomain().also {

View File

@@ -83,7 +83,7 @@ class WorldgenNoiseSandbox : ApplicationAdapter() {
private var generationTime = 0f
private var today = ""
private val NM_TERR = TerragenTest to TerragenParamsAlpha2()
private val NM_TERR = TerragenTest(TerragenParamsAlpha2())
private val NM_BIOME = BiomeMaker to BiomegenParams()
private val NOISEMAKER = NM_TERR
@@ -120,9 +120,11 @@ class WorldgenNoiseSandbox : ApplicationAdapter() {
font.draw(batch, "Seed: $seed", 8f, 8f + 1*20)
font.draw(batch, "caveAttenuateScale=${NM_TERR.second.caveAttenuateScale}", 8f, 8f + 2*20)
font.draw(batch, "caveAttenuateBias=${NM_TERR.second.caveAttenuateBias}", 8f, 8f + 3*20)
font.draw(batch, "caveSelectThre=${NM_TERR.second.caveSelectThre}", 8f, 8f + 4*20)
font.draw(batch, "caveAttenuateScale=${NM_TERR.params.caveAttenuateScale}", 8f, 8f + 2*20)
font.draw(batch, "caveAttenuateScale1=${NM_TERR.params.caveAttenuateScale1}", 8f, 8f + 3*20)
font.draw(batch, "caveAttenuateBias=${NM_TERR.params.caveAttenuateBias}", 8f, 8f + 4*20)
font.draw(batch, "caveAttenuateBias1=${NM_TERR.params.caveAttenuateBias1}", 8f, 8f +5*20)
font.draw(batch, "caveSelectThre=${NM_TERR.params.caveSelectThre}", 8f, 8f + 6*20)
}
}
@@ -189,7 +191,7 @@ class WorldgenNoiseSandbox : ApplicationAdapter() {
private fun getSY(y: Int): Double = y - (getClampedHeight() - YHEIGHT_MAGIC) * YHEIGHT_DIVISOR // Q&D offsetting to make ratio of sky:ground to be constant
private fun renderNoise(noiseMaker: Pair<NoiseMaker, Any>, callback: () -> Unit = {}) {
private fun renderNoise(noiseMaker: NoiseMaker, callback: () -> Unit = {}) {
generationStartTime = System.nanoTime()
// erase first
@@ -204,7 +206,7 @@ class WorldgenNoiseSandbox : ApplicationAdapter() {
Thread {
val runnables: List<RunnableFun> = (0 until testTex.width).sliceEvenly(genSlices).map { range ->
{
val localJoise = noiseMaker.first.getGenerator(seed, noiseMaker.second)
val localJoise = noiseMaker.getGenerator(seed, 0)
for (x in range) {
for (y in 0 until NOISEBOX_HEIGHT) {
val sampleTheta = (x.toDouble() / NOISEBOX_WIDTH) * TWO_PI
@@ -212,9 +214,9 @@ class WorldgenNoiseSandbox : ApplicationAdapter() {
sin(sampleTheta) * sampleOffset + sampleOffset // plus sampleOffset to make only
val sampleZ =
cos(sampleTheta) * sampleOffset + sampleOffset // positive points are to be sampled
val sampleY = getSY(y)
val sampleY = getSY(y) //+ 10000
noiseMaker.first.draw(x, y, localJoise.mapIndexed { index, it ->
noiseMaker.draw(x, y, localJoise.mapIndexed { index, it ->
it.get(sampleX, sampleY, sampleZ)
}, testTex)
}
@@ -335,7 +337,7 @@ internal object BiomeMaker : NoiseMaker {
}
// http://accidentalnoise.sourceforge.net/minecraftworlds.html
internal object TerragenTest : NoiseMaker {
internal class TerragenTest(val params: TerragenParams) : NoiseMaker {
private infix fun Color.mul(other: Color) = this.mul(other)
@@ -387,7 +389,7 @@ internal object TerragenTest : NoiseMaker {
)
private val terragenYscaling = (NOISEBOX_HEIGHT / 2400.0).pow(0.75)
private val terragenTiers = listOf(.0, .5, 1.5, 4.0).map { it * terragenYscaling } // pow 1.0 for 1-to-1 scaling; 0.75 is used to make deep-rock layers actually deep for huge world size
private val terragenTiers = (params.terragenTiers).map { it * terragenYscaling } // pow 1.0 for 1-to-1 scaling; 0.75 is used to make deep-rock layers actually deep for huge world size
override fun draw(x: Int, y: Int, noiseValue: List<Double>, outTex: Pixmap) {
val terr = noiseValue[0].tiered(terragenTiers)
@@ -432,8 +434,7 @@ internal object TerragenTest : NoiseMaker {
}
override fun getGenerator(seed: Long, params: Any): List<Joise> {
val params = params as TerragenParams
override fun getGenerator(seed: Long, wtf: Any): List<Joise> {
val lowlandMagic: Long = 0x41A21A114DBE56 // Maria Lindberg
val highlandMagic: Long = 0x0114E091 // Olive Oyl
val mountainMagic: Long = 0x115AA4DE2504 // Lisa Anderson
@@ -611,19 +612,17 @@ internal object TerragenTest : NoiseMaker {
it.setBias(params.caveAttenuateBias1) // (0.5+) adjust the "concentration" of the cave gen. Lower = larger voids
})}
val caveAttenuateBiasForTerr = caveAttenuateBias0.let {
ModuleScaleOffset().also {
val caveAttenuateBiasForTerr = ModuleScaleOffset().also {
it.setSource(caveAttenuateBias0)
it.setScale(params.caveAttenuateScale)
}
val caveAttenuateBiasForOres = ModuleScaleOffset().also {
it.setSource(caveAttenuateBias1)
it.setScale(params.caveAttenuateScale1)
}
val caveAttenuateBiasForOres = caveAttenuateBias0.let {
ModuleScaleOffset().also {
it.setSource(caveAttenuateBias1)
it.setScale(params.caveAttenuateScale)
}
}
val caveShapeAttenuate = ModuleCombiner().also {
it.setType(ModuleCombiner.CombinerType.MULT)