RM generation: improve metal mines generation
Introduces a new helper to place mines. use it on 'Best for MP' maps for stone and metal. The amount of metal will scale with the # of players, and will place slightly more mines overall for fairer distribution. This should make 1v1 and 4v4 more playable on these maps. Differential Revision: https://code.wildfiregames.com/D4148 This was SVN commit r25772.
This commit is contained in:
parent
ffd62e08d8
commit
e1a0cabf5a
@ -39,8 +39,10 @@ var oElephant = "gaia/fauna_elephant_african_bush";
|
||||
var oElephant2 = "gaia/fauna_elephant_african_infant";
|
||||
var oCrocodile = "gaia/fauna_crocodile_nile";
|
||||
var oFish = g_Gaia.fish;
|
||||
var oStoneLarge = g_Gaia.stoneLarge;
|
||||
var oStoneSmall = g_Gaia.stoneSmall;
|
||||
var oMetalLarge = g_Gaia.metalLarge;
|
||||
var oMetalSmall = g_Gaia.metalSmall;
|
||||
|
||||
var aBush = g_Decoratives.bushMedium;
|
||||
var aRock = g_Decoratives.rockMedium;
|
||||
@ -166,23 +168,22 @@ createPatches(
|
||||
clDirt);
|
||||
Engine.SetProgress(65);
|
||||
|
||||
g_Map.log("Creating stone mines");
|
||||
createMines(
|
||||
[
|
||||
[new SimpleObject(oStoneSmall, 0, 2, 0, 4)],
|
||||
[new SimpleObject(oStoneSmall, 2, 5, 1, 3)]
|
||||
],
|
||||
avoidClasses(clWater, 4, clForest, 4, clPlayer, 20, clRock, 10, clHill, 4),
|
||||
clRock);
|
||||
|
||||
g_Map.log("Creating metal mines");
|
||||
createMines(
|
||||
[
|
||||
[new SimpleObject(oMetalLarge, 1,1, 0,4)]
|
||||
],
|
||||
avoidClasses(clWater, 4, clForest, 4, clPlayer, 20, clMetal, 18, clRock, 5, clHill, 4),
|
||||
clMetal
|
||||
createBalancedMetalMines(
|
||||
oMetalSmall,
|
||||
oMetalLarge,
|
||||
clMetal,
|
||||
avoidClasses(clWater, 4, clForest, 1, clPlayer, scaleByMapSize(20, 35), clHill, 1)
|
||||
);
|
||||
|
||||
g_Map.log("Creating stone mines");
|
||||
createBalancedStoneMines(
|
||||
oStoneSmall,
|
||||
oStoneLarge,
|
||||
clRock,
|
||||
avoidClasses(clWater, 4, clForest, 1, clPlayer, scaleByMapSize(20, 35), clHill, 1, clMetal, 10)
|
||||
);
|
||||
|
||||
Engine.SetProgress(70);
|
||||
|
||||
createDecoration(
|
||||
|
@ -72,6 +72,7 @@ var clMetal = g_Map.createTileClass();
|
||||
var clFood = g_Map.createTileClass();
|
||||
var clBaseResource = g_Map.createTileClass();
|
||||
var clHillDeco = g_Map.createTileClass();
|
||||
var clExplorable = g_Map.createTileClass();
|
||||
|
||||
g_Map.log("Creating the central dip");
|
||||
createArea(
|
||||
@ -279,6 +280,8 @@ var explorableArea = createArea(
|
||||
avoidClasses(clPlayer, 1)
|
||||
]);
|
||||
|
||||
new TileClassPainter(clExplorable).paint(explorableArea);
|
||||
|
||||
Engine.SetProgress(55);
|
||||
|
||||
// Add some general noise - after placing height dependant trees
|
||||
@ -349,40 +352,27 @@ for (let size of [scaleByMapSize(20, 120)])
|
||||
|
||||
Engine.SetProgress(75);
|
||||
|
||||
g_Map.log("Creating stone mines");
|
||||
createObjectGroupsByAreasDeprecated(
|
||||
new SimpleGroup(
|
||||
[
|
||||
new SimpleObject(oStoneSmall, 1, 2, 0, 4, 0, 2 * Math.PI, 1),
|
||||
new SimpleObject(oStoneLarge, 0, 1, 0, 4, 0, 2 * Math.PI, 4)
|
||||
],
|
||||
true,
|
||||
clRock),
|
||||
0,
|
||||
[avoidClasses(clHill, 4, clForest, 2, clPlayer, 20, clRock, 10)],
|
||||
scaleByMapSize(6,20), 100,
|
||||
[explorableArea]);
|
||||
|
||||
g_Map.log("Creating small stone mines");
|
||||
var group = new SimpleGroup([new SimpleObject(oStoneSmall, 2, 5, 1, 3)], true, clRock);
|
||||
createObjectGroupsByAreasDeprecated(group, 0,
|
||||
[avoidClasses(clHill, 4, clForest, 2, clPlayer, 20, clRock, 10)],
|
||||
scaleByMapSize(6,20), 100,
|
||||
[explorableArea]
|
||||
g_Map.log("Creating metal mines");
|
||||
createBalancedMetalMines(
|
||||
oMetalSmall,
|
||||
oMetalLarge,
|
||||
clMetal,
|
||||
[stayClasses(clExplorable, 1), avoidClasses(clForest, 0, clPlayer, scaleByMapSize(15, 25), clHill, 1)]
|
||||
);
|
||||
|
||||
g_Map.log("Creating metal mines");
|
||||
group = new SimpleGroup([new SimpleObject(oMetalSmall, 1,2, 0,4), new SimpleObject(oMetalLarge, 1,1, 0,4)], true, clMetal);
|
||||
createObjectGroupsByAreasDeprecated(group, 0,
|
||||
[avoidClasses(clHill, 4, clForest, 2, clPlayer, 20, clMetal, 10, clRock, 5)],
|
||||
scaleByMapSize(6,20), 100,
|
||||
[explorableArea]
|
||||
|
||||
g_Map.log("Creating stone mines");
|
||||
createBalancedStoneMines(
|
||||
oStoneSmall,
|
||||
oStoneLarge,
|
||||
clRock,
|
||||
[stayClasses(clExplorable, 1), avoidClasses(clForest, 0, clPlayer, scaleByMapSize(15, 25), clHill, 1, clMetal, 10)]
|
||||
);
|
||||
|
||||
Engine.SetProgress(80);
|
||||
|
||||
g_Map.log("Creating wildlife");
|
||||
group = new SimpleGroup(
|
||||
let group = new SimpleGroup(
|
||||
[new SimpleObject(oDeer, 5,7, 0,4)],
|
||||
true, clFood
|
||||
);
|
||||
|
@ -33,6 +33,7 @@ const oSheep = g_Gaia.secondaryHuntableAnimal;
|
||||
const oStoneLarge = g_Gaia.stoneLarge;
|
||||
const oStoneSmall = g_Gaia.stoneSmall;
|
||||
const oMetalLarge = g_Gaia.metalLarge;
|
||||
const oMetalSmall = g_Gaia.metalSmall;
|
||||
|
||||
const aGrass = g_Decoratives.grass;
|
||||
const aGrassShort = g_Decoratives.grassShort;
|
||||
@ -196,24 +197,22 @@ createLayeredPatches(
|
||||
clDirt);
|
||||
Engine.SetProgress(50);
|
||||
|
||||
g_Map.log("Creating stone mines");
|
||||
createMines(
|
||||
[
|
||||
[new SimpleObject(oStoneSmall, 0, 2, 0, 4, 0, 2 * Math.PI, 1), new SimpleObject(oStoneLarge, 1, 1, 0, 4, 0, 2 * Math.PI, 4)],
|
||||
[new SimpleObject(oStoneSmall, 2,5, 1,3)]
|
||||
],
|
||||
avoidClasses(clWater, 0, clForest, 1, clPlayer, 5, clRock, 10, clHill, 1),
|
||||
clRock);
|
||||
Engine.SetProgress(55);
|
||||
|
||||
g_Map.log("Creating metal mines");
|
||||
createMines(
|
||||
[
|
||||
[new SimpleObject(oMetalLarge, 1,1, 0,4)]
|
||||
],
|
||||
avoidClasses(clWater, 0, clForest, 1, clPlayer, 5, clMetal, 10, clRock, 5, clHill, 1),
|
||||
clMetal
|
||||
createBalancedMetalMines(
|
||||
oMetalSmall,
|
||||
oMetalLarge,
|
||||
clMetal,
|
||||
avoidClasses(clWater, 0, clForest, 0, clPlayer, scaleByMapSize(15, 25), clHill, 1)
|
||||
);
|
||||
|
||||
g_Map.log("Creating stone mines");
|
||||
createBalancedStoneMines(
|
||||
oStoneSmall,
|
||||
oStoneLarge,
|
||||
clRock,
|
||||
avoidClasses(clWater, 0, clForest, 0, clPlayer, scaleByMapSize(15, 25), clHill, 1, clMetal, 10)
|
||||
);
|
||||
|
||||
Engine.SetProgress(60);
|
||||
|
||||
createDecoration(
|
||||
|
@ -30,6 +30,7 @@ const oSecondaryHuntableAnimal = g_Gaia.secondaryHuntableAnimal;
|
||||
const oStoneLarge = g_Gaia.stoneLarge;
|
||||
const oStoneSmall = g_Gaia.stoneSmall;
|
||||
const oMetalLarge = g_Gaia.metalLarge;
|
||||
const oMetalSmall = g_Gaia.metalSmall;
|
||||
|
||||
const aGrass = g_Decoratives.grass;
|
||||
const aGrassShort = g_Decoratives.grassShort;
|
||||
@ -162,22 +163,20 @@ createPatches(
|
||||
clDirt);
|
||||
Engine.SetProgress(55);
|
||||
|
||||
g_Map.log("Creating stone mines");
|
||||
createMines(
|
||||
[
|
||||
[new SimpleObject(oStoneSmall, 0, 2, 0, 4, 0, 2 * Math.PI, 1), new SimpleObject(oStoneLarge, 1, 1, 0, 4, 0, 2 * Math.PI, 4)],
|
||||
[new SimpleObject(oStoneSmall, 2,5, 1,3)]
|
||||
],
|
||||
[avoidClasses(clForest, 1, clPlayer, 20, clRock, 10, clHill, 1), stayClasses(clLand, 6)],
|
||||
clRock);
|
||||
|
||||
g_Map.log("Creating metal mines");
|
||||
createMines(
|
||||
[
|
||||
[new SimpleObject(oMetalLarge, 1,1, 0,4)]
|
||||
],
|
||||
[avoidClasses(clForest, 1, clPlayer, 20, clMetal, 10, clRock, 5, clHill, 1), stayClasses(clLand, 6)],
|
||||
clMetal
|
||||
createBalancedMetalMines(
|
||||
oMetalSmall,
|
||||
oMetalLarge,
|
||||
clMetal,
|
||||
[stayClasses(clLand, 6), avoidClasses(clForest, 1, clPlayer, scaleByMapSize(20, 35), clHill, 1)],
|
||||
);
|
||||
|
||||
g_Map.log("Creating stone mines");
|
||||
createBalancedStoneMines(
|
||||
oStoneSmall,
|
||||
oStoneLarge,
|
||||
clRock,
|
||||
[stayClasses(clLand, 6), avoidClasses(clForest, 1, clPlayer, scaleByMapSize(20, 35), clHill, 1, clMetal, 10)]
|
||||
);
|
||||
|
||||
Engine.SetProgress(65);
|
||||
|
@ -30,6 +30,7 @@ const oGoat = "gaia/fauna_goat";
|
||||
const oStoneLarge = g_Gaia.stoneLarge;
|
||||
const oStoneSmall = g_Gaia.stoneSmall;
|
||||
const oMetalLarge = g_Gaia.metalLarge;
|
||||
const oMetalSmall = g_Gaia.metalSmall;
|
||||
const oDatePalm = g_Gaia.tree1;
|
||||
const oSDatePalm = g_Gaia.tree2;
|
||||
const oCarob = g_Gaia.tree3;
|
||||
@ -229,13 +230,12 @@ createObjectGroups(
|
||||
);
|
||||
|
||||
g_Map.log("Creating metal mines");
|
||||
createMines(
|
||||
[
|
||||
[new SimpleObject(oMetalLarge, 1, 1, 0, 4)]
|
||||
],
|
||||
avoidClasses(clForest, 4, clPassageway, 10, clPlayer, 15, clMetal, 10, clRock, 5, clWater, 4, clHill, 4),
|
||||
createBalancedMetalMines(
|
||||
oMetalSmall,
|
||||
oMetalLarge,
|
||||
clMetal,
|
||||
scaleByMapSize(5, 20)
|
||||
avoidClasses(clPassageway, 1, clWater, 0, clForest, 0, clPlayer, scaleByMapSize(15, 25), clHill, 1, clRock, 10),
|
||||
0.9 // less available area -> slightly less metal
|
||||
);
|
||||
|
||||
Engine.SetProgress(65);
|
||||
|
@ -26,6 +26,7 @@ const oBerryBush = g_Gaia.fruitBush;
|
||||
const oStoneLarge = g_Gaia.stoneLarge;
|
||||
const oStoneSmall = g_Gaia.stoneSmall;
|
||||
const oMetalLarge = g_Gaia.metalLarge;
|
||||
const oMetalSmall = g_Gaia.metalSmall;
|
||||
const oDeer = g_Gaia.mainHuntableAnimal;
|
||||
const oRabbit = g_Gaia.secondaryHuntableAnimal;
|
||||
const oFish = g_Gaia.fish;
|
||||
@ -174,22 +175,22 @@ createPatches(
|
||||
clDirt);
|
||||
Engine.SetProgress(65);
|
||||
|
||||
g_Map.log("Creating stone mines");
|
||||
createMines(
|
||||
[
|
||||
[new SimpleObject(oStoneSmall, 0, 2, 0, 4, 0, 2 * Math.PI, 1), new SimpleObject(oStoneLarge, 1, 1, 0, 4, 0, 2 * Math.PI, 4)],
|
||||
[new SimpleObject(oStoneSmall, 2,5, 1,3)]
|
||||
],
|
||||
avoidClasses(clWater, 3, clForest, 1, clPlayer, 20, clRock, 10, clHill, 1),
|
||||
clRock);
|
||||
|
||||
g_Map.log("Creating metal mines");
|
||||
createMines(
|
||||
[
|
||||
[new SimpleObject(oMetalLarge, 1,1, 0,4)]
|
||||
],
|
||||
avoidClasses(clWater, 3, clForest, 1, clPlayer, 20, clMetal, 10, clRock, 5, clHill, 1),
|
||||
clMetal
|
||||
createBalancedMetalMines(
|
||||
oMetalSmall,
|
||||
oMetalLarge,
|
||||
clMetal,
|
||||
avoidClasses(clWater, 2, clForest, 0, clPlayer, scaleByMapSize(15, 25), clHill, 1),
|
||||
0.9
|
||||
);
|
||||
|
||||
g_Map.log("Creating stone mines");
|
||||
createBalancedStoneMines(
|
||||
oStoneSmall,
|
||||
oStoneLarge,
|
||||
clRock,
|
||||
avoidClasses(clWater, 2, clForest, 0, clPlayer, scaleByMapSize(15, 25), clHill, 1, clMetal, 10),
|
||||
0.9
|
||||
);
|
||||
Engine.SetProgress(70);
|
||||
|
||||
|
@ -30,6 +30,7 @@ const oSecondaryHuntableAnimal = g_Gaia.secondaryHuntableAnimal;
|
||||
const oStoneLarge = g_Gaia.stoneLarge;
|
||||
const oStoneSmall = g_Gaia.stoneSmall;
|
||||
const oMetalLarge = g_Gaia.metalLarge;
|
||||
const oMetalSmall = g_Gaia.metalSmall;
|
||||
|
||||
const aGrass = g_Decoratives.grass;
|
||||
const aGrassShort = g_Decoratives.grassShort;
|
||||
@ -161,22 +162,20 @@ createPatches(
|
||||
clDirt);
|
||||
Engine.SetProgress(55);
|
||||
|
||||
g_Map.log("Creating stone mines");
|
||||
createMines(
|
||||
[
|
||||
[new SimpleObject(oStoneSmall, 0, 2, 0, 4, 0, 2 * Math.PI, 1), new SimpleObject(oStoneLarge, 1, 1, 0, 4, 0, 2 * Math.PI, 4)],
|
||||
[new SimpleObject(oStoneSmall, 2,5, 1,3)]
|
||||
],
|
||||
avoidClasses(clWater, 3, clForest, 1, clPlayer, 20, clRock, 10, clHill, 1),
|
||||
clRock);
|
||||
|
||||
g_Map.log("Creating metal mines");
|
||||
createMines(
|
||||
[
|
||||
[new SimpleObject(oMetalLarge, 1,1, 0,4)]
|
||||
],
|
||||
avoidClasses(clWater, 3, clForest, 1, clPlayer, 20, clMetal, 10, clRock, 5, clHill, 1),
|
||||
clMetal
|
||||
createBalancedMetalMines(
|
||||
oMetalSmall,
|
||||
oMetalLarge,
|
||||
clMetal,
|
||||
avoidClasses(clWater, 3, clForest, 1, clPlayer, scaleByMapSize(20, 35), clHill, 1)
|
||||
);
|
||||
|
||||
g_Map.log("Creating stone mines");
|
||||
createBalancedStoneMines(
|
||||
oStoneSmall,
|
||||
oStoneLarge,
|
||||
clRock,
|
||||
avoidClasses(clWater, 3, clForest, 1, clPlayer, scaleByMapSize(20, 35), clHill, 1, clMetal, 10)
|
||||
);
|
||||
|
||||
Engine.SetProgress(65);
|
||||
|
@ -27,6 +27,7 @@ const oSecondaryHuntableAnimal = g_Gaia.secondaryHuntableAnimal;
|
||||
const oStoneLarge = g_Gaia.stoneLarge;
|
||||
const oStoneSmall = g_Gaia.stoneSmall;
|
||||
const oMetalLarge = g_Gaia.metalLarge;
|
||||
const oMetalSmall = g_Gaia.metalSmall;
|
||||
|
||||
const aGrass = g_Decoratives.grass;
|
||||
const aGrassShort = g_Decoratives.grassShort;
|
||||
@ -116,22 +117,20 @@ createPatches(
|
||||
clDirt);
|
||||
Engine.SetProgress(55);
|
||||
|
||||
g_Map.log("Creating stone mines");
|
||||
createMines(
|
||||
[
|
||||
[new SimpleObject(oStoneSmall, 0, 2, 0, 4, 0, 2 * Math.PI, 1), new SimpleObject(oStoneLarge, 1, 1, 0, 4, 0, 2 * Math.PI, 4)],
|
||||
[new SimpleObject(oStoneSmall, 2, 5, 1, 3, 0, 2 * Math.PI, 1)]
|
||||
],
|
||||
avoidClasses(clForest, 1, clPlayer, 20, clRock, 10, clHill, 1),
|
||||
clRock);
|
||||
|
||||
g_Map.log("Creating metal mines");
|
||||
createMines(
|
||||
[
|
||||
[new SimpleObject(oMetalLarge, 1,1, 0,4)]
|
||||
],
|
||||
avoidClasses(clForest, 1, clPlayer, 20, clMetal, 10, clRock, 5, clHill, 1),
|
||||
clMetal
|
||||
createBalancedMetalMines(
|
||||
oMetalSmall,
|
||||
oMetalLarge,
|
||||
clMetal,
|
||||
avoidClasses(clForest, 1, clPlayer, scaleByMapSize(20, 35), clHill, 1)
|
||||
);
|
||||
|
||||
g_Map.log("Creating stone mines");
|
||||
createBalancedStoneMines(
|
||||
oStoneSmall,
|
||||
oStoneLarge,
|
||||
clRock,
|
||||
avoidClasses(clForest, 1, clPlayer, scaleByMapSize(20, 35), clHill, 1, clMetal, 10)
|
||||
);
|
||||
|
||||
Engine.SetProgress(65);
|
||||
|
@ -32,6 +32,7 @@ const oWildebeest = "gaia/fauna_wildebeest";
|
||||
const oStoneLarge = g_Gaia.stoneLarge;
|
||||
const oStoneSmall = g_Gaia.stoneSmall;
|
||||
const oMetalLarge = g_Gaia.metalLarge;
|
||||
const oMetalSmall = g_Gaia.metalSmall;
|
||||
const oOasisTree = "gaia/tree/senegal_date_palm";
|
||||
const oDatePalm = g_Gaia.tree1;
|
||||
const oSDatePalm = g_Gaia.tree2;
|
||||
@ -288,31 +289,25 @@ createAreas(
|
||||
50);
|
||||
|
||||
Engine.SetProgress(70);
|
||||
g_Map.log("Creating metal mines");
|
||||
createBalancedMetalMines(
|
||||
oMetalSmall,
|
||||
oMetalLarge,
|
||||
clMetal,
|
||||
avoidClasses(clOasis, 2, clForest, 0, clPlayer, scaleByMapSize(15, 25), clHill1, 1)
|
||||
);
|
||||
|
||||
g_Map.log("Creating stone mines");
|
||||
var group = new SimpleGroup([new SimpleObject(oStoneSmall, 0, 2, 0, 4), new SimpleObject(oStoneLarge, 1, 1, 0, 4), new RandomObject(aBushes, 2, 4, 0, 2)], true, clRock);
|
||||
createObjectGroupsDeprecated(group, 0,
|
||||
[avoidClasses(clOasis, 1, clForest, 1, clPlayer, 10, clRock, 10, clHill1, 1)],
|
||||
scaleByMapSize(4,16), 100
|
||||
createBalancedStoneMines(
|
||||
oStoneSmall,
|
||||
oStoneLarge,
|
||||
clRock,
|
||||
avoidClasses(clOasis, 2, clForest, 0, clPlayer, scaleByMapSize(15, 25), clHill1, 1, clMetal, 10)
|
||||
);
|
||||
|
||||
group = new SimpleGroup([new SimpleObject(oStoneSmall, 2,5, 1,3), new RandomObject(aBushes, 2,4, 0,2)], true, clRock);
|
||||
createObjectGroupsDeprecated(group, 0,
|
||||
[avoidClasses(clOasis, 1, clForest, 1, clPlayer, 10, clRock, 10, clHill1, 1)],
|
||||
scaleByMapSize(4,16), 100
|
||||
);
|
||||
|
||||
g_Map.log("Creating metal mines");
|
||||
group = new SimpleGroup([new SimpleObject(oMetalLarge, 1,1, 0,4), new RandomObject(aBushes, 2,4, 0,2)], true, clMetal);
|
||||
createObjectGroupsDeprecated(group, 0,
|
||||
[avoidClasses(clOasis, 1, clForest, 1, clPlayer, 10, clMetal, 10, clRock, 5, clHill1, 1)],
|
||||
scaleByMapSize(4,16), 100
|
||||
);
|
||||
|
||||
Engine.SetProgress(80);
|
||||
|
||||
g_Map.log("Creating gazelles");
|
||||
group = new SimpleGroup([new SimpleObject(oGazelle, 5,7, 0,4)], true, clFood);
|
||||
let group = new SimpleGroup([new SimpleObject(oGazelle, 5,7, 0,4)], true, clFood);
|
||||
createObjectGroupsDeprecated(group, 0,
|
||||
avoidClasses(clOasis, 1, clForest, 0, clPlayer, 5, clHill1, 1, clFood, 10),
|
||||
scaleByMapSize(5,20), 50
|
||||
|
@ -32,6 +32,7 @@ const oRabbit = "gaia/fauna_rabbit";
|
||||
const oStoneLarge = "gaia/rock/alpine_large";
|
||||
const oStoneSmall = "gaia/rock/alpine_small";
|
||||
const oMetalLarge = "gaia/ore/alpine_large";
|
||||
const oMetalSmall = "gaia/ore/alpine_small";
|
||||
|
||||
const aGrass = "actor|props/flora/grass_soft_small_tall.xml";
|
||||
const aGrassShort = "actor|props/flora/grass_soft_large.xml";
|
||||
@ -404,17 +405,21 @@ createObjectGroupsDeprecated(group, 0, avoidClasses(clWater, 2, clPlayer, 1, clP
|
||||
|
||||
Engine.SetProgress(80);
|
||||
|
||||
g_Map.log("Creating stone mines");
|
||||
group = new SimpleGroup([new SimpleObject(oStoneSmall, 0, 2, 0, 4, 0, 2 * Math.PI, 1), new SimpleObject(oStoneLarge, 1, 1, 0, 4, 0, 2 * Math.PI, 4)], true, clRock);
|
||||
createObjectGroupsDeprecated(group, 0, avoidClasses(clWater, 3, clForest, 1, clPlayer, 20, clRock, 8, clPyrenneans, 1), scaleByMapSize(4,16), 100 );
|
||||
|
||||
g_Map.log("Creating small stone quarries");
|
||||
group = new SimpleGroup([new SimpleObject(oStoneSmall, 2,5, 1,3)], true, clRock);
|
||||
createObjectGroupsDeprecated(group, 0, avoidClasses(clWater, 3, clForest, 1, clPlayer, 20, clRock, 8, clPyrenneans, 1), scaleByMapSize(4,16), 100 );
|
||||
|
||||
g_Map.log("Creating metal mines");
|
||||
group = new SimpleGroup([new SimpleObject(oMetalLarge, 1,1, 0,4)], true, clMetal);
|
||||
createObjectGroupsDeprecated(group, 0, avoidClasses(clWater, 3, clForest, 1, clPlayer, 20, clMetal, 8, clRock, 5, clPyrenneans, 1), scaleByMapSize(4,16), 100 );
|
||||
createBalancedMetalMines(
|
||||
oMetalSmall,
|
||||
oMetalLarge,
|
||||
clMetal,
|
||||
avoidClasses(clWater, 2, clForest, 0, clPlayer, scaleByMapSize(15, 25), clPyrenneans, 3)
|
||||
);
|
||||
|
||||
g_Map.log("Creating stone mines");
|
||||
createBalancedStoneMines(
|
||||
oStoneSmall,
|
||||
oStoneLarge,
|
||||
clRock,
|
||||
avoidClasses(clWater, 2, clForest, 0, clPlayer, scaleByMapSize(15, 25), clPyrenneans, 3, clMetal, 10)
|
||||
);
|
||||
|
||||
Engine.SetProgress(85);
|
||||
|
||||
|
@ -34,6 +34,7 @@ const oSecondaryHuntableAnimal = g_Gaia.secondaryHuntableAnimal;
|
||||
const oStoneLarge = g_Gaia.stoneLarge;
|
||||
const oStoneSmall = g_Gaia.stoneSmall;
|
||||
const oMetalLarge = g_Gaia.metalLarge;
|
||||
const oMetalSmall = g_Gaia.metalSmall;
|
||||
|
||||
const aGrass = g_Decoratives.grass;
|
||||
const aGrassShort = g_Decoratives.grassShort;
|
||||
@ -187,22 +188,20 @@ createPatches(
|
||||
clDirt);
|
||||
Engine.SetProgress(55);
|
||||
|
||||
g_Map.log("Creating stone mines");
|
||||
createMines(
|
||||
[
|
||||
[new SimpleObject(oStoneSmall, 0, 2, 0, 4, 0, 2 * Math.PI, 1), new SimpleObject(oStoneLarge, 1, 1, 0, 4, 0, 2 * Math.PI, 4)],
|
||||
[new SimpleObject(oStoneSmall, 2,5, 1,3)]
|
||||
],
|
||||
avoidClasses(clWater, 3, clForest, 1, clPlayer, 20, clRock, 10, clHill, 1),
|
||||
clRock);
|
||||
|
||||
g_Map.log("Creating metal mines");
|
||||
createMines(
|
||||
[
|
||||
[new SimpleObject(oMetalLarge, 1,1, 0,4)]
|
||||
],
|
||||
avoidClasses(clWater, 3, clForest, 1, clPlayer, 20, clMetal, 10, clRock, 5, clHill, 1),
|
||||
clMetal
|
||||
createBalancedMetalMines(
|
||||
oMetalSmall,
|
||||
oMetalLarge,
|
||||
clMetal,
|
||||
avoidClasses(clWater, 3, clForest, 1, clPlayer, scaleByMapSize(20, 35), clHill, 1)
|
||||
);
|
||||
|
||||
g_Map.log("Creating stone mines");
|
||||
createBalancedStoneMines(
|
||||
oStoneSmall,
|
||||
oStoneLarge,
|
||||
clRock,
|
||||
avoidClasses(clWater, 3, clForest, 1, clPlayer, scaleByMapSize(20, 35), clHill, 1, clMetal, 10)
|
||||
);
|
||||
|
||||
Engine.SetProgress(65);
|
||||
|
@ -119,6 +119,101 @@ function createMines(objects, constraint, tileClass, count)
|
||||
70);
|
||||
}
|
||||
|
||||
/**
|
||||
* Place large/small mines on the map in such a way that it should be relatively fair.
|
||||
* @param oSmall - the small mine object
|
||||
* @param oLarge - the large mine object
|
||||
* @param clMine - the 'mine' class to paint.
|
||||
* @param constraints - Custom constraints. Note that the function automatically avoids clMine as well.
|
||||
* @param counts - optional, either a single number acting as multiplier to the defaults
|
||||
* or a dict of numbers{ "largeCount": 0, "smallCount": 1, "randomSmallCount": 2 }
|
||||
* @param randomness - randomize counts by a random multiplier between [1 - randomness, 1 + randomness]
|
||||
*/
|
||||
function createBalancedMines(oSmall, oLarge, clMine, constraints, counts = 1.0, randomness = 0.1)
|
||||
{
|
||||
let largeCount = counts.largeCount;
|
||||
let smallCount = counts.smallCount;
|
||||
let randomSmallCount = counts.randomSmallCount;
|
||||
|
||||
if (randomness > 0 && randomness < 1)
|
||||
{
|
||||
largeCount = Math.round(largeCount * randFloat(1 - randomness, 1 + randomness));
|
||||
smallCount = Math.round(smallCount * randFloat(1 - randomness, 1 + randomness));
|
||||
randomSmallCount = Math.round(randomSmallCount * randFloat(1 - randomness, 1 + randomness));
|
||||
}
|
||||
|
||||
const arrayConstraints = Array.isArray(constraints) ? constraints : [constraints];
|
||||
|
||||
// Plop large mines far away from each other.
|
||||
createObjectGroups(
|
||||
new SimpleGroup([new SimpleObject(oLarge, 1, 1, 0, 1)], true, clMine),
|
||||
0,
|
||||
new AndConstraint([avoidClasses(clMine, scaleByMapSize(25, 50)), ...arrayConstraints]),
|
||||
largeCount,
|
||||
100);
|
||||
|
||||
// Plop smaller clusters of small mines, also somewhat farther away.
|
||||
createObjectGroups(
|
||||
new SimpleGroup([new SimpleObject(oSmall, 2, 3, 0, 2)], true, clMine),
|
||||
0,
|
||||
new AndConstraint([avoidClasses(clMine, scaleByMapSize(18, 35)), ...arrayConstraints]),
|
||||
smallCount,
|
||||
50);
|
||||
|
||||
// Plop a few smaller clusters in a random fashion, occasionally making very good dropsites spots.
|
||||
createObjectGroups(
|
||||
new SimpleGroup([new SimpleObject(oSmall, 1, 2, 0, 2)], true, clMine),
|
||||
0,
|
||||
new AndConstraint([avoidClasses(clMine, 5), ...arrayConstraints]),
|
||||
randomSmallCount,
|
||||
50);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for createBalancedMines with default metal counts.
|
||||
* The current settings are so that a Small 1v1 has about 40K metal,
|
||||
* and a Normal 4v4 has about 140K.
|
||||
* The setup is biaised so that with fewer players, there are more small mines,
|
||||
* and with more players there are proportionally more big mines, to maintain
|
||||
* some randomness to the distribution but keep it somewhat fair in 1v1.
|
||||
*/
|
||||
function createBalancedMetalMines(oSmall, oLarge, clMine, constraints, counts = 1.0, randomness = 0.05)
|
||||
{
|
||||
return createBalancedMines(
|
||||
oSmall,
|
||||
oLarge,
|
||||
clMine,
|
||||
constraints,
|
||||
{
|
||||
"largeCount": (Math.max(scaleByMapSize(1, 9), getNumPlayers() * 1.8 - 0.8)) * counts,
|
||||
"smallCount": (scaleByMapSize(4, 12)) * counts,
|
||||
"randomSmallCount": (scaleByMapSize(1, 8)) * counts,
|
||||
},
|
||||
randomness
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper for createBalancedMines with default stone counts.
|
||||
* There is a little less stone than metal overall.
|
||||
*/
|
||||
function createBalancedStoneMines(oSmall, oLarge, clMine, constraints, counts = 1.0, randomness = 0.05)
|
||||
{
|
||||
return createBalancedMines(
|
||||
oSmall,
|
||||
oLarge,
|
||||
clMine,
|
||||
constraints,
|
||||
{
|
||||
"largeCount": (Math.max(scaleByMapSize(1, 9), getNumPlayers() * 1.25)) * counts,
|
||||
"smallCount": (scaleByMapSize(1, 8)) * counts,
|
||||
"randomSmallCount": (scaleByMapSize(1, 8)) * counts,
|
||||
},
|
||||
randomness
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Places Entities of the given templateName in a circular pattern (leaving out a quarter of the circle).
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user