terrain-map
ARCHIVED - repo for blog post http://www.vogt.world/writing/procedural-terrain-generation/
git clone https://git.vogt.world/terrain-map.git
Log | Files | README.md
← Commit log
commit
message
Adding explaination, multiple maps
author
Ben Vogt <[email protected]>
date
2016-05-14 03:16:25
stats
3 file(s) changed, 42 insertions(+), 11 deletions(-)
files
index.html
main.js
style.css
 1diff --git a/index.html b/index.html
 2index a12c080..10b0a20 100644
 3--- a/index.html
 4+++ b/index.html
 5@@ -12,6 +12,7 @@
 6         <h1>Terrain Maps</h1>
 7         <h4>Generating terrain maps using Diamon-Square, smoothing, and erosion algorithms.</h4>
 8         <p>I've been messing around with different terrain smoothing algorithms to run on Diamond-Square-generated maps. I'm putting them here to so I remember them and write them out a little more clearly.</p>
 9+        <p><strong>NOTE: Some of these take upwards of 45 seconds to generate on a computer with a solid processor. Your milage may vary.</strong></p>
10       </div>
11     </div>
12     <!-- container-1 -->
13@@ -76,6 +77,7 @@
14       <div class="row">
15         <h2>Complex Erosion Algorithm</h2>
16         <p>
17+          Like <em>Simple Erosion Algorithm</em> but it uses velocity (with a minimum velocity ensure), slope (with a minimum slope ensured as well) to calculate carring capacity and depositing.
18           <button class="run button-primary" id="complexErosion">RUN</button>
19         </p>
20       </div>
21diff --git a/main.js b/main.js
22index 113bdbe..ed07e05 100644
23--- a/main.js
24+++ b/main.js
25@@ -585,18 +585,43 @@ $(document).ready(function() {
26     terrain.draw();
27   });
28 
29-  var terrain = new LandMap({
30-    containerId: "container-5"
31-  });
32-  terrain.generate(0.75, "standard");
33-  terrain.complexErosion({
34-    carryingCapacity: 1.5,
35-    depositionSpeed: 0.03,
36-    iterations: 10,
37-    drops: 1000000,
38-    one: "standard",
39-    two: "complexErosion"
40+  $("#complexErosion").click(function() {
41+    var terrain = new LandMap({
42+      containerId: "container-5"
43+    });
44+    terrain.generate(0.75, "standard");
45+    terrain.complexErosion({
46+      carryingCapacity: 1.5,
47+      depositionSpeed: 0.03,
48+      iterations: 10,
49+      drops: 1000000,
50+      one: "standard",
51+      two: "complexErosion-1000000-10ipd"
52+    });
53+    terrain.complexErosion({
54+      carryingCapacity: 1.5,
55+      depositionSpeed: 0.03,
56+      iterations: 20,
57+      drops: 1000000,
58+      one: "standard",
59+      two: "complexErosion-1000000-20ipd"
60+    });
61+    terrain.complexErosion({
62+      carryingCapacity: 1.5,
63+      depositionSpeed: 0.03,
64+      iterations: 3,
65+      drops: 4000000,
66+      one: "standard",
67+      two: "complexErosion-4000000-3ipd"
68+    });
69+    terrain.complexErosion({
70+      carryingCapacity: 1.5,
71+      depositionSpeed: 0.03,
72+      iterations: 3,
73+      drops: 8000000,
74+      one: "standard",
75+      two: "complexErosion-8000000-3ipd"
76+    });
77+    terrain.draw();
78   });
79-  terrain.draw();
80-
81 })
82diff --git a/style.css b/style.css
83index 8d6f247..5c5f7d2 100644
84--- a/style.css
85+++ b/style.css
86@@ -6,6 +6,10 @@ img.map {
87   border: 1px solid #E0E0E0;
88 }
89 
90+div.box {
91+  padding-bottom: 20px;
92+}
93+
94 div.set-of {
95   min-height: 256px;
96 }