mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
slate layer; new stone 'marble'
This commit is contained in:
Binary file not shown.
BIN
assets/mods/basegame/blocks/20.tga
LFS
Normal file
BIN
assets/mods/basegame/blocks/20.tga
LFS
Normal file
Binary file not shown.
BIN
assets/mods/basegame/blocks/21.tga
LFS
Normal file
BIN
assets/mods/basegame/blocks/21.tga
LFS
Normal file
Binary file not shown.
@@ -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"
|
||||
|
||||
|
@@ -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"
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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<Double>, world: GameWorld) {
|
||||
private fun draw(x: Int, noises: List<Joise>, 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)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user