From 35b436f26c8c26db38689995008d07328c678b7c Mon Sep 17 00:00:00 2001 From: IntegratedQuantum Date: Sun, 19 Nov 2023 19:39:58 +0100 Subject: [PATCH] Don't use tabs in comments. --- src/server/terrain/noise/FractalNoise.zig | 28 +++++++++---------- .../noise/RandomlyWeightedFractalNoise.zig | 24 ++++++++-------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/server/terrain/noise/FractalNoise.zig b/src/server/terrain/noise/FractalNoise.zig index 4b776388..3926372a 100644 --- a/src/server/terrain/noise/FractalNoise.zig +++ b/src/server/terrain/noise/FractalNoise.zig @@ -34,23 +34,23 @@ pub fn generateFractalTerrain(wx: i32, wz: i32, x0: u31, z0: u31, width: u32, he pub fn generateInitializedFractalTerrain(offsetX: i32, offsetZ: i32, scale: u31, startingScale: u31, worldSeed: u64, bigMap: Array2D(f32), lowerLimit: f32, upperLimit: f32, maxResolution: u31) void { // Increase the "grid" of points with already known heights in each round by a factor of 2×2, like so(# marks the gridpoints of the first grid, * the points of the second grid and + the points of the third grid(and so on…)): // - // #+*+# - // +++++ - // *+*+* - // +++++ - // #+*+# + // #+*+# + // +++++ + // *+*+* + // +++++ + // #+*+# // // Each new gridpoint gets the average height value of the surrounding known grid points which is afterwards offset by a random value. Here is a visual representation of this process(with random starting values): // - //█░▒▓ small small - // █???█ grid █?█?█ random █?▓?█ grid ██▓██ random ██▓██ - // ????? resize ????? change ????? resize ▓▓▒▓█ change ▒▒▒▓█ - // ????? →→→→ ▒?▒?▓ →→→→ ▒?░?▓ →→→→ ▒▒░▒▓ →→→→ ▒░░▒▓ - // ????? ????? of new ????? ░░░▒▓ of new ░░▒▓█ - // ???▒ ?░?▒ values ?░?▒ ░░▒▒ values ░░▒▒ - // - // Another important thing to note is that the side length of the grid has to be 2^n + 1 because every new gridpoint needs a new neighbor. So the rightmost column and the bottom row are already part of the next map piece. - // One other important thing in the implementation of this algorithm is that the relative height change has to decrease the in every iteration. Otherwise the terrain would look really noisy. + //█░▒▓ small small + // █???█ grid █?█?█ random █?▓?█ grid ██▓██ random ██▓██ + // ????? resize ????? change ????? resize ▓▓▒▓█ change ▒▒▒▓█ + // ????? →→→→ ▒?▒?▓ →→→→ ▒?░?▓ →→→→ ▒▒░▒▓ →→→→ ▒░░▒▓ + // ????? ????? of new ????? ░░░▒▓ of new ░░▒▓█ + // ???▒ ?░?▒ values ?░?▒ ░░▒▒ values ░░▒▒ + // + // Another important thing to note is that the side length of the grid has to be 2^n + 1 because every new gridpoint needs a new neighbor. So the rightmost column and the bottom row are already part of the next map piece. + // One other important thing in the implementation of this algorithm is that the relative height change has to decrease the in every iteration. Otherwise the terrain would look really noisy. const max = startingScale + 1; var seed: u64 = undefined; var res: u31 = startingScale/2; diff --git a/src/server/terrain/noise/RandomlyWeightedFractalNoise.zig b/src/server/terrain/noise/RandomlyWeightedFractalNoise.zig index bcce384c..6781d34b 100644 --- a/src/server/terrain/noise/RandomlyWeightedFractalNoise.zig +++ b/src/server/terrain/noise/RandomlyWeightedFractalNoise.zig @@ -34,22 +34,22 @@ pub fn generateFractalTerrain(wx: i32, wz: i32, x0: u31, z0: u31, width: u32, he pub fn generateInitializedFractalTerrain(offsetX: i32, offsetZ: i32, scale: u31, startingScale: u31, worldSeed: u64, bigMap: Array2D(f32), lowerLimit: f32, upperLimit: f32, maxResolution: u31) void { // Increase the "grid" of points with already known heights in each round by a factor of 2×2, like so(# marks the gridpoints of the first grid, * the points of the second grid and + the points of the third grid(and so on…)): // - // #+*+# - // +++++ - // *+*+* - // +++++ - // #+*+# + // #+*+# + // +++++ + // *+*+* + // +++++ + // #+*+# // // Each new gridpoint gets the interpolated height value of the surrounding known grid points using random weights. Afterwards this value gets offset by a random value. // Here is a visual representation of this process(with random starting values): // - //█░▒▓ small small - // █???█ grid █?█?█ random █?▓?█ grid ██▓▓█ random ██▓▓█ - // ????? resize ????? change ????? resize █▓▓▓▒ change █▓█▓▒ - // ????? →→→→ ▓?▓?▒ →→→→ ▒?█?▒ →→→→ ▒▒██▒ →→→→ ▒▒██▒ - // ????? ????? of new ????? ░▒░▒▒ of new ░▒░▒░ - // ???▒ ? ?▒ values ?░?▒ ░░▒ values ░░▒ - // + //█░▒▓ small small + // █???█ grid █?█?█ random █?▓?█ grid ██▓▓█ random ██▓▓█ + // ????? resize ????? change ????? resize █▓▓▓▒ change █▓█▓▒ + // ????? →→→→ ▓?▓?▒ →→→→ ▒?█?▒ →→→→ ▒▒██▒ →→→→ ▒▒██▒ + // ????? ????? of new ????? ░▒░▒▒ of new ░▒░▒░ + // ???▒ ? ?▒ values ?░?▒ ░░▒ values ░░▒ + // // Another important thing to note is that the side length of the grid has to be 2^n + 1 because every new gridpoint needs a new neighbor. // So the rightmost column and the bottom row are already part of the next map piece. // One other important thing in the implementation of this algorithm is that the relative height change has to decrease in every iteration. Otherwise the terrain would look noisy.