1 RMS.LoadLibrary("rmgen");
3 var tPrimary = ["polar_snow_a"];
4 var tCliff = ["polar_cliff_a", "polar_cliff_b", "polar_cliff_snow"];
5 var tSecondary = "polar_snow_glacial";
6 var tHalfSnow = ["ice_01", "ice_dirt"];
7 var tSnowLimited = ["polar_snow_b", "polar_ice"];
8 var tDirt = "ice_dirt";
9 var tRoad = "polar_ice_b";
10 var tRoadWild = "polar_ice_cracked";
11 var tShore = "polar_ice_snow";
12 var tWater = "polar_ice_c";
14 var oArcticFox = "gaia/fauna_fox_arctic";
15 var oWolf = "trigger/fauna_wolf_snow_attack";
16 var oMuskox = "gaia/fauna_muskox";
17 var oWalrus = "gaia/fauna_walrus";
18 var oWhaleFin = "gaia/fauna_whale_fin";
19 var oWhaleHumpback = "gaia/fauna_whale_humpback";
20 var oFish = "gaia/fauna_fish";
21 var oStoneLarge = "gaia/geology_stonemine_medit_quarry";
22 var oStoneSmall = "gaia/geology_stone_alpine_a";
23 var oMetalLarge = "gaia/geology_metal_desert_badlands_slabs";
24 var oWood = "gaia/special_treasure_wood";
26 var aRockLarge = "actor|geology/stone_granite_med.xml";
27 var aRockMedium = "actor|geology/stone_granite_med.xml";
28 var aIceberg = "actor|props/special/eyecandy/iceberg.xml";
32 const numPlayers = getNumPlayers();
33 const mapSize = getMapSize();
35 var clPlayer = createTileClass();
36 var clWater = createTileClass();
37 var clDirt = createTileClass();
38 var clRock = createTileClass();
39 var clMetal = createTileClass();
40 var clHill = createTileClass();
41 var clFood = createTileClass();
42 var clBaseResource = createTileClass();
43 var clWolf = createTileClass();
46 var clForest = createTileClass();
48 var [playerIDs, playerX, playerZ] = radialPlayerPlacement();
52 for (let i = 0; i < numPlayers; ++i)
54 let id = playerIDs[i];
55 log("Creating base for player " + id + "...");
57 let fx = fractionToTiles(playerX[i]);
58 let fz = fractionToTiles(playerZ[i]);
59 let ix = Math.round(fx);
60 let iz = Math.round(fz);
62 addCivicCenterAreaToClass(ix, iz, clPlayer);
64 // Create the city patch
65 let cityRadius = scaleByMapSize(15,25)/3;
66 let placer = new ClumpPlacer(PI*cityRadius*cityRadius, 0.6, 0.3, 10, ix, iz);
67 let painter = new LayeredPainter([tRoadWild, tRoad], [1]);
68 createArea(placer, painter, null);
70 placeCivDefaultEntities(fx, fz, id, { 'iberWall': 'towers' });
72 placeDefaultChicken(fx, fz, clBaseResource, undefined, oMuskox);
75 let mAngle = randFloat(0, TWO_PI);
77 let mX = Math.round(fx + mDist * Math.cos(mAngle));
78 let mZ = Math.round(fz + mDist * Math.sin(mAngle));
79 let group = new SimpleGroup(
80 [new SimpleObject(oMetalLarge, 1, 1, 0, 0)],
81 true, clBaseResource, mX, mZ
83 createObjectGroup(group, 0);
86 mAngle += randFloat(PI/8, PI/4);
87 mX = Math.round(fx + mDist * Math.cos(mAngle));
88 mZ = Math.round(fz + mDist * Math.sin(mAngle));
89 group = new SimpleGroup(
90 [new SimpleObject(oStoneLarge, 1, 1, 0, 2)],
91 true, clBaseResource, mX, mZ
93 createObjectGroup(group, 0);
95 // Create wood treasure
97 let bbX = Math.round(fx + mDist * Math.cos(mAngle));
98 let bbZ = Math.round(fz + mDist * Math.sin(mAngle));
101 [new SimpleObject(oWood, 14,14, 0,3)],
102 true, clBaseResource, bbX, bbZ,
103 avoidClasses(clBaseResource, 4)
109 Math.round(fx + mDist * Math.cos(mAngle)),
110 Math.round(fz + mDist * Math.sin(mAngle)),
111 "structures/" + getCivCode(id-1) + "_market",
113 BUILDING_ORIENTATION);
117 log("Creating central lake...");
121 Math.floor(scaleByMapSize(5, 16)),
122 Math.floor(scaleByMapSize(35, 200)),
124 Math.round(fractionToTiles(0.5)),
125 Math.round(fractionToTiles(0.5)),
127 [Math.floor(mapSize * 0.17)]),
129 new LayeredPainter([tShore, tWater, tWater, tWater], [1, 4, 2]),
130 new SmoothElevationPainter(ELEVATION_SET, -4, 4),
133 avoidClasses(clPlayer, 20));
135 paintTerrainBasedOnHeight(3, Math.floor(scaleByMapSize(20, 40)), 0, tCliff);
136 paintTerrainBasedOnHeight(Math.floor(scaleByMapSize(20, 40)), 100, 3, tSnowLimited);
139 log("Creating small lakes...");
141 var playerConstraint = new AvoidTileClassConstraint(clPlayer, 20);
142 var waterConstraint = new AvoidTileClassConstraint(clWater, 8);
143 for (let x = 0; x < mapSize; ++x)
144 for (let z = 0; z < mapSize; ++z)
145 if (playerConstraint.allows(x, z) && waterConstraint.allows(x, z))
146 lakeAreas.push([x, z]);
148 var numLakes = scaleByMapSize(10, 16);
149 for (let i = 0; i < numLakes ; ++i)
151 let chosenPoint = pickRandom(lakeAreas);
158 Math.floor(scaleByMapSize(2, 4)),
159 Math.floor(scaleByMapSize(20, 140)),
164 new LayeredPainter([tShore, tWater, tWater], [1, 3]),
165 new SmoothElevationPainter(ELEVATION_SET, -5, 5),
168 avoidClasses(clPlayer, 20),
174 createBumps(avoidClasses(clWater, 2, clPlayer, 20));
177 log("Creating hills...");
179 [tPrimary, tPrimary, tSecondary],
180 avoidClasses(clPlayer, 20, clHill, 35),
181 clHill, scaleByMapSize(20, 240));
184 log("Creating dirt patches...");
185 createLayeredPatches(
186 [scaleByMapSize(3, 6), scaleByMapSize(5, 10), scaleByMapSize(8, 21)],
187 [[tDirt,tHalfSnow], [tHalfSnow,tSnowLimited]],
189 avoidClasses(clWater, 3, clDirt, 5, clPlayer, 12));
191 log("Creating glacier patches...");
193 [scaleByMapSize(2, 4), scaleByMapSize(3, 7), scaleByMapSize(5, 15)],
195 avoidClasses(clWater, 3, clDirt, 5, clPlayer, 12));
198 log("Creating stone mines...");
201 [new SimpleObject(oStoneSmall, 0,2, 0,4), new SimpleObject(oStoneLarge, 1,1, 0,4)],
202 [new SimpleObject(oStoneSmall, 2,5, 1,3)]
204 avoidClasses(clWater, 3, clPlayer, 20, clRock, 18, clHill, 2)
207 log("Creating metal mines...");
210 [new SimpleObject(oMetalLarge, 1,1, 0,4)]
212 avoidClasses(clWater, 3, clPlayer, 20, clMetal, 18, clRock, 5, clHill, 2),
218 [new SimpleObject(aRockMedium, 1,3, 0,1)],
220 new SimpleObject(aRockLarge, 1,2, 0,1),
221 new SimpleObject(aRockMedium, 1,3, 0,2)
225 scaleByMapSize(16, 262),
226 scaleByMapSize(8, 131),
228 avoidClasses(clWater, 0, clPlayer, 0));
232 [new SimpleObject(aIceberg, 1, 1, 1, 1)]
235 scaleByMapSize(8, 131)
237 [stayClasses(clWater, 4), avoidClasses(clHill, 2)]);
242 [new SimpleObject(oArcticFox, 1,2, 0,3)],
243 [new SimpleObject(oWolf, 4,6, 0,4)],
244 [new SimpleObject(oWalrus, 2,3, 0,2)],
245 [new SimpleObject(oMuskox, 2,3, 0,2)]
253 avoidClasses(clPlayer, 35, clFood, 16, clWater, 2, clMetal, 4, clRock, 4, clHill, 2)
258 [new SimpleObject(oWhaleFin, 1,2, 0,2)],
259 [new SimpleObject(oWhaleHumpback, 1,2, 0,2)]
262 scaleByMapSize(1, 6) * 3,
263 scaleByMapSize(1, 6) * 3,
265 [avoidClasses(clFood, 20, clHill, 5), stayClasses(clWater, 6)]
270 [new SimpleObject(oFish, 2,3, 0,2)]
275 [avoidClasses(clFood, 12, clHill, 5), stayClasses(clWater, 6)]
279 // Create trigger points where wolves spawn
280 createObjectGroupsDeprecated(
281 new SimpleGroup([new SimpleObject("trigger/trigger_point_A", 1, 1, 0, 0)], true, clWolf),
283 avoidClasses(clWater, 2, clMetal, 4, clRock, 4, clPlayer, 15, clHill, 2, clWolf, 20),
290 setSkySet("sunset 1");
291 setSunColor(0.8, 0.7, 0.6);
292 setTerrainAmbientColor(0.7, 0.6, 0.7);
293 setUnitsAmbientColor(0.6, 0.5, 0.6);
294 setSunElevation(randFloat(PI/24, PI/7));
298 setSkySet(pickRandom(["cumulus", "rain", "mountainous", "overcast", "rain", "stratus"]));
299 setSunElevation(randFloat(PI/9, PI/7));
302 setSunRotation(randFloat(0, TWO_PI));
304 setWaterColor(0.3, 0.3, 0.4);
305 setWaterTint(0.75, 0.75, 0.75);
306 setWaterMurkiness(0.92);
307 setWaterWaviness(0.5);
308 setWaterType("clap");
310 setFogThickness(0.76);
315 setPPSaturation(0.45);