1 RMS.LoadLibrary("rmgen");
3 TILE_CENTERED_HEIGHT_MAP = true;
5 const tCity = "medit_city_pavement";
6 const tCityPlaza = "medit_city_pavement";
7 const tHill = ["medit_grass_shrubs", "medit_rocks_grass_shrubs", "medit_rocks_shrubs", "medit_rocks_grass", "medit_shrubs"];
8 const tMainDirt = "medit_dirt";
9 const tCliff = "medit_cliff_aegean";
10 const tForestFloor = "medit_grass_shrubs";
11 const tGrass = "medit_grass_field";
12 const tGrassSand50 = "medit_grass_field_a";
13 const tGrassSand25 = "medit_grass_field_b";
14 const tDirt = "medit_dirt_b";
15 const tDirt2 = "medit_rocks_grass";
16 const tDirt3 = "medit_rocks_shrubs";
17 const tDirtCracks = "medit_dirt_c";
18 const tShore = "medit_sand";
19 const tWater = "medit_sand_wet";
20 const tCorals1 = "medit_sea_coral_plants";
21 const tCorals2 = "medit_sea_coral_deep";
22 const tSeaDepths = "medit_sea_depths";
24 const oBerryBush = "gaia/flora_bush_berry";
25 const oDeer = "gaia/fauna_deer";
26 const oFish = "gaia/fauna_fish";
27 const oSheep = "gaia/fauna_sheep";
28 const oGoat = "gaia/fauna_goat";
29 const oStoneLarge = "gaia/geology_stonemine_medit_quarry";
30 const oStoneSmall = "gaia/geology_stone_mediterranean";
31 const oMetalLarge = "gaia/geology_metal_mediterranean_slabs";
32 const oDatePalm = "gaia/flora_tree_cretan_date_palm_short";
33 const oSDatePalm = "gaia/flora_tree_cretan_date_palm_tall";
34 const oCarob = "gaia/flora_tree_carob";
35 const oFanPalm = "gaia/flora_tree_medit_fan_palm";
36 const oPoplar = "gaia/flora_tree_poplar_lombardy";
37 const oCypress = "gaia/flora_tree_cypress";
39 const aBush1 = "actor|props/flora/bush_medit_sm.xml";
40 const aBush2 = "actor|props/flora/bush_medit_me.xml";
41 const aBush3 = "actor|props/flora/bush_medit_la.xml";
42 const aBush4 = "actor|props/flora/bush_medit_me.xml";
43 const aDecorativeRock = "actor|geology/stone_granite_med.xml";
45 const pForest = [tForestFloor, tForestFloor + TERRAIN_SEPARATOR + oCarob, tForestFloor + TERRAIN_SEPARATOR + oDatePalm, tForestFloor + TERRAIN_SEPARATOR + oSDatePalm, tForestFloor];
49 const numPlayers = getNumPlayers();
50 const mapSize = getMapSize();
52 var clPlayer = createTileClass();
53 var clForest = createTileClass();
54 var clWater = createTileClass();
55 var clDirt = createTileClass();
56 var clRock = createTileClass();
57 var clMetal = createTileClass();
58 var clFood = createTileClass();
59 var clBaseResource = createTileClass();
60 var clGrass = createTileClass();
61 var clHill = createTileClass();
62 var clIsland = createTileClass();
63 var clCorals = createTileClass();
65 var [playerIDs, playerX, playerZ] = playerPlacementRiver(0, 0.6);
67 for (var i = 0; i < numPlayers; i++)
69 var id = playerIDs[i];
70 log("Creating base for player " + id + "...");
72 var radius = scaleByMapSize(15,25);
76 // get the x and z in tiles
77 var fx = fractionToTiles(playerX[i]);
78 var fz = fractionToTiles(playerZ[i]);
81 addToClass(ix, iz, clPlayer);
83 // create the city patch
84 var cityRadius = radius/3;
85 var placer = new ClumpPlacer(PI*cityRadius*cityRadius, 0.6, 0.3, 10, ix, iz);
86 var painter = new LayeredPainter([tCityPlaza, tCity], [1]);
87 createArea(placer, painter, null);
89 placeCivDefaultEntities(fx, fz, id);
91 placeDefaultChicken(fx, fz, clBaseResource);
93 // create berry bushes
94 var bbAngle = randFloat(0, TWO_PI);
96 var bbX = round(fx + bbDist * cos(bbAngle));
97 var bbZ = round(fz + bbDist * sin(bbAngle));
98 var group = new SimpleGroup(
99 [new SimpleObject(oBerryBush, 5,5, 0,3)],
100 true, clBaseResource, bbX, bbZ
102 createObjectGroup(group, 0);
105 var mAngle = bbAngle;
106 while(abs(mAngle - bbAngle) < PI/3)
108 mAngle = randFloat(0, TWO_PI);
111 var mX = round(fx + mDist * cos(mAngle));
112 var mZ = round(fz + mDist * sin(mAngle));
113 group = new SimpleGroup(
114 [new SimpleObject(oMetalLarge, 1,1, 0,0)],
115 true, clBaseResource, mX, mZ
117 createObjectGroup(group, 0);
119 // create stone mines
120 mAngle += randFloat(PI/8, PI/4);
121 mX = round(fx + mDist * cos(mAngle));
122 mZ = round(fz + mDist * sin(mAngle));
123 group = new SimpleGroup(
124 [new SimpleObject(oStoneLarge, 1,1, 0,2)],
125 true, clBaseResource, mX, mZ
127 createObjectGroup(group, 0);
129 // create starting trees
131 var tAngle = randFloat(-PI/3, 4*PI/3);
132 var tDist = randFloat(11, 13);
133 var tX = round(fx + tDist * cos(tAngle));
134 var tZ = round(fz + tDist * sin(tAngle));
135 group = new SimpleGroup(
136 [new SimpleObject(oCarob, num, num, 0,5)],
137 false, clBaseResource, tX, tZ
139 createObjectGroup(group, 0, avoidClasses(clBaseResource,2));
141 placeDefaultDecoratives(fx, fz, aBush1, clBaseResource, radius);
158 "waterFunc": (ix, iz, height, riverFraction) => {
161 addToClass(ix, iz, clWater);
165 paintTerrainBasedOnHeight(-20, 1, 0, tWater);
166 paintTerrainBasedOnHeight(1, 2, 0, tShore);
169 createBumps(avoidClasses(clWater, 2, clPlayer, 20));
171 var [forestTrees, stragglerTrees] = getTreeCounts(500, 3000, 0.7);
173 [tForestFloor, tForestFloor, tForestFloor, pForest, pForest],
174 avoidClasses(clPlayer, 20, clForest, 17, clWater, 2, clBaseResource, 3),
181 createHills([tGrass, tCliff, tHill], avoidClasses(clPlayer, 20, clForest, 1, clHill, 15, clWater, 3), clHill, scaleByMapSize(3, 15));
183 createMountains(tCliff, avoidClasses(clPlayer, 20, clForest, 1, clHill, 15, clWater, 3), clHill, scaleByMapSize(3, 15));
185 log("Creating grass patches...");
186 createLayeredPatches(
187 [scaleByMapSize(3, 6), scaleByMapSize(5, 10), scaleByMapSize(8, 21)],
188 [[tGrass,tGrassSand50],[tGrassSand50,tGrassSand25], [tGrassSand25,tGrass]],
190 avoidClasses(clForest, 0, clGrass, 2, clPlayer, 10, clWater, 2, clDirt, 2, clHill, 1),
191 scaleByMapSize(15, 45),
196 log("Creating dirt patches...");
197 createLayeredPatches(
198 [scaleByMapSize(3, 6), scaleByMapSize(5, 10), scaleByMapSize(8, 21)],
199 [tDirt3, tDirt2,[tDirt,tMainDirt], [tDirtCracks,tMainDirt]],
201 avoidClasses(clForest, 0, clDirt, 2, clPlayer, 10, clWater, 2, clGrass, 2, clHill, 1),
202 scaleByMapSize(15, 45),
207 log("Creating undersea bumps...");
209 new ChainPlacer(1, Math.floor(scaleByMapSize(4, 6)), Math.floor(scaleByMapSize(16, 40)), 0.5),
211 new SmoothElevationPainter(ELEVATION_SET, -2.5, 3),
214 stayClasses(clWater, 6),
215 scaleByMapSize(10, 50)
218 log("Creating islands...");
220 new ChainPlacer(1, Math.floor(scaleByMapSize(4, 6)), Math.floor(scaleByMapSize(30, 80)), 0.5),
222 new LayeredPainter([tWater, tShore, tHill], [2 ,1]),
223 new SmoothElevationPainter(ELEVATION_SET, 6, 4),
226 [avoidClasses(clPlayer, 8, clForest, 1, clIsland, 15), stayClasses (clWater, 6)],
227 scaleByMapSize(1, 4) * numPlayers
230 paintTerrainBasedOnHeight(-20, -3, 3, tSeaDepths);
231 paintTerrainBasedOnHeight(-3, -2, 2, tCorals2);
232 paintTerrainBasedOnHeight(-2, -1.5, 2, tCorals1);
234 log("Creating island stone mines...");
237 [new SimpleObject(oStoneSmall, 0,2, 0,4), new SimpleObject(oStoneLarge, 1,1, 0,4)],
238 [new SimpleObject(oStoneSmall, 2,5, 1,3)]
240 stayClasses(clIsland, 4),
243 log("Creating island metal mines...");
246 [new SimpleObject(oMetalLarge, 1,1, 0,4)]
248 stayClasses(clIsland, 4),
252 log("Creating stone mines...");
255 [new SimpleObject(oStoneSmall, 0,2, 0,4), new SimpleObject(oStoneLarge, 1,1, 0,4)],
256 [new SimpleObject(oStoneSmall, 2,5, 1,3)]
258 avoidClasses(clForest, 1, clPlayer, 20, clRock, 10, clWater, 1, clHill, 1),
261 log("Creating metal mines...");
264 [new SimpleObject(oMetalLarge, 1,1, 0,4)]
266 avoidClasses(clForest, 1, clPlayer, 20, clMetal, 10, clRock, 5, clWater, 1, clHill, 1),
274 [[new SimpleObject(aDecorativeRock, 1,3, 0,1)],
275 [new SimpleObject(aBush2, 1,2, 0,1), new SimpleObject(aBush1, 1,3, 0,2), new SimpleObject(aBush4, 1,2, 0,1), new SimpleObject(aBush3, 1,3, 0,2)]
278 scaleByMapSize(16, 262),
279 scaleByMapSize(40, 360)
281 avoidClasses(clWater, 2, clForest, 0, clPlayer, 0, clHill, 1)
289 [new SimpleObject(oFish, 2,3, 0,2)]
292 3*scaleByMapSize(5,20)
294 [avoidClasses(clIsland, 2, clFood, 10), stayClasses(clWater, 5)]
300 [new SimpleObject(oSheep, 5,7, 0,4)],
301 [new SimpleObject(oGoat, 2,4, 0,3)],
302 [new SimpleObject(oDeer, 2,4, 0,2)]
305 scaleByMapSize(5,20),
306 scaleByMapSize(5,20),
309 avoidClasses(clForest, 0, clPlayer, 8, clWater, 1, clFood, 10, clHill, 1)
315 [new SimpleObject(oBerryBush, 5,7, 0,4)]
320 avoidClasses(clWater, 3, clForest, 0, clPlayer, 20, clHill, 1, clFood, 10)
325 var types = [oDatePalm, oSDatePalm, oCarob, oFanPalm, oPoplar, oCypress];
326 createStragglerTrees(
328 avoidClasses(clForest, 1, clWater, 2, clPlayer, 12, clMetal, 6, clHill, 1),
332 createStragglerTrees(
334 stayClasses(clIsland, 4),
336 stragglerTrees * 10);
338 setSkySet("cumulus");
339 setSunColor(0.866667, 0.776471, 0.486275);
340 setWaterColor(0, 0.501961, 1);
341 setWaterTint(0.501961, 1, 1);
342 setWaterWaviness(4.0);
343 setWaterType("ocean");
344 setWaterMurkiness(0.49);
347 setFogThickness(0.25);
351 setPPSaturation(0.51);