Cleaned up seed generation in worldsim.

This commit is contained in:
Acrimon 2019-08-11 13:35:04 +02:00
parent cdf4c26be7
commit 7b8a7a410d

View File

@ -54,42 +54,47 @@ pub struct WorldSim {
}
impl WorldSim {
pub fn generate(seed: u32) -> Self {
pub fn generate(mut seed: u32) -> Self {
let mut gen_seed = || {
seed = seed_expan::diffuse(seed + 1);
seed
};
let mut gen_ctx = GenCtx {
turb_x_nz: SuperSimplex::new().set_seed(seed_expan::diffuse(seed)),
turb_y_nz: SuperSimplex::new().set_seed(seed_expan::diffuse(seed + 1)),
turb_x_nz: SuperSimplex::new().set_seed(gen_seed()),
turb_y_nz: SuperSimplex::new().set_seed(gen_seed()),
chaos_nz: RidgedMulti::new()
.set_octaves(7)
.set_seed(seed_expan::diffuse(seed + 2)),
hill_nz: SuperSimplex::new().set_seed(seed_expan::diffuse(seed + 3)),
.set_seed(gen_seed()),
hill_nz: SuperSimplex::new().set_seed(gen_seed()),
alt_nz: HybridMulti::new()
.set_octaves(8)
.set_persistence(0.1)
.set_seed(seed_expan::diffuse(seed + 4)),
temp_nz: SuperSimplex::new().set_seed(seed_expan::diffuse(seed + 5)),
dry_nz: BasicMulti::new().set_seed(seed_expan::diffuse(seed + 6)),
.set_seed(gen_seed()),
temp_nz: SuperSimplex::new().set_seed(gen_seed()),
dry_nz: BasicMulti::new().set_seed(gen_seed()),
small_nz: BasicMulti::new()
.set_octaves(2)
.set_seed(seed_expan::diffuse(seed + 7)),
.set_seed(gen_seed()),
rock_nz: HybridMulti::new()
.set_persistence(0.3)
.set_seed(seed_expan::diffuse(seed + 8)),
.set_seed(gen_seed()),
cliff_nz: HybridMulti::new()
.set_persistence(0.3)
.set_seed(seed_expan::diffuse(seed + 9)),
.set_seed(gen_seed()),
warp_nz: BasicMulti::new()
.set_octaves(3)
.set_seed(seed_expan::diffuse(seed + 10)),
.set_seed(gen_seed()),
tree_nz: BasicMulti::new()
.set_octaves(12)
.set_persistence(0.75)
.set_seed(seed_expan::diffuse(seed + 11)),
cave_0_nz: SuperSimplex::new().set_seed(seed_expan::diffuse(seed + 12)),
cave_1_nz: SuperSimplex::new().set_seed(seed_expan::diffuse(seed + 13)),
.set_seed(gen_seed()),
cave_0_nz: SuperSimplex::new().set_seed(gen_seed()),
cave_1_nz: SuperSimplex::new().set_seed(gen_seed()),
structure_gen: StructureGen2d::new(seed_expan::diffuse(seed + 14), 32, 24),
region_gen: StructureGen2d::new(seed_expan::diffuse(seed + 15), 400, 96),
cliff_gen: StructureGen2d::new(seed_expan::diffuse(seed + 16), 80, 56),
structure_gen: StructureGen2d::new(gen_seed(), 32, 24),
region_gen: StructureGen2d::new(gen_seed(), 400, 96),
cliff_gen: StructureGen2d::new(gen_seed(), 80, 56),
};
let mut chunks = Vec::new();