From 6d58a83a5e9bd5f9c4de179c83c4f1f31ad4faf3 Mon Sep 17 00:00:00 2001 From: M4YX0R Date: Sat, 11 Dec 2021 12:34:38 +0300 Subject: [PATCH] Noise theresold tweak for different cell sizes --- src/Controllers/EnvironmentController.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/Controllers/EnvironmentController.js b/src/Controllers/EnvironmentController.js index 7f96b00..8a75175 100644 --- a/src/Controllers/EnvironmentController.js +++ b/src/Controllers/EnvironmentController.js @@ -68,7 +68,7 @@ class EnvironmentController extends CanvasController{ var yval = r/this.env.num_rows*(resolution/this.env.renderer.cell_size*(this.env.num_rows/this.env.num_cols)); var noise = Perlin.get(xval, yval); avg_noise += noise/(this.env.num_rows*this.env.num_cols); - if (noise > noise_threshold && noise < noise_threshold + thickness/100*this.env.renderer.cell_size) { + if (noise > noise_threshold && noise < noise_threshold + thickness/resolution*(5/this.env.renderer.cell_size)) { var cell = this.env.grid_map.cellAt(c, r); if (cell != null) { if(cell.owner != null) cell.owner.die(); @@ -77,8 +77,6 @@ class EnvironmentController extends CanvasController{ } } } - - console.log("Average noise: " + avg_noise); } updateMouseLocation(offsetX, offsetY){