1 RMS.LoadLibrary("rmgen");
3 const tHillDark = "cliff volcanic light";
4 const tHillMedium1 = "ocean_rock_a";
5 const tHillMedium2 = "ocean_rock_b";
6 const tHillVeryDark = ["cliff volcanic coarse", "cave_walls"];
8 const tRoadWild = "road1";
9 const tForestFloor1 = tHillMedium1;
10 const tForestFloor2 = tHillMedium2;
11 const tGrassA = "cliff volcanic light";
12 const tGrassB = "ocean_rock_a";
13 const tGrassPatchBlend = "temp_grass_long_b";
14 const tGrassPatch = ["temp_grass_d", "temp_grass_clovers"];
15 const tShoreBlend = "cliff volcanic light";
16 const tShore = "ocean_rock_a";
17 const tWater = "ocean_rock_b";
20 const oTree = "gaia/flora_tree_dead";
21 const oTree2 = "gaia/flora_tree_euro_beech";
22 const oTree3 = "gaia/flora_tree_oak";
23 const oTree4 = "gaia/flora_tree_oak_dead";
24 const oBush = "gaia/flora_bush_temperate";
25 const oFruitBush = "gaia/flora_bush_berry";
26 const oRabbit = "gaia/fauna_rabbit";
27 const oGoat = "gaia/fauna_goat";
28 const oBear = "gaia/fauna_bear";
29 const oStoneLarge = "gaia/geology_stonemine_temperate_quarry";
30 const oStoneSmall = "gaia/geology_stone_temperate";
31 const oMetalLarge = "gaia/geology_metal_temperate_slabs";
32 const oTower = "other/palisades_rocks_fort";
35 const aRockLarge = "actor|geology/stone_granite_med.xml";
36 const aRockMedium = "actor|geology/stone_granite_med.xml";
37 const aBushMedium = "actor|props/flora/bush_tempe_me.xml";
38 const aBushSmall = "actor|props/flora/bush_tempe_sm.xml";
39 const aGrass = "actor|props/flora/grass_soft_large_tall.xml";
40 const aGrassShort = "actor|props/flora/grass_soft_large.xml";
41 const aRain = "actor|particle/rain_shower.xml";
44 tForestFloor1 + TERRAIN_SEPARATOR + oTree,
45 tForestFloor2 + TERRAIN_SEPARATOR + oTree2,
50 tForestFloor1 + TERRAIN_SEPARATOR + oTree3,
51 tForestFloor2 + TERRAIN_SEPARATOR + oTree4,
57 var numPlayers = getNumPlayers();
59 var clPlayer = createTileClass();
60 var clHill = createTileClass();
61 var clFood = createTileClass();
62 var clForest = createTileClass();
63 var clWater = createTileClass();
64 var clDirt = createTileClass();
65 var clGrass = createTileClass();
66 var clRock = createTileClass();
67 var clMetal = createTileClass();
68 var clBaseResource = createTileClass();
69 var clBumps = createTileClass();
70 var clTower = createTileClass();
71 var clRain = createTileClass();
73 var ccMountainHeight = 25;
75 var [playerIDs, playerX, playerZ] = radialPlayerPlacement();
77 for (let i = 0; i < numPlayers; ++i)
79 let id = playerIDs[i];
80 log("Creating base for player " + id + "...");
81 let radius = scaleByMapSize(15, 25);
83 let fx = fractionToTiles(playerX[i]);
84 let fz = fractionToTiles(playerZ[i]);
85 let ix = Math.round(fx);
86 let iz = Math.round(fz);
88 // This one consists of many bumps, creating an omnidirectional ramp
91 Math.floor(scaleByMapSize(15, 15)),
92 Math.floor(scaleByMapSize(15, 15)),
93 Math.floor(scaleByMapSize(4, 10)),
101 // Flatten the initial CC area
102 let hillSize = PI * radius * radius;
104 new ClumpPlacer(hillSize, 0.95, 0.6, 10, ix, iz),
106 new LayeredPainter([tHillVeryDark, tHillMedium1], [radius]),
107 new SmoothElevationPainter(ELEVATION_SET, ccMountainHeight, radius),
112 // Create the city patch
113 let cityRadius = radius / 3;
115 new ClumpPlacer(PI * cityRadius * cityRadius, 0.6, 0.3, 10, ix, iz),
116 new LayeredPainter([tRoadWild, tRoad], [1]),
119 placeCivDefaultEntities(fx, fz, id, { 'iberWall': 'towers' });
122 let mAngle = randFloat(0, 2 * PI);
126 [new SimpleObject(oMetalLarge, 1, 1, 0, 0)],
129 Math.round(fx + mDist * Math.cos(mAngle)),
130 Math.round(fz + mDist * Math.sin(mAngle))),
133 // Create stone mines
134 mAngle += randFloat(PI/4, PI/3);
137 [new SimpleObject(oStoneLarge, 1, 1, 0, 2)],
140 Math.round(fx + mDist * Math.cos(mAngle)),
141 Math.round(fz + mDist * Math.sin(mAngle))),
144 placeDefaultChicken(fx, fz, clBaseResource);
146 // Create berry bushes
147 mAngle += randFloat(PI/4, PI/2);
151 [new SimpleObject(oFruitBush, 5, 5, 0, 3)],
154 Math.round(fx + bbDist * Math.cos(mAngle)),
155 Math.round(fz + bbDist * Math.sin(mAngle))),
158 // Create starting trees
159 let num = Math.floor(hillSize / 60);
161 for (let x = 0; x < tries; ++x)
163 let tAngle = randFloat(0, 2 * PI);
164 let tDist = randFloat(10, 12);
165 if (createObjectGroup(
167 [new SimpleObject(oTree2, num, num, 0, 3)],
170 Math.round(fx + tDist * Math.cos(tAngle)),
171 Math.round(fz + tDist * Math.sin(tAngle))),
173 avoidClasses(clBaseResource, 3)))
181 createVolcano(0.5, 0.5, clHill, tHillVeryDark, undefined, false, ELEVATION_SET);
184 log("Creating lakes...");
186 new ChainPlacer(5, 6, Math.floor(scaleByMapSize(10, 14)), 0.1),
188 new LayeredPainter([tShoreBlend, tShore, tWater], [1, 1]),
189 new SmoothElevationPainter(ELEVATION_SET, -4, 3),
192 avoidClasses(clPlayer, 0, clHill, 2, clWater, 12),
193 Math.round(scaleByMapSize(6, 12)));
196 createBumps(avoidClasses(clPlayer, 0, clHill, 0), scaleByMapSize(50, 300), 1, 10, 3, 0, scaleByMapSize(4, 10));
197 paintTileClassBasedOnHeight(10, 100, 0, clBumps);
200 log("Creating hills...");
202 new ClumpPlacer(scaleByMapSize(20, 150), 0.2, 0.1, 1),
204 new LayeredPainter([tHillDark, tHillDark, tHillDark], [2, 2]),
205 new SmoothElevationPainter(ELEVATION_SET, 18, 2),
208 avoidClasses(clPlayer, 0, clHill, 15, clWater, 2, clBaseResource, 2),
209 scaleByMapSize(2, 8) * numPlayers);
212 log("Creating forests...");
213 var [forestTrees, stragglerTrees] = getTreeCounts(1200, 3000, 0.7);
215 [[tGrassB, tGrassA, pForestD], [tGrassB, pForestD]],
216 [[tGrassB, tGrassA, pForestP], [tGrassB, pForestP]]
218 var size = forestTrees / (scaleByMapSize(4, 12) * numPlayers);
219 var num = Math.floor(size / types.length);
220 for (let type of types)
222 new ClumpPlacer(forestTrees / num, 0.1, 0.1, 1),
224 new LayeredPainter(type, [2]),
235 log("Creating hill patches...");
236 for (let size of [scaleByMapSize(3, 48), scaleByMapSize(5, 84), scaleByMapSize(8, 128)])
237 for (let type of [[tHillMedium1, tHillDark], [tHillDark, tHillMedium2], [tHillMedium1, tHillMedium2]])
239 new ClumpPlacer(size, 0.3, 0.06, 0.5),
241 new LayeredPainter(type, [1]),
250 scaleByMapSize(20, 80));
253 log("Creating grass patches...");
254 createLayeredPatches(
255 [scaleByMapSize(2, 4), scaleByMapSize(3, 7), scaleByMapSize(5, 15)],
256 [tGrassPatchBlend, tGrassPatch],
265 scaleByMapSize(3, 8),
269 log("Creating stone mines...");
270 createObjectGroupsDeprecated(
273 new SimpleObject(oStoneSmall, 0, 2, 0, 4),
274 new SimpleObject(oStoneLarge, 1, 1, 0, 4)
280 stayClasses(clBumps, 1),
292 log("Creating small stone quarries...");
293 createObjectGroupsDeprecated(
294 new SimpleGroup([new SimpleObject(oStoneSmall, 2, 5, 1, 3)], true, clRock),
297 stayClasses(clBumps, 1),
309 log("Creating metal mines...");
310 createObjectGroupsDeprecated(
311 new SimpleGroup([new SimpleObject(oMetalLarge, 1, 1, 0, 4)], true, clMetal),
314 stayClasses(clBumps, 1),
327 log("Creating towers...");
328 createObjectGroupsDeprecated(
329 new SimpleGroup([new SimpleObject(oTower, 1, 1, 0, 4)], true, clTower),
332 stayClasses(clBumps, 3),
347 [new SimpleObject(aGrassShort, 1, 2, 0, 1)],
349 new SimpleObject(aGrass, 2, 4, 0, 1.8),
350 new SimpleObject(aGrassShort, 3, 6, 1.2, 2.5)
353 new SimpleObject(aBushMedium, 1, 2, 0, 2),
354 new SimpleObject(aBushSmall, 2, 4, 0, 2)
358 scaleByMapSize(15, 200),
359 scaleByMapSize(15, 200),
360 scaleByMapSize(15, 200)
363 stayClasses(clGrass, 0),
375 new SimpleObject(aRockMedium, 1, 3, 0, 1)
378 new SimpleObject(aRockLarge, 1, 2, 0, 1),
379 new SimpleObject(aRockMedium, 1, 3, 0, 2)
383 scaleByMapSize(15, 250),
384 scaleByMapSize(15, 150)
396 [new SimpleObject(oRabbit, 5, 7, 2, 4)],
397 [new SimpleObject(oGoat, 3, 5, 2, 4)]
400 scaleByMapSize(1, 6) * numPlayers,
401 scaleByMapSize(3, 10) * numPlayers
416 [new SimpleObject(oBear, 1, 1, 0, 2)]
429 stayClasses(clForest, 2)
436 [new SimpleObject(oFruitBush, 1, 2, 0, 4)]
441 [stayClasses(clGrass, 1), avoidClasses(clWater, 1, clForest, 0, clPlayer, 0, clHill, 1, clFood, 10)],
445 createStragglerTrees(
446 [oTree, oTree2, oTree3, oTree4, oBush],
448 stayClasses(clGrass, 1),
462 log("Creating straggler bushes...");
463 createObjectGroupsDeprecated(
465 [new SimpleObject(oBush, 1, 3, 0, 3)],
471 stayClasses(clGrass, 3),
482 log("Creating rain drops...");
483 createObjectGroupsDeprecated(
485 [new SimpleObject(aRain, 2, 2, 1, 4)],
489 avoidClasses(clRain, 5),
490 scaleByMapSize(80, 250));
494 setWaterType("lake");
496 setWaterColor(0.1, 0.13, 0.15);
497 setWaterTint(0.058, 0.05, 0.035);
498 setWaterMurkiness(0.9);