diff --git a/binaries/data/mods/public/maps/random/alpine_valley.js b/binaries/data/mods/public/maps/random/alpine_valley.js index 0e103e9bb2..b11070b8f6 100644 --- a/binaries/data/mods/public/maps/random/alpine_valley.js +++ b/binaries/data/mods/public/maps/random/alpine_valley.js @@ -420,7 +420,7 @@ for (let size of [scaleByMapSize(2, 32), scaleByMapSize(3, 48), scaleByMapSize(5 RMS.SetProgress(65); log("Creating stone mines..."); -group = new SimpleGroup([new SimpleObject(oStoneSmall, 0,2, 0,4), new SimpleObject(oStoneLarge, 1,1, 0,4)], true, clRock); +var group = new SimpleGroup([new SimpleObject(oStoneSmall, 0,2, 0,4), new SimpleObject(oStoneLarge, 1,1, 0,4)], true, clRock); createObjectGroupsDeprecated(group, 0, avoidClasses(clForest, 1, clPlayer, 20, clRock, 10, clHill, 1), scaleByMapSize(4,16), 100 diff --git a/binaries/data/mods/public/maps/random/anatolian_plateau.js b/binaries/data/mods/public/maps/random/anatolian_plateau.js index 664ecc43d1..3eb8d19e47 100644 --- a/binaries/data/mods/public/maps/random/anatolian_plateau.js +++ b/binaries/data/mods/public/maps/random/anatolian_plateau.js @@ -177,7 +177,7 @@ createLayeredPatches( RMS.SetProgress(55); log("Creating stone mines..."); -group = new SimpleGroup([new SimpleObject(oStoneSmall, 0,2, 0,4), new SimpleObject(oStoneLarge, 1,1, 0,4)], true, clRock); +var group = new SimpleGroup([new SimpleObject(oStoneSmall, 0,2, 0,4), new SimpleObject(oStoneLarge, 1,1, 0,4)], true, clRock); createObjectGroupsDeprecated(group, 0, avoidClasses(clForest, 1, clPlayer, 20, clRock, 10, clHill, 1), scaleByMapSize(1,4), 100 diff --git a/binaries/data/mods/public/maps/random/archipelago.js b/binaries/data/mods/public/maps/random/archipelago.js index 34f20db881..edf29489d0 100644 --- a/binaries/data/mods/public/maps/random/archipelago.js +++ b/binaries/data/mods/public/maps/random/archipelago.js @@ -57,16 +57,54 @@ var clFood = createTileClass(); var clBaseResource = createTileClass(); var clLand = createTileClass(); +var landHeight = 3; +var shoreHeight = 1; + +var islandRadius = scaleByMapSize(22, 31); + var [playerIDs, playerX, playerZ] = radialPlayerPlacement(); +log("Creating player islands..."); +for (let i = 0; i < numPlayers; ++i) + createArea( + new ChainPlacer( + 2, + Math.floor(scaleByMapSize(5, 10)), + Math.floor(scaleByMapSize(25, 60)), + 1, + Math.floor(fractionToTiles(playerX[i])), + Math.floor(fractionToTiles(playerZ[i])), + 0, + [Math.floor(islandRadius)]), + new SmoothElevationPainter(ELEVATION_SET, landHeight, 4)); + +log("Creating random islands..."); +createAreas( + new ChainPlacer( + Math.floor(scaleByMapSize(4, 8)), + Math.floor(scaleByMapSize(8, 14)), + Math.floor(scaleByMapSize(25, 60)), + 0.07, + undefined, + undefined, + scaleByMapSize(30, 70)), + [ + new SmoothElevationPainter(ELEVATION_SET, landHeight, 4), + paintClass(clLand) + ], + null, + scaleByMapSize(1, 5) * randIntInclusive(5, 10)); + +paintTerrainBasedOnHeight(landHeight - 0.6, landHeight + 0.4, 3, tMainTerrain); +paintTerrainBasedOnHeight(shoreHeight, landHeight, 0, tShore); +paintTerrainBasedOnHeight(getMapBaseHeight(), shoreHeight, 2, tWater); + for (var i = 0; i < numPlayers; i++) { var id = playerIDs[i]; log("Creating base for player " + id + "..."); - var radius = scaleByMapSize(22,31); - var shoreRadius = 4; - var elevation = 3; + var radius = islandRadius; var hillSize = PI * radius * radius; // get the x and z in tiles @@ -75,19 +113,6 @@ for (var i = 0; i < numPlayers; i++) var ix = round(fx); var iz = round(fz); - // create the main island - var placer = new ChainPlacer(2, floor(scaleByMapSize(5, 10)), floor(scaleByMapSize(25, 60)), 1, ix, iz, 0, [floor(radius)]); - var terrainPainter = new LayeredPainter( - [tMainTerrain , tMainTerrain, tMainTerrain], // terrains - [1, shoreRadius] // widths - ); - var elevationPainter = new SmoothElevationPainter( - ELEVATION_SET, // type - elevation, // elevation - shoreRadius // blend radius - ); - createArea(placer, [terrainPainter, elevationPainter, paintClass(clPlayer)], null); - placeCivDefaultEntities(fx, fz, id, { 'iberWall': 'towers' }); placeDefaultChicken(fx, fz, clBaseResource); @@ -151,41 +176,12 @@ for (var i = 0; i < numPlayers; i++) createObjectGroup(group, 0, avoidClasses(clBaseResource,2)); placeDefaultDecoratives(fx, fz, aGrassShort, clBaseResource, radius); -} -log("Creating islands..."); -createAreas( - new ChainPlacer( - Math.floor(scaleByMapSize(4, 8)), - Math.floor(scaleByMapSize(8, 14)), - Math.floor(scaleByMapSize(25, 60)), - 0.07, - undefined, - undefined, - scaleByMapSize(30, 70)), - [ - new SmoothElevationPainter(ELEVATION_SET, 3, 4), - paintClass(clLand) - ], - null, - scaleByMapSize(1, 5) * randIntInclusive(5, 10)); - -paintTerrainBasedOnHeight(2.4, 3.4, 3, tMainTerrain); -paintTerrainBasedOnHeight(1, 3, 0, tShore); -paintTerrainBasedOnHeight(-8, 1, 2, tWater); - -//creating the city patches for the players -for (var i = 0; i < numPlayers; i++) -{ - var fx = fractionToTiles(playerX[i]); - var fz = fractionToTiles(playerZ[i]); - var ix = round(fx); - var iz = round(fz); // create the city patch var cityRadius = radius/3; - placer = new ClumpPlacer(PI*cityRadius*cityRadius, 0.6, 0.3, 10, ix, iz); + var placer = new ClumpPlacer(PI*cityRadius*cityRadius, 0.6, 0.3, 10, ix, iz); var painter = new LayeredPainter([tRoadWild, tRoad], [1]); - createArea(placer, painter, null); + createArea(placer, [painter, paintClass(clPlayer)]); } createBumps([avoidClasses(clPlayer, 10), stayClasses(clLand, 5)]); diff --git a/binaries/data/mods/public/maps/random/ardennes_forest.js b/binaries/data/mods/public/maps/random/ardennes_forest.js index 4f7f683ad0..bd0d8ad87d 100644 --- a/binaries/data/mods/public/maps/random/ardennes_forest.js +++ b/binaries/data/mods/public/maps/random/ardennes_forest.js @@ -134,9 +134,6 @@ for (var i=0; i < numPlayers; i++) var citySize = 250; - var placer = new ClumpPlacer(citySize, 0.95, 0.3, 0.1, ix, iz); - createArea(placer, [paintClass(clPlayer)], null); - // Create the city patch var placer = new ClumpPlacer(citySize * 0.4, 0.6, 0.05, 10, ix, iz); var painter = new TerrainPainter([tCity]); @@ -195,6 +192,12 @@ for (var i=0; i < numPlayers; i++) } +log("Marking player territory larger than the city patch..."); +for (let i = 0; i < numPlayers; ++i) + createArea( + new ClumpPlacer(250, 0.95, 0.3, 0.1, Math.floor(playerX[i]), Math.floor(playerZ[i])), + paintClass(clPlayer)); + RMS.SetProgress(30); log("Creating hills..."); diff --git a/binaries/data/mods/public/maps/random/atlas_mountains.js b/binaries/data/mods/public/maps/random/atlas_mountains.js index 8e5820c753..8ae7c22282 100644 --- a/binaries/data/mods/public/maps/random/atlas_mountains.js +++ b/binaries/data/mods/public/maps/random/atlas_mountains.js @@ -228,7 +228,7 @@ createFood ); log("Creating food treasures..."); -group = new SimpleGroup( +var group = new SimpleGroup( [new SimpleObject(oFood, 2,3, 0,2)], true, clTreasure ); diff --git a/binaries/data/mods/public/maps/random/cantabrian_highlands.js b/binaries/data/mods/public/maps/random/cantabrian_highlands.js index 0d67497730..faf4892a6b 100644 --- a/binaries/data/mods/public/maps/random/cantabrian_highlands.js +++ b/binaries/data/mods/public/maps/random/cantabrian_highlands.js @@ -57,16 +57,51 @@ var clMetal = createTileClass(); var clFood = createTileClass(); var clBaseResource = createTileClass(); +var playerHillElevation = 20; + +var rampDist = scaleByMapSize(15, 25); +var rampLength = 15; +var rampWidth = 12; +var rampOffset = 3; + var [playerIDs, playerX, playerZ, playerAngle] = radialPlayerPlacement(); +log("Creating player hills and ramps..."); +for (let i = 0; i < numPlayers; ++i) +{ + let fx = fractionToTiles(playerX[i]); + let fz = fractionToTiles(playerZ[i]); + + createArea( + new ClumpPlacer(diskArea(scaleByMapSize(15, 25)), 0.95, 0.6, 10, Math.round(fx), Math.round(fz)), + [ + new LayeredPainter([tCliff, tHill], [2]), + new SmoothElevationPainter(ELEVATION_SET, playerHillElevation, 2), + paintClass(clPlayer) + ], + null); + + let rampAngle = playerAngle[i] + Math.PI * (1 + randFloat(-1, 1) / 8); + createRamp( + Math.round(fx + (rampDist + rampLength) * Math.cos(rampAngle)), + Math.round(fz + (rampDist + rampLength) * Math.sin(rampAngle)), + Math.round(fx + (rampDist - rampOffset) * Math.cos(rampAngle)), + Math.round(fz + (rampDist - rampOffset) * Math.sin(rampAngle)), + 3, + playerHillElevation, + rampWidth, + 2, + tHill, + tCliff, + clPlayer); +} + for (var i = 0; i < numPlayers; i++) { var id = playerIDs[i]; log("Creating base for player " + id + "..."); var radius = scaleByMapSize(15,25); - var cliffRadius = 2; - var elevation = 20; // get the x and z in tiles var fx = fractionToTiles(playerX[i]); @@ -74,37 +109,9 @@ for (var i = 0; i < numPlayers; i++) var ix = round(fx); var iz = round(fz); - // calculate size based on the radius - var hillSize = PI * radius * radius; - - // create the hill - var placer = new ClumpPlacer(hillSize, 0.95, 0.6, 10, ix, iz); - var terrainPainter = new LayeredPainter( - [tCliff, tHill], // terrains - [cliffRadius] // widths - ); - var elevationPainter = new SmoothElevationPainter( - ELEVATION_SET, // type - elevation, // elevation - cliffRadius // blend radius - ); - createArea(placer, [terrainPainter, elevationPainter, paintClass(clPlayer)], null); - - // create the ramp - var rampAngle = playerAngle[i] + PI + randFloat(-PI/8, PI/8); - var rampDist = radius; - var rampLength = 15; - var rampWidth = 12; - var rampX1 = round(fx + (rampDist + rampLength) * cos(rampAngle)); - var rampZ1 = round(fz + (rampDist + rampLength) * sin(rampAngle)); - var rampX2 = round(fx + (rampDist - 3) * cos(rampAngle)); - var rampZ2 = round(fz + (rampDist - 3) * sin(rampAngle)); - - createRamp (rampX1, rampZ1, rampX2, rampZ2, 3, 20, rampWidth, 2, tHill, tCliff, clPlayer); - // create the city patch var cityRadius = radius/3; - placer = new ClumpPlacer(PI*cityRadius*cityRadius, 0.6, 0.3, 10, ix, iz); + var placer = new ClumpPlacer(PI*cityRadius*cityRadius, 0.6, 0.3, 10, ix, iz); var painter = new LayeredPainter([tRoadWild, tRoad], [1]); createArea(placer, painter, null); @@ -178,7 +185,7 @@ var waterAreas = createAreas( RMS.SetProgress(15); log("Creating reeds..."); -group = new SimpleGroup( +var group = new SimpleGroup( [new SimpleObject(aReeds, 5,10, 0,4), new SimpleObject(aLillies, 0,1, 0,4)], true ); createObjectGroupsByAreasDeprecated(group, 0, diff --git a/binaries/data/mods/public/maps/random/canyon.js b/binaries/data/mods/public/maps/random/canyon.js index b802c3d5f0..18a6a53b50 100644 --- a/binaries/data/mods/public/maps/random/canyon.js +++ b/binaries/data/mods/public/maps/random/canyon.js @@ -60,36 +60,40 @@ var clLand = createTileClass(); var landHeight = 3; var hillHeight = 30; +var playerCanyonRadius = scaleByMapSize(18, 32); + initTerrain(tMainTerrain); var [playerIDs, playerX, playerZ] = radialPlayerPlacement(); +log("Reserving space for the players, their initial forests and some less space therein without trees..."); +for (let i = 0; i < numPlayers; ++i) + for (let j = 1; j <= 2; ++j) + createArea( + new ClumpPlacer( + diskArea(playerCanyonRadius / j), + 0.65, + 0.1, + 10, + Math.round(fractionToTiles(playerX[i])), + Math.round(fractionToTiles(playerZ[i]))), + [ + new LayeredPainter([tMainTerrain, tMainTerrain], [2]), + new SmoothElevationPainter(ELEVATION_SET, landHeight, 2), + paintClass(j == 1 ? clLand : clPlayer) + ], + null); + +var radius = playerCanyonRadius; for (var i = 0; i < numPlayers; i++) { var id = playerIDs[i]; log("Creating base for player " + id + "..."); - var radius = scaleByMapSize(18,32); - var cliffRadius = 2; - var elevation = 20; - var hillSize = PI * radius * radius; - // get the x and z in tiles var fx = fractionToTiles(playerX[i]); var fz = fractionToTiles(playerZ[i]); var ix = round(fx); var iz = round(fz); - // create the hill - var placer = new ClumpPlacer(hillSize, 0.65, 0.1, 10, ix, iz); - var terrainPainter = new LayeredPainter( - [tMainTerrain, tMainTerrain], // terrains - [cliffRadius] // widths - ); - var elevationPainter = new SmoothElevationPainter( - ELEVATION_SET, // type - 3, // elevation - cliffRadius // blend radius - ); - createArea(placer, [terrainPainter, elevationPainter, paintClass(clLand)], null); placeCivDefaultEntities(fx, fz, id); @@ -144,13 +148,6 @@ for (var i = 0; i < numPlayers; i++) createObjectGroup(group, 0, avoidClasses(clBaseResource,2)); placeDefaultDecoratives(fx, fz, aGrassShort, clBaseResource, radius); - - // create the city patch - var cityRadius = radius/2; - placer = new ClumpPlacer(PI*cityRadius*cityRadius, 0.6, 0.3, 10, fractionToTiles(playerX[i]), fractionToTiles(playerZ[i])); - var painter = new LayeredPainter([tMainTerrain, tMainTerrain], [1]); - createArea(placer, [painter, paintClass(clPlayer)], null); - } log("Creating center area..."); @@ -256,7 +253,7 @@ for (let i = 0; i < numPlayers; ++i) { // create the city patch var cityRadius = radius/3; - placer = new ClumpPlacer(PI*cityRadius*cityRadius, 0.6, 0.3, 10, fractionToTiles(playerX[i]), fractionToTiles(playerZ[i])); + var placer = new ClumpPlacer(PI*cityRadius*cityRadius, 0.6, 0.3, 10, fractionToTiles(playerX[i]), fractionToTiles(playerZ[i])); var painter = new LayeredPainter([tRoad, tRoad], [1]); createArea(placer, [painter, paintClass(clPlayer)], null); @@ -370,7 +367,7 @@ createDecoration ); log("Creating actor trees..."); -group = new SimpleGroup( +var group = new SimpleGroup( [new SimpleObject(aTree, 1,1, 0,1)], true ); diff --git a/binaries/data/mods/public/maps/random/continent.js b/binaries/data/mods/public/maps/random/continent.js index 085f8b8b42..44fd94993e 100644 --- a/binaries/data/mods/public/maps/random/continent.js +++ b/binaries/data/mods/public/maps/random/continent.js @@ -74,6 +74,23 @@ createArea( var [playerIDs, playerX, playerZ] = radialPlayerPlacement(0.25); +log("Ensuring initial player land..."); +for (let i = 0; i < numPlayers; ++i) + createArea( + new ChainPlacer( + 2, + Math.floor(scaleByMapSize(5, 9)), + Math.floor(scaleByMapSize(5, 20)), + 1, + Math.round(fractionToTiles(playerX[i])), + Math.round(fractionToTiles(playerZ[i])), + 0, + [Math.floor(scaleByMapSize(23, 50))]), + [ + new SmoothElevationPainter(ELEVATION_SET, 3, 4), + paintClass(clLand) + ]); + for (var i = 0; i < numPlayers; i++) { var id = playerIDs[i]; @@ -90,14 +107,6 @@ for (var i = 0; i < numPlayers; i++) iz = round(fz); addCivicCenterAreaToClass(ix, iz, clPlayer); - var placer = new ChainPlacer(2, floor(scaleByMapSize(5, 9)), floor(scaleByMapSize(5, 20)), 1, ix, iz, 0, [floor(scaleByMapSize(23, 50))]); - var elevationPainter = new SmoothElevationPainter( - ELEVATION_SET, // type - 3, // elevation - 4 // blend radius - ); - createArea(placer, [elevationPainter, paintClass(clLand)], null); - placeCivDefaultEntities(fx, fz, id); placeDefaultChicken(fx, fz, clBaseResource); diff --git a/binaries/data/mods/public/maps/random/extinct_volcano.js b/binaries/data/mods/public/maps/random/extinct_volcano.js index d6b40e6cd2..1e99460a36 100644 --- a/binaries/data/mods/public/maps/random/extinct_volcano.js +++ b/binaries/data/mods/public/maps/random/extinct_volcano.js @@ -71,19 +71,15 @@ var clTower = createTileClass(); var clRain = createTileClass(); var ccMountainHeight = 25; +var ccMountainSize = scaleByMapSize(15, 25); var [playerIDs, playerX, playerZ] = radialPlayerPlacement(); +log("Creating CC mountains..."); for (let i = 0; i < numPlayers; ++i) { - let id = playerIDs[i]; - log("Creating base for player " + id + "..."); - let radius = scaleByMapSize(15, 25); - - let fx = fractionToTiles(playerX[i]); - let fz = fractionToTiles(playerZ[i]); - let ix = Math.round(fx); - let iz = Math.round(fz); + let ix = Math.round(fractionToTiles(playerX[i])); + let iz = Math.round(fractionToTiles(playerZ[i])); // This one consists of many bumps, creating an omnidirectional ramp createMountain( @@ -99,20 +95,27 @@ for (let i = 0; i < numPlayers; ++i) 14); // Flatten the initial CC area - let hillSize = PI * radius * radius; createArea( - new ClumpPlacer(hillSize, 0.95, 0.6, 10, ix, iz), + new ClumpPlacer(diskArea(scaleByMapSize(15, 25)), 0.95, 0.6, 10, ix, iz), [ - new LayeredPainter([tHillVeryDark, tHillMedium1], [radius]), - new SmoothElevationPainter(ELEVATION_SET, ccMountainHeight, radius), + new LayeredPainter([tHillVeryDark, tHillMedium1], [ccMountainSize]), + new SmoothElevationPainter(ELEVATION_SET, ccMountainHeight, ccMountainSize), paintClass(clPlayer) ], null); +} + +for (let i = 0; i < numPlayers; ++i) +{ + let id = playerIDs[i]; + log("Creating base for player " + id + "..."); + + let fx = fractionToTiles(playerX[i]); + let fz = fractionToTiles(playerZ[i]); // Create the city patch - let cityRadius = radius / 3; createArea( - new ClumpPlacer(PI * cityRadius * cityRadius, 0.6, 0.3, 10, ix, iz), + new ClumpPlacer(diskArea(ccMountainSize / 3), 0.6, 0.3, 10, Math.round(fx), Math.round(fz)), new LayeredPainter([tRoadWild, tRoad], [1]), null); @@ -156,7 +159,7 @@ for (let i = 0; i < numPlayers; ++i) 0); // Create starting trees - let num = Math.floor(hillSize / 60); + let num = Math.floor(diskArea(ccMountainSize) / 60); let tries = 20; for (let x = 0; x < tries; ++x) { diff --git a/binaries/data/mods/public/maps/random/islands.js b/binaries/data/mods/public/maps/random/islands.js index 0fe1b8038b..dd85909337 100644 --- a/binaries/data/mods/public/maps/random/islands.js +++ b/binaries/data/mods/public/maps/random/islands.js @@ -32,6 +32,7 @@ const oStoneLarge = g_Gaia.stoneLarge; const oStoneSmall = g_Gaia.stoneSmall; const oMetalLarge = g_Gaia.metalLarge; const oWood = "gaia/special_treasure_wood"; +const oDock = "skirmish/structures/default_dock"; const aGrass = g_Decoratives.grass; const aGrassShort = g_Decoratives.grassShort; @@ -47,6 +48,7 @@ InitMap(); const numPlayers = getNumPlayers(); const mapSize = getMapSize(); +const mapCenter = getMapCenter(); var clPlayer = createTileClass(); var clHill = createTileClass(); @@ -58,35 +60,38 @@ var clFood = createTileClass(); var clBaseResource = createTileClass(); var clLand = createTileClass(); +var playerIslandRadius = scaleByMapSize(20, 29); + var [playerIDs, playerX, playerZ, playerAngle] = radialPlayerPlacement(); +log("Creating player islands and docks..."); +for (let i = 0; i < numPlayers; i++) +{ + let playerPos = new Vector2D(playerX[i], playerZ[i]).mult(mapSize); + createArea( + new ClumpPlacer(diskArea(playerIslandRadius), 0.8, 0.1, 10, playerPos.x, playerPos.y), + [ + new LayeredPainter([tMainTerrain , tMainTerrain, tMainTerrain], [1, 6]), + new SmoothElevationPainter(ELEVATION_SET, 3, 6), + paintClass(clPlayer) + ]); + + let dockLocation = getTIPIADBON([playerPos.x, playerPos.y], [mapCenter.x, mapCenter.y], [-3 , 2.6], 0.5, 3); + placeObject(dockLocation[0], dockLocation[1], oDock, playerIDs[i], playerAngle[i] + Math.PI); +} + for (var i = 0; i < numPlayers; i++) { var id = playerIDs[i]; log("Creating base for player " + id + "..."); - var radius = scaleByMapSize(20,29); - var shoreRadius = 6; - var elevation = 3; + let radius = playerIslandRadius; - var hillSize = PI * radius * radius; // get the x and z in tiles var fx = fractionToTiles(playerX[i]); var fz = fractionToTiles(playerZ[i]); var ix = round(fx); var iz = round(fz); - // create the hill - var placer = new ClumpPlacer(hillSize, 0.80, 0.1, 10, ix, iz); - var terrainPainter = new LayeredPainter( - [tMainTerrain , tMainTerrain, tMainTerrain], // terrains - [1, shoreRadius] // widths - ); - var elevationPainter = new SmoothElevationPainter( - ELEVATION_SET, // type - elevation, // elevation - shoreRadius // blend radius - ); - createArea(placer, [terrainPainter, elevationPainter, paintClass(clPlayer)], null); placeCivDefaultEntities(fx, fz, id, { 'iberWall': 'towers' }); @@ -152,11 +157,6 @@ for (var i = 0; i < numPlayers; i++) createObjectGroup(group, 0, avoidClasses(clBaseResource,2)); placeDefaultDecoratives(fx, fz, aGrassShort, clBaseResource, radius); - - //create docks - var dockLocation = getTIPIADBON([ix, iz], [mapSize / 2, mapSize / 2], [-3 , 2.6], 0.5, 3); - if (dockLocation !== undefined) - placeObject(dockLocation[0], dockLocation[1], "structures/" + getCivCode(id-1) + "_dock", id, playerAngle[i] + PI); } var landAreas = []; @@ -263,8 +263,7 @@ for (var i = 0; i < numPlayers; i++) var ix = round(fx); var iz = round(fz); // create the city patch - var cityRadius = radius/3; - placer = new ClumpPlacer(PI*cityRadius*cityRadius, 0.6, 0.3, 10, ix, iz); + var placer = new ClumpPlacer(diskArea(playerIslandRadius / 3), 0.6, 0.3, 10, ix, iz); var painter = new LayeredPainter([tRoadWild, tRoad], [1]); createArea(placer, painter, null); } diff --git a/binaries/data/mods/public/maps/random/lake.js b/binaries/data/mods/public/maps/random/lake.js index 015eb42214..5b750e0ac4 100644 --- a/binaries/data/mods/public/maps/random/lake.js +++ b/binaries/data/mods/public/maps/random/lake.js @@ -59,6 +59,13 @@ initTerrain(tMainTerrain); var [playerIDs, playerX, playerZ] = radialPlayerPlacement(); +log("Preventing water in player territory..."); +for (let i = 0; i < numPlayers; ++i) + addCivicCenterAreaToClass( + Math.round(fractionToTiles(playerX[i])), + Math.round(fractionToTiles(playerZ[i])), + clPlayer); + for (var i = 0; i < numPlayers; i++) { var id = playerIDs[i]; @@ -73,7 +80,6 @@ for (var i = 0; i < numPlayers; i++) var fz = fractionToTiles(playerZ[i]); var ix = round(fx); var iz = round(fz); - addCivicCenterAreaToClass(ix, iz, clPlayer); placeCivDefaultEntities(fx, fz, id); @@ -129,8 +135,6 @@ for (var i = 0; i < numPlayers; i++) placeDefaultDecoratives(fx, fz, aGrassShort, clBaseResource, radius); } -RMS.SetProgress(20); - log("Creating the lake...") createArea( new ChainPlacer( diff --git a/binaries/data/mods/public/maps/random/latium.js b/binaries/data/mods/public/maps/random/latium.js index 7aa62d8cee..cb8fb0e4d0 100644 --- a/binaries/data/mods/public/maps/random/latium.js +++ b/binaries/data/mods/public/maps/random/latium.js @@ -383,7 +383,7 @@ for (var i = 0; i < numPlayers; ++i) RMS.SetProgress(40); log("Creating bushes..."); -group = new SimpleGroup( +var group = new SimpleGroup( [new SimpleObject(aBushSmall, 0,2, 0,2), new SimpleObject(aBushSmallDry, 0,2, 0,2), new SimpleObject(aBushMed, 0,1, 0,2), new SimpleObject(aBushMedDry, 0,1, 0,2)] ); diff --git a/binaries/data/mods/public/maps/random/migration.js b/binaries/data/mods/public/maps/random/migration.js index 8b74b096c3..be4b8f18cc 100644 --- a/binaries/data/mods/public/maps/random/migration.js +++ b/binaries/data/mods/public/maps/random/migration.js @@ -30,6 +30,7 @@ const oStoneLarge = g_Gaia.stoneLarge; const oStoneSmall = g_Gaia.stoneSmall; const oMetalLarge = g_Gaia.metalLarge; const oWood = "gaia/special_treasure_wood"; +const oDock = "skirmish/structures/default_dock"; const aGrass = g_Decoratives.grass; const aGrassShort = g_Decoratives.grassShort; @@ -46,6 +47,7 @@ InitMap(); const numPlayers = getNumPlayers(); const mapSize = getMapSize(); const mapArea = getMapArea(); +const mapCenter = getMapCenter(); var clPlayer = createTileClass(); var clHill = createTileClass(); @@ -61,19 +63,37 @@ var landHeight = 3; var playerIDs = sortAllPlayers(); -// place players var playerX = []; var playerZ = []; var playerAngle = []; -var startAngle = PI/2 + PI/14; -for (var i = 0; i < numPlayers; i++) +var startAngle = 4/7 * Math.PI; +for (let i = 0; i < numPlayers; ++i) { playerAngle[i] = startAngle - (i+1)*(PI+ PI/7)/(numPlayers+1); playerX[i] = 0.5 + 0.35*cos(playerAngle[i]); playerZ[i] = 0.5 + 0.35*sin(playerAngle[i]); } +log("Creating player islands and docks..."); +for (let i = 0; i < numPlayers; ++i) +{ + let ix = Math.round(fractionToTiles(playerX[i])); + let iz = Math.round(fractionToTiles(playerZ[i])); + + createArea( + new ClumpPlacer(diskArea(scaleByMapSize(15, 25)), 0.8, 0.1, 10, ix, iz), + [ + new LayeredPainter([tWater, tShore, tMainTerrain], [1, 4]), + new SmoothElevationPainter(ELEVATION_SET, landHeight, 4), + paintClass(clPlayer) + ]); + + let dockLocation = getTIPIADBON([ix, iz], [mapCenter.x, mapCenter.y], [-3 , 2.6], 0.5, 3); + placeObject(dockLocation[0], dockLocation[1], oDock, playerIDs[i], playerAngle[i] + Math.PI); +} +RMS.SetProgress(10); + for (var i = 0; i < numPlayers; i++) { var id = playerIDs[i]; @@ -171,20 +191,6 @@ for (var i = 0; i < numPlayers; i++) createObjectGroup(group, 0, avoidClasses(clBaseResource,2)); placeDefaultDecoratives(fx, fz, aGrassShort, clBaseResource, radius); - - let dockLocation = getTIPIADBON([ix, iz], [mapSize / 2, mapSize / 2], [-3 , 2.6], 0.5, 3); - if (dockLocation === undefined) - { - warn("Could not place dock for player " + playerIDs[i]) - continue; - } - - placeObject( - dockLocation[0], - dockLocation[1], - "structures/" + getCivCode(playerIDs[i] - 1) + "_dock", - playerIDs[i], - playerAngle[i] + Math.PI); } RMS.SetProgress(15); diff --git a/binaries/data/mods/public/maps/random/neareastern_badlands.js b/binaries/data/mods/public/maps/random/neareastern_badlands.js index 5f9693023f..9f2729097e 100644 --- a/binaries/data/mods/public/maps/random/neareastern_badlands.js +++ b/binaries/data/mods/public/maps/random/neareastern_badlands.js @@ -53,6 +53,17 @@ var clBaseResource = createTileClass(); var [playerIDs, playerX, playerZ] = radialPlayerPlacement(); +for (let i = 0; i < numPlayers; ++i) + createArea( + new ClumpPlacer( + diskArea(scaleByMapSize(15, 25)), + 0.9, + 0.5, + 10, + Math.round(fractionToTiles(playerX[i])), + Math.round(fractionToTiles(playerZ[i]))), + paintClass(clPlayer)); + for (var i = 0; i < numPlayers; i++) { var id = playerIDs[i]; @@ -67,13 +78,6 @@ for (var i = 0; i < numPlayers; i++) var ix = round(fx); var iz = round(fz); - // calculate size based on the radius - var size = PI * radius * radius; - - // create the player area - var placer = new ClumpPlacer(size, 0.9, 0.5, 10, ix, iz); - createArea(placer, paintClass(clPlayer), null); - // create the city patch var cityRadius = 10; placer = new ClumpPlacer(PI*cityRadius*cityRadius, 0.6, 0.3, 10, ix, iz); diff --git a/binaries/data/mods/public/maps/random/oasis.js b/binaries/data/mods/public/maps/random/oasis.js index 4e236eaa60..640455f95f 100644 --- a/binaries/data/mods/public/maps/random/oasis.js +++ b/binaries/data/mods/public/maps/random/oasis.js @@ -129,12 +129,19 @@ for (var i = 0; i < numPlayers; i++) true, clBaseResource, mX, mZ ); createObjectGroup(group, 0); +} + +log("Creating small oasis near the players...") +var forestDist = scaleByMapSize(15, 25) * 1.2; +for (let i = 0; i < numPlayers; ++i) +{ + let fx = fractionToTiles(playerX[i]); + let fz = fractionToTiles(playerZ[i]); // Create starting batches of wood let forestX = 0; let forestY = 0; let forestAngle = 0 - let forestDist = radius * 1.2; do { forestAngle = Math.PI / 3 * randFloat(1, 2); diff --git a/binaries/data/mods/public/maps/random/polar_sea.js b/binaries/data/mods/public/maps/random/polar_sea.js index 7bc3cadc27..4504e221be 100644 --- a/binaries/data/mods/public/maps/random/polar_sea.js +++ b/binaries/data/mods/public/maps/random/polar_sea.js @@ -22,6 +22,7 @@ var oStoneLarge = "gaia/geology_stonemine_medit_quarry"; var oStoneSmall = "gaia/geology_stone_alpine_a"; var oMetalLarge = "gaia/geology_metal_desert_badlands_slabs"; var oWood = "gaia/special_treasure_wood"; +var oMarket = "skirmish/structures/default_market"; var aRockLarge = "actor|geology/stone_granite_med.xml"; var aRockMedium = "actor|geology/stone_granite_med.xml"; @@ -42,13 +43,8 @@ var clFood = createTileClass(); var clBaseResource = createTileClass(); var clWolf = createTileClass(); -// Expected by rmgen1 -var clForest = createTileClass(); - var [playerIDs, playerX, playerZ] = radialPlayerPlacement(); -RMS.SetProgress(20); - for (let i = 0; i < numPlayers; ++i) { let id = playerIDs[i]; @@ -108,7 +104,7 @@ for (let i = 0; i < numPlayers; ++i) placeObject( Math.round(fx + mDist * Math.cos(mAngle)), Math.round(fz + mDist * Math.sin(mAngle)), - "structures/" + getCivCode(id-1) + "_market", + oMarket, id, BUILDING_ORIENTATION); } diff --git a/binaries/data/mods/public/maps/random/river_archipelago.js b/binaries/data/mods/public/maps/random/river_archipelago.js index e7727ef95f..dc0739af21 100644 --- a/binaries/data/mods/public/maps/random/river_archipelago.js +++ b/binaries/data/mods/public/maps/random/river_archipelago.js @@ -100,6 +100,17 @@ var [playerIDs, playerX, playerZ] = playerPlacementLine(false, 0.5, 1 - stripWid // Either left vs right or top vs bottom playerIDs = randBool() ? sortAllPlayers() : primeSortAllPlayers(); +log("Ensuring player territory..."); +var playerRadius = scaleByMapSize(12, 20); +for (let i = 0; i < numPlayers; ++i) + createArea( + new ChainPlacer(1, 6, 40, 1, Math.round(fractionToTiles(playerX[i])), Math.round(fractionToTiles(playerZ[i])), 0, [Math.floor(playerRadius)]), + [ + new LayeredPainter([tGrass, tGrass, tGrass], [1, 4]), + new SmoothElevationPainter(ELEVATION_SET, 3, 4), + paintClass(clPlayerTerritory) + ]); + for (let i = 0; i < numPlayers; ++i) { log("Creating base for player " + playerIDs[i] + "..."); @@ -112,15 +123,6 @@ for (let i = 0; i < numPlayers; ++i) addCivicCenterAreaToClass(ix, iz, clPlayer); - // Create the main island - createArea( - new ChainPlacer(1, 6, 40, 1, ix, iz, 0, [Math.floor(radius)]), - [ - new LayeredPainter([tGrass, tGrass, tGrass], [1, 4]), - new SmoothElevationPainter(ELEVATION_SET, 3, 4), - paintClass(clPlayerTerritory) - ], null); - // Create the city patch let cityRadius = radius / 3; createArea( diff --git a/binaries/data/mods/public/maps/random/snowflake_searocks.js b/binaries/data/mods/public/maps/random/snowflake_searocks.js index cac6e1419a..c70f4c946b 100644 --- a/binaries/data/mods/public/maps/random/snowflake_searocks.js +++ b/binaries/data/mods/public/maps/random/snowflake_searocks.js @@ -79,16 +79,13 @@ function initIsConnected() function createIsland(islandID, size, tileClass) { - let hillSize = diskArea(playerIslandRadius) * size; createArea( - new ClumpPlacer(hillSize, 0.95, 0.6, 10, islandX[islandID], islandZ[islandID]), + new ClumpPlacer(size * diskArea(playerIslandRadius), 0.95, 0.6, 10, islandX[islandID], islandZ[islandID]), [ new LayeredPainter([tCliff, tHill], [2]), new SmoothElevationPainter(ELEVATION_SET, islandHeight, 2), paintClass(tileClass) - ], - null); - return hillSize; + ]); } function createIslandAtRadialLocation(playerID, islandID, playerIDOffset, distFromCenter, islandRadius) @@ -217,6 +214,14 @@ else if (mapSize <= 320) else createSnowflakeSearockWithCenter(numPlayers < 6 ? "large1" : "large2"); +log("Creating player islands..."); +for (let i = 0; i < numPlayers; ++i) +{ + islandX[i] = Math.round(fractionToTiles(playerX[i])); + islandZ[i] = Math.round(fractionToTiles(playerZ[i])); + createIsland(i, 1, clPlayer); +} + for (var i = 0; i < numPlayers; ++i) { var id = playerIDs[i]; @@ -228,11 +233,6 @@ for (var i = 0; i < numPlayers; ++i) var ix = round(fx); var iz = round(fz); - islandX[i] = ix; - islandZ[i] = iz; - - let hillSize = createIsland(i, 1, clPlayer); - // create the city patch var cityRadius = playerIslandRadius/3; var placer = new ClumpPlacer(PI*cityRadius*cityRadius, 0.6, 0.3, 10, ix, iz); @@ -279,7 +279,7 @@ for (var i = 0; i < numPlayers; ++i) createObjectGroup(group, 0); // create starting trees - var num = floor(hillSize / 60); + var num = floor(scaleByMapSize(10, 50)); var tAngle = randFloat(-PI/3, 4*PI/3); var tDist = 11; var tX = round(fx + tDist * cos(tAngle)); @@ -360,7 +360,7 @@ for (let type of types) RMS.SetProgress(55); log("Creating stone mines..."); -group = new SimpleGroup([new SimpleObject(oStoneSmall, 0,2, 0,4), new SimpleObject(oStoneLarge, 1,1, 0,4)], true, clRock); +var group = new SimpleGroup([new SimpleObject(oStoneSmall, 0,2, 0,4), new SimpleObject(oStoneLarge, 1,1, 0,4)], true, clRock); createObjectGroupsDeprecated(group, 0, [avoidClasses(clForest, 1, clPlayer, 10, clRock, 10, clHill, 1), stayClasses(clLand, 5)], 5*scaleByMapSize(4,16), 100 diff --git a/binaries/data/mods/public/maps/random/syria.js b/binaries/data/mods/public/maps/random/syria.js index e3cdf32882..b9b3a7a141 100644 --- a/binaries/data/mods/public/maps/random/syria.js +++ b/binaries/data/mods/public/maps/random/syria.js @@ -47,6 +47,26 @@ var clGrass = createTileClass(); var [playerIDs, playerX, playerZ] = radialPlayerPlacement(); +for (let i = 0; i < numPlayers; ++i) +{ + let ix = Math.round(fractionToTiles(playerX[i])); + let iz = Math.round(fractionToTiles(playerZ[i])); + + log("Marking player territory larger than the city patch..."); + createArea( + new ClumpPlacer(diskArea(scaleByMapSize(15, 25)), 0.9, 0.5, 10, ix, iz), + paintClass(clPlayer)); + + log("Creating big grass patches surrounding the city patches..."); + createArea( + new ChainPlacer(2, Math.floor(scaleByMapSize(5, 12)), Math.floor(scaleByMapSize(25, 60)), 1, ix, iz, 0, [Math.floor(scaleByMapSize(16, 30))]), + [ + new LayeredPainter([tGrassSands, tGrass], [3]), + paintClass(clGrass) + ]); +} +RMS.SetProgress(10); + for (var i = 0; i < numPlayers; i++) { var id = playerIDs[i]; @@ -61,22 +81,8 @@ for (var i = 0; i < numPlayers; i++) var ix = round(fx); var iz = round(fz); - // calculate size based on the radius - var size = PI * radius * radius; - - // create the player area - var placer = new ClumpPlacer(size, 0.9, 0.5, 10, ix, iz); - createArea(placer, paintClass(clPlayer), null); - - // create the grass patches - var grassRadius = floor(scaleByMapSize(16 ,30)); - placer = new ChainPlacer(2, floor(scaleByMapSize(5, 12)), floor(scaleByMapSize(25, 60)), 1, ix, iz, 0, [grassRadius]); - var painter = new LayeredPainter([tGrassSands, tGrass], [3]); - createArea(placer, [painter, paintClass(clGrass)], null); - // create the city patch - var cityRadius = 10; - placer = new ClumpPlacer(PI*cityRadius*cityRadius, 0.6, 0.3, 10, ix, iz); + var placer = new ClumpPlacer(diskArea(10), 0.6, 0.3, 10, ix, iz); var painter = new LayeredPainter([tRoadWild, tRoad], [3]); createArea(placer, painter, null); @@ -133,7 +139,7 @@ for (var i = 0; i < numPlayers; i++) createObjectGroup(group, 0, avoidClasses(clBaseResource,2)); } -RMS.SetProgress(10); +RMS.SetProgress(20); log("Creating bumps..."); createAreas(