Minor fix to map generation.

Also fixes some typos and makes formatting easier for changes needed to
produce large maps.
This commit is contained in:
Joshua Yanovski 2020-01-22 10:41:10 +01:00
parent ba043b91a2
commit 55a96bce09
4 changed files with 13 additions and 8 deletions

View File

@ -96,7 +96,7 @@ impl ServerSettings {
pub fn singleplayer() -> Self {
let mut load = Self::load();
if let None = load.map_file {
// If lodaing the default map file, make sure the seed is also default.
// If loading the default map file, make sure the seed is also default.
load.world_seed = DEFAULT_WORLD_SEED;
};
Self {

View File

@ -107,8 +107,8 @@ fn main() {
.checked_mul(scale as usize)
.and_then(|acc| acc.checked_mul(scale as usize))
{
let x = W * scale as usize;
let y = H * scale as usize;
let x = (W as f64 * scale) as usize;
let y = (H as f64 * scale) as usize;
let config = sim::MapConfig {
dimensions: Vec2::new(x, y),
scale: 1.0,

View File

@ -229,7 +229,7 @@ pub fn get_rivers<F: fmt::Debug + Float + Into<f64>, G: Float + Into<f64>>(
let mut rivers = vec![RiverData::default(); WORLD_SIZE.x * WORLD_SIZE.y].into_boxed_slice();
let neighbor_coef = TerrainChunkSize::RECT_SIZE.map(|e| e as f64);
// (Roughly) area of a chunk, times minutes per second.
let mins_per_sec = /*16.0*/1.0/*1.0 / 16.0*//*1.0 / 64.0*/;
let mins_per_sec = /*16.0*/1.0/*1.0 / 16.0*//*1.0 / 64.0*/;
let chunk_area_factor = neighbor_coef.x * neighbor_coef.y * mins_per_sec;
// NOTE: This technically makes us discontinuous, so we should be cautious about using this.
let derivative_divisor = 1.0;

View File

@ -60,7 +60,10 @@ use vek::*;
// cleanly representable in f32 (that stops around 1024 * 4 * 1024 * 4, for signed floats anyway)
// but I think that is probably less important since I don't think we actually cast a chunk id to
// float, just coordinates... could be wrong though!
pub const WORLD_SIZE: Vec2<usize> = Vec2 { x: 1024, y: 1024 };
pub const WORLD_SIZE: Vec2<usize> = Vec2 {
x: 1024 * 1,
y: 1024 * 1,
};
/// A structure that holds cached noise values and cumulative distribution functions for the input
/// that led to those values. See the definition of InverseCdf for a description of how to
@ -300,9 +303,10 @@ pub struct WorldSim {
impl WorldSim {
pub fn generate(seed: u32, opts: WorldOpts) -> Self {
let mut rng = ChaChaRng::from_seed(seed_expan::rng_state(seed));
let continent_scale = 5_000.0f64 /*32768.0*/
.div(32.0)
.mul(TerrainChunkSize::RECT_SIZE.x as f64);
let continent_scale = 1.0/*4.0*/
* 5_000.0f64 /*32768.0*/
.div(32.0)
.mul(TerrainChunkSize::RECT_SIZE.x as f64);
let rock_lacunarity = /*0.5*/2.0/*HybridMulti::DEFAULT_LACUNARITY*/;
let uplift_scale = /*512.0*//*256.0*/128.0;
let uplift_turb_scale = uplift_scale / 4.0/*32.0*//*64.0*/;
@ -427,6 +431,7 @@ impl WorldSim {
// We define grid_scale such that Δx = height_scale * Δx' ⇒
// grid_scale = Δx / Δx'.
let grid_scale = 1.0f64 / 4.0/*1.0*/;
// Now, suppose we want to generate a world with "similar" topography, defined in this case
// as having roughly equal slopes at steady state, with the simulation taking roughly as
// many steps to get to the point the previous world was at when it finished being