From 4bd7371f84418f3ce67c2abff2a60264124ba7f6 Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Wed, 18 Jan 2023 03:58:48 +0100 Subject: [PATCH] getting somewhere --- Cargo.toml | 3 +++ src/game/world/thread/world_gen.rs | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4650fbf..4c5e90c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,6 +3,9 @@ name = "kubi" version = "0.1.0" edition = "2021" +[profile.dev.package.noise] +opt-level = 3 + [dependencies] glium = "0.32" image = { version = "0.24", default_features = false, features = ["png"] } diff --git a/src/game/world/thread/world_gen.rs b/src/game/world/thread/world_gen.rs index e32d129..34b979b 100644 --- a/src/game/world/thread/world_gen.rs +++ b/src/game/world/thread/world_gen.rs @@ -9,7 +9,8 @@ const HEIGHTMAP_SCALE: f64 = 0.004; const MOUNTAINESS_SCALE: f64 = 0.0001; const MNT_RAMP_1: f64 = 0.5; const MNT_RAMP_2: f64 = 0.6; -const TERRAIN_HEIGHT_MIN: f64 = 64.; +const MTN_VAL_SCALE: f64 = 1.233; +const TERRAIN_HEIGHT_MIN: f64 = 60.; const TERRAIN_HEIGHT_MAX: f64 = 80.; pub fn generate_chunk(position: IVec2, seed: u32) -> ChunkData { @@ -29,19 +30,19 @@ pub fn generate_chunk(position: IVec2, seed: u32) -> ChunkData { let point = world_xz.as_dvec2() + DVec2::from_array([x as f64, z as f64]); let heightmap = (terrain_base_fbm.get((point * HEIGHTMAP_SCALE).to_array()) + 1.) / 2.; - let mountainess = (mountainess_base_fbm.get((point * MOUNTAINESS_SCALE).to_array()) + 1.) / 2.; + let mountainess = MTN_VAL_SCALE * ((mountainess_base_fbm.get((point * MOUNTAINESS_SCALE).to_array()) + 1.) / 2.); //generate basic terrain let terain_height = ( TERRAIN_HEIGHT_MIN + - (heightmap * TERRAIN_HEIGHT_MAX * (1. + if mountainess < MNT_RAMP_1 { + (heightmap * TERRAIN_HEIGHT_MAX * (0.1 + 1.5 * if mountainess < MNT_RAMP_1 { 0. } else { if mountainess > MNT_RAMP_2 { 1. } else { - mountainess - MNT_RAMP_1 + (mountainess - MNT_RAMP_1) / (MNT_RAMP_2 - MNT_RAMP_1) * 1. } })) ).floor() as usize;