diff --git a/assets/mods/basegame/blocks/240.tga b/assets/mods/basegame/blocks/240.tga index d85411c48..cde10d8de 100644 --- a/assets/mods/basegame/blocks/240.tga +++ b/assets/mods/basegame/blocks/240.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9e6104b7548252f347b28297fe0b71363dd491cc709ec0e7e294d56d77fb35b7 -size 50220 +oid sha256:0dc7de77100401bd16db4add35a7746a9dd4007cdf7810a6fbaa527a4a1c644f +size 50194 diff --git a/assets/mods/basegame/blocks/241.tga b/assets/mods/basegame/blocks/241.tga index 5c0d7c28b..5b757c3e7 100644 --- a/assets/mods/basegame/blocks/241.tga +++ b/assets/mods/basegame/blocks/241.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e8a6e03f8002db0f509f6ded8aaae839832ef8d1c2f71894c7e5d6fb900f8239 -size 50220 +oid sha256:19f125ceadefb5cccc0e221ddbe3ad32fe405c707d4b23d5a3a20f882f11ba8a +size 50194 diff --git a/assets/mods/basegame/blocks/242.tga b/assets/mods/basegame/blocks/242.tga index bb4daa4fe..1b759ef5c 100644 --- a/assets/mods/basegame/blocks/242.tga +++ b/assets/mods/basegame/blocks/242.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:669a1c03758cd2a069e9b1225b2bd9cc27cd9a49bc83e98c7fe9739a2ac2be88 -size 50220 +oid sha256:5ff04a16c9e174f2c52783fb81c05320433dc135044c85b56bf23066498718b3 +size 50194 diff --git a/assets/mods/basegame/blocks/243.tga b/assets/mods/basegame/blocks/243.tga index 088f04674..0c38ed48f 100644 --- a/assets/mods/basegame/blocks/243.tga +++ b/assets/mods/basegame/blocks/243.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:d778dfbf79468bd298080ab43251bb867007e1ace8a5106e2b213dea59411e92 -size 50220 +oid sha256:5659cd410d7753ed964abe878786e6ed6231a8d6e9fe1527752eb263c851b89e +size 50194 diff --git a/assets/mods/basegame/blocks/244.tga b/assets/mods/basegame/blocks/244.tga index 1d9e71c5d..8d86e9c52 100644 --- a/assets/mods/basegame/blocks/244.tga +++ b/assets/mods/basegame/blocks/244.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:355c81465ca96dbb1da7e0b7690808123ad9fb881741f98f925eb91c5e6299b2 -size 50220 +oid sha256:9e590825f17a12c40fc14013880b5c6e628d9f07a97478fb0679ac3559d4f7c8 +size 50194 diff --git a/assets/mods/basegame/blocks/245.tga b/assets/mods/basegame/blocks/245.tga index e0df71e6b..3fa84e1fe 100644 --- a/assets/mods/basegame/blocks/245.tga +++ b/assets/mods/basegame/blocks/245.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:dbe43eb7cc20ea22fe7ffef8c00680ed0cedbeb20e46ee432193fc4da0f3046c -size 50220 +oid sha256:30bf1d07299b72ea81517fa663a1a90b1c4b8317d3ca81108c7d2645612ad426 +size 50194 diff --git a/src/net/torvald/terrarum/modulebasegame/worldgenerator/Biomegen.kt b/src/net/torvald/terrarum/modulebasegame/worldgenerator/Biomegen.kt index 20adab1bc..d7434e4f0 100644 --- a/src/net/torvald/terrarum/modulebasegame/worldgenerator/Biomegen.kt +++ b/src/net/torvald/terrarum/modulebasegame/worldgenerator/Biomegen.kt @@ -5,13 +5,9 @@ import com.sudoplay.joise.module.* import net.torvald.terrarum.App import net.torvald.terrarum.LoadScreenBase import net.torvald.terrarum.blockproperties.Block -import net.torvald.terrarum.concurrent.ThreadExecutor import net.torvald.terrarum.concurrent.sliceEvenly import net.torvald.terrarum.gameworld.GameWorld -import net.torvald.terrarum.gameworld.fmod -import net.torvald.terrarum.modulebasegame.TerrarumIngame import kotlin.math.cos -import kotlin.math.max import kotlin.math.sin /** @@ -73,7 +69,8 @@ class Biomegen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par } private fun draw(x: Int, y: Int, noiseValue: List, world: GameWorld) { - val control = noiseValue[0].coerceIn(0.0, 0.99999).times(slices).toInt().coerceIn(0 until slices) + val control1 = noiseValue[0].coerceIn(0.0, 0.99999).times(slices).toInt().coerceAtMost(slices - 1) + val control2 = noiseValue[1].coerceIn(0.0, 0.99999).times(9).toInt().coerceAtMost(9 - 1) if (y > 0) { val tileThis = world.getTileFromTerrain(x, y) @@ -81,41 +78,76 @@ class Biomegen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par val nearbyTerr = nearbyArr.map { world.getTileFromTerrain(x + it.first, y + it.second) } val nearbyWall = nearbyArr.map { world.getTileFromWall(x + it.first, y + it.second) } - when (control) { + val grassRock = when (control1) { 0 -> { // woodlands if (tileThis == Block.DIRT && nearbyTerr.any { it == Block.AIR } && nearbyWall.any { it == Block.AIR }) { - world.setTileTerrain(x, y, Block.GRASS, true) + Block.GRASS to null } + else null to null } 1 -> { // shrublands if (tileThis == Block.DIRT && nearbyTerr.any { it == Block.AIR } && nearbyWall.any { it == Block.AIR }) { - world.setTileTerrain(x, y, Block.GRASS, true) + Block.GRASS to null } + else null to null } 2, 3 -> { // plains if (tileThis == Block.DIRT && nearbyTerr.any { it == Block.AIR } && nearbyWall.any { it == Block.AIR }) { - world.setTileTerrain(x, y, Block.GRASS, true) + Block.GRASS to null } + else null to null } /*3 -> { // sands if (tileThis == Block.DIRT && (nearbyTerr[BT] == Block.STONE || nearbyTerr[BT] == Block.AIR)) { - world.setTileTerrain(x, y, Block.SANDSTONE) + world.setTileTerrain(x, y, Block.SANDSTONE, true) } else if (tileThis == Block.DIRT) { - world.setTileTerrain(x, y, Block.SAND) + world.setTileTerrain(x, y, Block.SAND, true) } }*/ 4 -> { // rockylands if (tileThis == Block.DIRT || tileThis == Block.STONE_QUARRIED) { - world.setTileTerrain(x, y, Block.STONE, true) - world.setTileWall(x, y, Block.STONE, true) + Block.STONE to Block.STONE } + else null to null } + else -> null to null } + val sandNull = when (control2) { + 8 -> { + if (tileThis == Block.DIRT && (nearbyTerr[BT] == Block.AIR)) { + Block.SANDSTONE to null + } + else if (tileThis == Block.DIRT) { + Block.SAND to null + } + else null to null + } + else -> null to null + } + + val outTile = if (grassRock.first == Block.STONE) + grassRock + else if (sandNull.first != null) + sandNull + else grassRock + + + if (outTile.first != null) + world.setTileTerrain(x, y, outTile.first!!, true) + if (outTile.second != null) + world.setTileWall(x, y, outTile.second!!, true) } } private fun getGenerator(seed: Long, params: BiomegenParams): List { + return listOf( + makeRandomSpotties("TERRA", params.featureSize1), + makeRandomSpotties("SABLUM", params.featureSize2), + ) + } + + private fun makeRandomSpotties(shakeValue: String, featureSize: Double): Joise { //val biome = ModuleBasisFunction() //biome.setType(ModuleBasisFunction.BasisType.SIMPLEX) @@ -125,14 +157,14 @@ class Biomegen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par it.setAllSourceBasisTypes(ModuleBasisFunction.BasisType.SIMPLEX) it.setNumOctaves(4) it.setFrequency(1.0) - it.seed = seed shake 0x7E22A + it.seed = seed shake shakeValue } val scaleDomain = ModuleScaleDomain().also { it.setSource(fractal) - it.setScaleX(1.0 / params.featureSize) // adjust this value to change features size - it.setScaleY(1.0 / params.featureSize) - it.setScaleZ(1.0 / params.featureSize) + it.setScaleX(1.0 / featureSize) // adjust this value to change features size + it.setScaleY(1.0 / featureSize) + it.setScaleZ(1.0 / featureSize) } val scale = ModuleScaleOffset().also { @@ -142,12 +174,12 @@ class Biomegen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par } val last = scale - - return listOf(Joise(last)) + return Joise(last) } } data class BiomegenParams( - val featureSize: Double = 80.0 + val featureSize1: Double = 80.0, + val featureSize2: Double = 120.0 ) \ No newline at end of file diff --git a/src/net/torvald/terrarum/modulebasegame/worldgenerator/Oregen.kt b/src/net/torvald/terrarum/modulebasegame/worldgenerator/Oregen.kt index b634bd1b6..3a23bc635 100644 --- a/src/net/torvald/terrarum/modulebasegame/worldgenerator/Oregen.kt +++ b/src/net/torvald/terrarum/modulebasegame/worldgenerator/Oregen.kt @@ -43,7 +43,7 @@ class Oregen(world: GameWorld, private val caveAttenuateBiasScaled: ModuleScaleD */ private fun getGenerator(seed: Long): List { return ores.map { - Joise(generateOreVeinModule(caveAttenuateBiasScaled, seed shake it.tile, it.freq, it.power, it.scale, it.ratio)) + generateOreVeinModule(caveAttenuateBiasScaled, seed shake it.tile, it.freq, it.power, it.scale, it.ratio) } } @@ -83,7 +83,7 @@ class Oregen(world: GameWorld, private val caveAttenuateBiasScaled: ModuleScaleD } } - private fun generateOreVeinModule(caveAttenuateBiasScaled: ModuleScaleDomain, seed: Long, freq: Double, pow: Double, scale: Double, ratio: Double): Module { + private fun generateOreVeinModule(caveAttenuateBiasScaled: ModuleScaleDomain, seed: Long, freq: Double, pow: Double, scale: Double, ratio: Double): Joise { val oreShape = ModuleFractal().also { it.setType(ModuleFractal.FractalType.RIDGEMULTI) it.setAllSourceBasisTypes(ModuleBasisFunction.BasisType.GRADIENT) @@ -147,7 +147,7 @@ class Oregen(world: GameWorld, private val caveAttenuateBiasScaled: ModuleScaleD it.setFalloff(0.0) } - return oreSelect + return Joise(oreSelect) } } diff --git a/src/net/torvald/terrarum/tests/WorldgenNoiseSandbox.kt b/src/net/torvald/terrarum/tests/WorldgenNoiseSandbox.kt index ac5a68325..078e47c75 100644 --- a/src/net/torvald/terrarum/tests/WorldgenNoiseSandbox.kt +++ b/src/net/torvald/terrarum/tests/WorldgenNoiseSandbox.kt @@ -298,9 +298,9 @@ internal object BiomeMaker : NoiseMaker { val scaleDomain = ModuleScaleDomain().also { it.setSource(fractal) - it.setScaleX(1.0 / params.featureSize) // adjust this value to change features size - it.setScaleY(1.0 / params.featureSize) - it.setScaleZ(1.0 / params.featureSize) + it.setScaleX(1.0 / params.featureSize1) // adjust this value to change features size + it.setScaleY(1.0 / params.featureSize1) + it.setScaleZ(1.0 / params.featureSize1) } val scale = ModuleScaleOffset().also {