2 * Heightmap image source:
3 * Imagery by Jesse Allen, NASA's Earth Observatory,
4 * using data from the General Bathymetric Chart of the Oceans (GEBCO)
5 * produced by the British Oceanographic Data Centre.
6 * https://visibleearth.nasa.gov/view.php?id=73934
8 * Licensing: Public Domain, https://visibleearth.nasa.gov/useterms.php
10 * The heightmap image is reproduced using:
11 * wget https://eoimages.gsfc.nasa.gov/images/imagerecords/73000/73934/gebco_08_rev_elev_C1_grey_geo.tif
12 * lat=49.31; lon=1.1; width=1
13 * lat1=$(bc <<< ";scale=5;$lat-$width/2"); lon1=$(bc <<< ";scale=5;$lon+$width/2"); lat2=$(bc <<< ";scale=5;$lat+$width/2"); lon2=$(bc <<< ";scale=5;$lon-$width/2")
14 * gdal_translate -projwin $lon2 $lat2 $lon1 $lat1 gebco_08_rev_elev_C1_grey_geo.tif ratumacos.tif
15 * convert ratumacos.tif -resize 512 -contrast-stretch 0 ratumacos.png
16 * No further changes should be applied to the image to keep it easily interchangeable.
19 Engine.LoadLibrary("rmgen");
20 Engine.LoadLibrary("rmgen-common");
21 Engine.LoadLibrary("rmgen2");
22 Engine.LoadLibrary("rmbiome");
24 setBiome("generic/alpine");
26 g_Terrains.mainTerrain = "new_alpine_grass_d";
27 g_Terrains.forestFloor1 = "alpine_grass_d";
28 g_Terrains.forestFloor2 = "alpine_grass_c";
29 g_Terrains.tier1Terrain = "new_alpine_grass_c";
30 g_Terrains.tier2Terrain = "new_alpine_grass_b";
31 g_Terrains.tier3Terrain = "alpine_grass_a";
32 g_Terrains.tier4Terrain = "new_alpine_grass_e";
34 g_Gaia.mainHuntableAnimal = "gaia/fauna_deer";
35 g_Gaia.secondaryHuntableAnimal = "gaia/fauna_pig";
36 g_Gaia.fish = "gaia/fauna_fish_tilapia";
37 g_Gaia.tree1 = "gaia/flora_tree_poplar";
38 g_Gaia.tree2 = "gaia/flora_tree_toona";
39 g_Gaia.tree3 = "gaia/flora_tree_apple";
40 g_Gaia.tree4 = "gaia/flora_tree_acacia";
41 g_Gaia.tree5 = "gaia/flora_tree_carob";
43 g_Decoratives.grass = "actor|props/flora/grass_soft_large.xml";
44 g_Decoratives.grassShort = "actor|props/flora/grass_tufts_a.xml";
45 g_Decoratives.rockLarge = "actor|geology/stone_granite_med.xml";
46 g_Decoratives.rockMedium = "actor|geology/stone_granite_small.xml";
47 g_Decoratives.bushMedium = "actor|props/flora/bush_tempe_a.xml";
48 g_Decoratives.bushSmall = "actor|props/flora/bush_tempe_b.xml";
49 g_Decoratives.reeds = "actor|props/flora/reeds_pond_lush_a.xml";
50 g_Decoratives.lillies = "actor|props/flora/water_lillies.xml";
52 const heightScale = num => num * g_MapSettings.Size / 320;
54 const heightReedsMin = heightScale(-2);
55 const heightShallow = heightScale(-1);
56 const heightWaterLevel = heightScale(0);
57 const heightShoreline = heightScale(3);
58 const heightPlayer = heightScale(10);
60 const g_Map = new RandomMap(0, g_Terrains.mainTerrain);
61 const mapBounds = g_Map.getBounds();
62 const mapCenter = g_Map.getCenter();
64 const riverAngle = 0.65 * Math.PI;
66 initTileClasses(["shoreline", "shallows"]);
68 g_Map.LoadHeightmapImage("ratumacos.png", -3, 20);
69 Engine.SetProgress(15);
71 g_Map.log("Smoothing heightmap");
73 new MapBoundsPlacer(),
74 new SmoothingPainter(1, 0.1, 1));
75 Engine.SetProgress(25);
77 g_Map.log("Creating shallows");
78 for (let i = 0; i < scaleByMapSize(5, 12); ++i)
80 let x = fractionToTiles(randFloat(0, 1));
82 "start": new Vector2D(x, mapBounds.bottom).rotateAround(riverAngle + Math.PI / 2 * randFloat(0.8, 1.2), mapCenter),
83 "end": new Vector2D(x, mapBounds.top).rotateAround(riverAngle + Math.PI / 2 * randFloat(0.8, 1.2), mapCenter),
84 "startWidth": scaleByMapSize(8, 12),
85 "endWidth": scaleByMapSize(8, 12),
87 "startHeight": heightShallow,
88 "endHeight": heightShallow,
89 "constraints": new HeightConstraint(-Infinity, heightShallow)
93 g_Map.log("Painting water");
95 new MapBoundsPlacer(),
97 new TerrainPainter(g_Terrains.water),
98 new TileClassPainter(g_TileClasses.water)
100 new HeightConstraint(-Infinity, heightWaterLevel));
101 Engine.SetProgress(30);
103 g_Map.log("Marking land");
105 new MapBoundsPlacer(),
106 new TileClassPainter(g_TileClasses.land),
107 avoidClasses(g_TileClasses.water, 0));
108 Engine.SetProgress(35);
110 g_Map.log("Painting shoreline");
112 new MapBoundsPlacer(),
114 new TerrainPainter(g_Terrains.shore),
115 new TileClassPainter(g_TileClasses.shoreline)
117 new HeightConstraint(heightWaterLevel, heightShoreline));
118 Engine.SetProgress(40);
121 "PlayerPlacement": playerPlacementRiver(riverAngle, fractionToTiles(0.6)),
122 "PlayerTileClass": g_TileClasses.player,
123 "BaseResourceClass": g_TileClasses.baseResource,
126 "outerTerrain": g_Terrains.roadWild,
127 "innerTerrain": g_Terrains.road,
129 new SmoothElevationPainter(ELEVATION_SET, heightPlayer, 2)
135 "template": g_Gaia.fruitBush
139 { "template": g_Gaia.metalLarge },
140 { "template": g_Gaia.stoneLarge }
144 "template": g_Gaia.tree1,
148 "template": g_Decoratives.rockMedium
154 "func": addLayeredPatches,
156 g_TileClasses.dirt, 5,
157 g_TileClasses.forest, 2,
158 g_TileClasses.mountain, 2,
159 g_TileClasses.player, 12,
160 g_TileClasses.water, 3,
161 g_TileClasses.shoreline, 3
168 "func": addDecoration,
170 g_TileClasses.forest, 2,
171 g_TileClasses.mountain, 2,
172 g_TileClasses.player, 12,
173 g_TileClasses.water, 3,
174 g_TileClasses.shoreline, 3
182 addElements(shuffleArray([
184 "func": addSmallMetal,
186 g_TileClasses.berries, 5,
187 g_TileClasses.forest, 3,
188 g_TileClasses.mountain, 6,
189 g_TileClasses.player, 30,
190 g_TileClasses.rock, 20,
191 g_TileClasses.metal, 30,
192 g_TileClasses.water, 3,
193 g_TileClasses.shoreline, 3
202 g_TileClasses.berries, 5,
203 g_TileClasses.forest, 3,
204 g_TileClasses.mountain, 6,
205 g_TileClasses.player, 30,
206 g_TileClasses.rock, 30,
207 g_TileClasses.metal, 20,
208 g_TileClasses.water, 3,
209 g_TileClasses.shoreline, 3
213 "amounts": ["normal"]
218 g_TileClasses.berries, 5,
219 g_TileClasses.forest, 3,
220 g_TileClasses.mountain, 6,
221 g_TileClasses.player, 30,
222 g_TileClasses.rock, 30,
223 g_TileClasses.metal, 20,
224 g_TileClasses.water, 3,
225 g_TileClasses.shoreline, 3
229 "amounts": ["normal"]
234 g_TileClasses.berries, 5,
235 g_TileClasses.forest, 8,
236 g_TileClasses.metal, 3,
237 g_TileClasses.mountain, 6,
238 g_TileClasses.player, 20,
239 g_TileClasses.rock, 3,
240 g_TileClasses.water, 2,
241 g_TileClasses.shoreline, 2
249 addElements(shuffleArray([
253 g_TileClasses.animals, 20,
254 g_TileClasses.forest, 2,
255 g_TileClasses.metal, 2,
256 g_TileClasses.mountain, 6,
257 g_TileClasses.player, 20,
258 g_TileClasses.rock, 2,
259 g_TileClasses.water, 3,
260 g_TileClasses.shoreline, 3
263 "mixes": ["similar"],
269 g_TileClasses.animals, 20,
270 g_TileClasses.forest, 2,
271 g_TileClasses.metal, 2,
272 g_TileClasses.mountain, 6,
273 g_TileClasses.player, 20,
274 g_TileClasses.rock, 2,
275 g_TileClasses.water, 3,
276 g_TileClasses.shoreline, 3
279 "mixes": ["similar"],
285 g_TileClasses.berries, 30,
286 g_TileClasses.forest, 5,
287 g_TileClasses.metal, 10,
288 g_TileClasses.mountain, 2,
289 g_TileClasses.player, 20,
290 g_TileClasses.rock, 10,
291 g_TileClasses.water, 3,
292 g_TileClasses.shoreline, 3
299 "func": addStragglerTrees,
301 g_TileClasses.berries, 5,
302 g_TileClasses.forest, 4,
303 g_TileClasses.metal, 2,
304 g_TileClasses.mountain, 6,
305 g_TileClasses.player, 12,
306 g_TileClasses.rock, 2,
307 g_TileClasses.water, 5,
308 g_TileClasses.shoreline, 3
315 Engine.SetProgress(80);
319 [new SimpleObject(g_Decoratives.reeds, 1, 3, 0, 1)],
320 [new SimpleObject(g_Decoratives.lillies, 1, 2, 0, 1)]
323 200 * Math.pow(scaleByMapSize(3, 12), 2),
324 100 * Math.pow(scaleByMapSize(3, 12), 2)
326 new HeightConstraint(heightReedsMin, heightShoreline)
328 Engine.SetProgress(90);
330 g_Map.log("Placing fish");
335 g_TileClasses.fish, 10,
337 "stay": [g_TileClasses.water, 4],
339 "mixes": ["similar"],
343 Engine.SetProgress(95);
346 g_Map.createTileClass(),
348 stayClasses(g_TileClasses.land, 4),
350 g_TileClasses.forest, 1,
351 g_TileClasses.rock, 4,
352 g_TileClasses.metal, 4,
353 g_TileClasses.animals, 1)
356 setSunColor(0.733, 0.746, 0.574);
358 setWaterHeight(20 + heightWaterLevel);
359 setWaterTint(0.224, 0.271, 0.270);
360 setWaterColor(0.224, 0.271, 0.270);
362 setWaterMurkiness(0.87);
363 setWaterType("clap");
365 setTerrainAmbientColor(0.521, 0.475, 0.322);
367 setSunRotation(-Math.PI);
368 setSunElevation(Math.PI / 6.25);
372 setFogColor(0.69, 0.616, 0.541);
376 setPPSaturation(0.42);