diff --git a/assets/mods/basegame/blocks/17.tga b/assets/mods/basegame/blocks/17.tga index 19f044082..d9f0a58dd 100644 --- a/assets/mods/basegame/blocks/17.tga +++ b/assets/mods/basegame/blocks/17.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7eab05a2b3d98f1ecec41dc6ca506696506c81ced888b6b4495d703d061e473a +oid sha256:4f1df3199a8699a8359b14446842a1dc06be2fbc847917ab4b5021769057a21f size 50194 diff --git a/assets/mods/basegame/blocks/20.tga b/assets/mods/basegame/blocks/20.tga new file mode 100644 index 000000000..fa0e2c8ed --- /dev/null +++ b/assets/mods/basegame/blocks/20.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:5d8755903e5c3519ea0eb281d3634f7fa207b6d71d85c82e93dfcf6451e4977a +size 50194 diff --git a/assets/mods/basegame/blocks/21.tga b/assets/mods/basegame/blocks/21.tga new file mode 100644 index 000000000..470a02339 --- /dev/null +++ b/assets/mods/basegame/blocks/21.tga @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:26b52442f0c16f654508a6039e47803a1b043cc19527dd402899dc2dd192016c +size 50194 diff --git a/assets/mods/basegame/blocks/blocks.csv b/assets/mods/basegame/blocks/blocks.csv index bb1de1918..59e97df6a 100644 --- a/assets/mods/basegame/blocks/blocks.csv +++ b/assets/mods/basegame/blocks/blocks.csv @@ -4,6 +4,8 @@ "17";"17";"BLOCK_STONE_QUARRIED";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"0";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A" "18";"18";"BLOCK_STONE_TILE_WHITE";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"0";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A" "19";"19";"BLOCK_STONE_BRICKS";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"0";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A" +"20";"20";"BLOCK_STONE_DEEP";"0.1252";"0.1252";"0.1252";"0.1252";"80";"24600";"ROCK";"1";"0";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A" +"21";"21";"BLOCK_STONE_MARBLE";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"0";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A" "32";"32";"BLOCK_DIRT";"0.1252";"0.1252";"0.1252";"0.1252";"24";"1400";"DIRT";"1";"0";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A" "33";"32";"BLOCK_GRASS";"0.1252";"0.1252";"0.1252";"0.1252";"24";"1400";"GRSS";"1";"0";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A" "34";"34";"BLOCK_GRASSWALL";"0.1252";"0.1252";"0.1252";"0.1252";"24";"1400";"GRSS";"1";"0";"1";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A" diff --git a/src/net/torvald/terrarum/blockproperties/Block.kt b/src/net/torvald/terrarum/blockproperties/Block.kt index 72d90b192..5aa63c693 100644 --- a/src/net/torvald/terrarum/blockproperties/Block.kt +++ b/src/net/torvald/terrarum/blockproperties/Block.kt @@ -11,6 +11,8 @@ object Block { const val STONE_QUARRIED = "basegame:17" const val STONE_TILE_WHITE = "basegame:18" const val STONE_BRICKS = "basegame:19" + const val STONE_SLATE = "basegame:20" + const val STONE_MARBLE = "basegame:21" const val DIRT = "basegame:32" const val GRASS = "basegame:33" diff --git a/src/net/torvald/terrarum/modulebasegame/worldgenerator/Biomegen.kt b/src/net/torvald/terrarum/modulebasegame/worldgenerator/Biomegen.kt index 43ce0d24f..490531dbe 100644 --- a/src/net/torvald/terrarum/modulebasegame/worldgenerator/Biomegen.kt +++ b/src/net/torvald/terrarum/modulebasegame/worldgenerator/Biomegen.kt @@ -55,14 +55,14 @@ class Biomegen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par companion object { private const val slices = 5 private val nearbyArr = arrayOf( - (-1 to -1), // tileTL - (+1 to -1), // tileTR - (-1 to +1), // tileBL - (+1 to +1), // tileBR - (0 to -1), // tileT - (0 to +1), // tileB - (-1 to 0), // tileL - (+1 to 0) // tileR + (-1 to -1), // tileTL + (+1 to -1), // tileTR + (-1 to +1), // tileBL + (+1 to +1), // tileBR + (0 to -1), // tileT + (0 to +1), // tileB + (-1 to 0), // tileL + (+1 to 0) // tileR ) private const val TL = 0 private const val TR = 1 @@ -108,7 +108,7 @@ class Biomegen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par } }*/ 4 -> { // rockylands - if (tileThis == Block.DIRT) { + if (tileThis == Block.DIRT || tileThis == Block.STONE_QUARRIED) { world.setTileTerrain(x, y, Block.STONE, true) world.setTileWall(x, y, Block.STONE, true) } diff --git a/src/net/torvald/terrarum/modulebasegame/worldgenerator/Terragen.kt b/src/net/torvald/terrarum/modulebasegame/worldgenerator/Terragen.kt index 2e21cfaa1..f857fa2b4 100644 --- a/src/net/torvald/terrarum/modulebasegame/worldgenerator/Terragen.kt +++ b/src/net/torvald/terrarum/modulebasegame/worldgenerator/Terragen.kt @@ -25,6 +25,7 @@ class Terragen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par private val YHEIGHT_DIVISOR = 2.0 / 7.0 private val dirtStoneDitherSize = 3 // actual dither size will be double of this value + private val stoneSlateDitherSize = 4 override fun getDone() { ThreadExecutor.renew() @@ -46,7 +47,7 @@ class Terragen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par private val groundDepthBlock = listOf( - Block.AIR, Block.DIRT, Block.STONE + Block.AIR, Block.DIRT, Block.STONE, Block.STONE_SLATE ) private fun Double.tiered(vararg tiers: Double): Int { @@ -59,6 +60,7 @@ class Terragen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par //private fun draw(x: Int, y: Int, width: Int, height: Int, noiseValue: List, world: GameWorld) { private fun draw(x: Int, noises: List, st: Double, soff: Double) { var dirtStoneTransition = 0 + var stoneSlateTransition = 0 for (y in 0 until world.height) { val sx = sin(st) * soff + soff // plus sampleOffset to make only @@ -67,13 +69,14 @@ class Terragen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par // DEBUG NOTE: it is the OFFSET FROM THE IDEAL VALUE (observed land height - (HEIGHT * DIVISOR)) that must be constant val noiseValue = noises.map { it.get(sx, sy, sz) } - val terr = noiseValue[0].tiered(.0, .5, .88) + val terr = noiseValue[0].tiered(.0, .5, .88, 1.88) val cave = if (noiseValue[1] < 0.5) 0 else 1 // mark off the position where the transition occurred - if (dirtStoneTransition == 0 && terr == 2) { + if (dirtStoneTransition == 0 && terr == 2) dirtStoneTransition = y - } + if (stoneSlateTransition == 0 && terr == 3) + stoneSlateTransition = y val wallBlock = groundDepthBlock[terr] val terrBlock = if (cave == 0) Block.AIR else wallBlock @@ -90,20 +93,41 @@ class Terragen(world: GameWorld, seed: Long, params: Any) : Gen(world, seed, par % % - cobble-to-rock transition, height = dirtStoneDitherSize % + * - where the stone layer actually begins */ for (pos in 0 until dirtStoneDitherSize * 2) { - val y = dirtStoneTransition - dirtStoneDitherSize + pos - + val y = pos + dirtStoneTransition - (dirtStoneDitherSize * 2) + 1 + if (y >= world.height) break val hash = XXHash32.hashGeoCoord(x, y).and(0x7FFFFFFF) / 2147483647.0 + val fore = world.getTileFromTerrain(x, y) + val back = world.getTileFromWall(x, y) val newTile = if (pos < dirtStoneDitherSize) if (hash < pos.toDouble() / dirtStoneDitherSize) Block.STONE_QUARRIED else Block.DIRT - else + else // don't +1 to pos.toDouble(); I've suffered if (hash >= (pos.toDouble() - dirtStoneDitherSize) / dirtStoneDitherSize) Block.STONE_QUARRIED else Block.STONE - if (world.getTileFromTerrain(x, y) != Block.AIR) { + if (fore != Block.AIR) world.setTileTerrain(x, y, newTile, true) - } - // wall is dithered no mater what; do not put if-statement here + + world.setTileWall(x, y, newTile, true) + } + + /* + # + # - stone-to-slate transition, height = stoneSlateDitherSize + # + */ + for (pos in 0 until stoneSlateDitherSize) { + val y = pos + stoneSlateTransition - stoneSlateDitherSize + 1 + if (y >= world.height) break + val hash = XXHash32.hashGeoCoord(x, y).and(0x7FFFFFFF) / 2147483647.0 + val fore = world.getTileFromTerrain(x, y) + val back = world.getTileFromWall(x, y) + val newTile = if (hash < pos.toDouble() / stoneSlateDitherSize) Block.STONE_SLATE else Block.STONE + + if (fore != Block.AIR) + world.setTileTerrain(x, y, newTile, true) + world.setTileWall(x, y, newTile, true) } } diff --git a/src/net/torvald/terrarum/worlddrawer/LightmapRendererNew.kt b/src/net/torvald/terrarum/worlddrawer/LightmapRendererNew.kt index 4ed4a5625..b94df502c 100644 --- a/src/net/torvald/terrarum/worlddrawer/LightmapRendererNew.kt +++ b/src/net/torvald/terrarum/worlddrawer/LightmapRendererNew.kt @@ -364,6 +364,7 @@ object LightmapRenderer { // - If you naively slice the screen (job area) to multithread, the seam will appear. r1();r2();r3();r4() + r1();r2();r3();r4() // two looks better than one } } diff --git a/work_files/graphics/terrain/cobble.kra b/work_files/graphics/terrain/cobble.kra index dbe1c2a3f..6f6125dde 100644 --- a/work_files/graphics/terrain/cobble.kra +++ b/work_files/graphics/terrain/cobble.kra @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1753cb64b0613f6651345f5f0a46cde745d15c0687fe2bdb915ce093e2e6ecac -size 76497 +oid sha256:5597ea46ffab345c8b6aee5a3de2e397eeb98946937cdc22eefa9198b70a99de +size 73663