Extend random biome systme to support map specific biomes, fixes #4954, refs D852 / f2550705d3.

This was SVN commit r21010.
This commit is contained in:
elexis 2018-01-25 04:44:26 +00:00
parent 8cd117d489
commit 626d89a726
44 changed files with 320 additions and 199 deletions

View file

@ -17,7 +17,7 @@ const g_SettingsDirectory = "simulation/data/settings/";
/**
* Directory containing all biomes supported for random map scripts.
*/
const g_BiomesDirectory = "maps/random/rmbiome/biomes/";
const g_BiomesDirectory = "maps/random/rmbiome/";
/**
@ -236,12 +236,12 @@ function loadMapTypes()
function loadBiomes()
{
return listFiles(g_BiomesDirectory, ".json", false).map(biomeID => {
return listFiles(g_BiomesDirectory, ".json", true).filter(biomeID => biomeID != "defaultbiome").map(biomeID => {
let description = Engine.ReadJSONFile(g_BiomesDirectory + biomeID + ".json").Description;
return {
"Id": biomeID,
"Title": translateWithContext("biome definition", description.Title),
"Description": translateWithContext("biome definition", description.Description)
"Description": description.Description ? translateWithContext("biome definition", description.Description) : ""
};
});
}

View file

@ -1699,8 +1699,8 @@ function reloadBiomeList()
if (g_GameAttributes.mapType == "random" && g_GameAttributes.settings.SupportedBiomes)
{
if (g_GameAttributes.settings.SupportedBiomes === true)
biomeList = g_Settings.Biomes;
if (typeof g_GameAttributes.settings.SupportedBiomes == "string")
biomeList = g_Settings.Biomes.filter(biome => biome.Id.startsWith(g_GameAttributes.settings.SupportedBiomes));
else
biomeList = g_Settings.Biomes.filter(
biome => g_GameAttributes.settings.SupportedBiomes.indexOf(biome.Id) != -1);
@ -2130,8 +2130,8 @@ function launchGame()
if (g_GameAttributes.settings.Biome == "random")
g_GameAttributes.settings.Biome = pickRandom(
g_GameAttributes.settings.SupportedBiomes === true ?
g_BiomeList.Id.slice(1) :
typeof g_GameAttributes.settings.SupportedBiomes == "string" ?
g_BiomeList.Id.slice(1).filter(biomeID => biomeID.startsWith(g_GameAttributes.settings.SupportedBiomes)) :
g_GameAttributes.settings.SupportedBiomes);
g_GameAttributes.settings.TriggerScripts = g_GameAttributes.settings.VictoryScripts.concat(g_GameAttributes.settings.TriggerScripts || []);

View file

@ -4,7 +4,7 @@
"Script" : "ambush.js",
"Description" : "High bluffs overlook the terrain below. Bountiful resources await on the cliffs, but beware of enemies planning an ambush.",
"Preview" : "ambush.png",
"SupportedBiomes": true,
"SupportedBiomes": "generic/",
"CircularMap" : true
}
}

View file

@ -5,7 +5,7 @@
"Description" : "A maze of islands of different sizes and shapes. Players start with more wood than normal.",
"Keywords": ["naval"],
"Preview" : "archipelago.png",
"SupportedBiomes": true,
"SupportedBiomes": "generic/",
"CircularMap" : true
}
}

View file

@ -4,7 +4,7 @@
"Script" : "canyon.js",
"Description" : "Players start around the map in deep canyons.",
"Preview" : "canyon.png",
"SupportedBiomes": true,
"SupportedBiomes": "generic/",
"CircularMap" : true
}
}

View file

@ -4,7 +4,7 @@
"Script" : "continent.js",
"Description" : "All players starts on a continent surrounded by water.",
"Preview" : "continent.png",
"SupportedBiomes": true,
"SupportedBiomes": "generic/",
"CircularMap" : true
}
}

View file

@ -5,7 +5,7 @@
"Description" : "A neighboring province has pledged alegiance to your rule. It's up to you to command them to victory.",
"Keywords": [],
"Preview" : "empire.png",
"SupportedBiomes": true,
"SupportedBiomes": "generic/",
"CircularMap" : true
}
}

View file

@ -4,13 +4,13 @@
"Script" : "flood.js",
"Description" : "A great flood has moved across the valley enabling ships and troops to battle in chest deep waters.",
"SupportedBiomes": [
"temperate",
"snowy",
"desert",
"alpine",
"mediterranean",
"tropic",
"autumn"
"generic/temperate",
"generic/snowy",
"generic/desert",
"generic/alpine",
"generic/mediterranean",
"generic/tropic",
"generic/autumn"
],
"Keywords": [],
"Preview" : "flood.png",

View file

@ -4,7 +4,7 @@
"Script" : "frontier.js",
"Description" : "A wild, unknown landscape awaits rival explorers.",
"Preview" : "frontier.png",
"SupportedBiomes": true,
"SupportedBiomes": "generic/",
"CircularMap" : true
}
}

View file

@ -4,7 +4,7 @@
"Script" : "gear.js",
"Description" : "A land with waterways decorated in a manner similar to spider web.",
"CircularMap" : true,
"SupportedBiomes": true,
"SupportedBiomes": "generic/",
"Preview" : "gear.png"
}
}

View file

@ -1,138 +1,47 @@
Engine.LoadLibrary("rmgen");
Engine.LoadLibrary("rmbiome");
TILE_CENTERED_HEIGHT_MAP = true;
var biome = pickRandom(["late_spring", "winter", "frozen_lake"]);
if (g_MapSettings.Biome)
setSelectedBiome();
else
// TODO: Replace ugly default for atlas by a dropdown
setBiome("late_spring");
if (biome == "late_spring")
{
log("Late spring biome...");
var heightSeaGround = -3;
var heightShore = 1;
var heightLand = 3;
const tPrimary = g_Terrains.mainTerrain;
const tForestFloor = g_Terrains.forestFloor1;
const tCliff = g_Terrains.cliff;
const tSecondary = g_Terrains.tier1Terrain;
const tHalfSnow = g_Terrains.tier2Terrain;
const tSnowLimited = g_Terrains.tier3Terrain;
const tRoad = g_Terrains.road;
const tRoadWild = g_Terrains.roadWild;
const tShore = g_Terrains.shore;
const tWater = g_Terrains.water;
var fishCount = { "min": 20, "max": 80 };
var bushCount = { "min": 13, "max": 200 };
const oPine = g_Gaia.tree1;
const oBerryBush = g_Gaia.fruitBush;
const oStoneLarge = g_Gaia.stoneLarge;
const oStoneSmall = g_Gaia.stoneSmall;
const oMetalLarge = g_Gaia.metalLarge;
const oDeer = g_Gaia.mainHuntableAnimal;
const oRabbit = g_Gaia.secondaryHuntableAnimal;
const oFish = g_Gaia.fish;
setFogThickness(0.26);
setFogFactor(0.4);
const aGrass = g_Decoratives.grass;
const aGrassShort = g_Decoratives.grassShort;
const aRockLarge = g_Decoratives.rockLarge;
const aRockMedium = g_Decoratives.rockMedium;
const aBushMedium = g_Decoratives.bushMedium;
const aBushSmall = g_Decoratives.bushSmall;
setPPEffect("hdr");
setPPSaturation(0.48);
setPPContrast(0.53);
setPPBloom(0.12);
const heightSeaGround = g_Heights.seaGround;
const heightShore = g_Heights.shore;
const heightLand = g_Heights.land;
var tPrimary = ["alpine_dirt_grass_50"];
var tForestFloor = "alpine_forrestfloor";
var tCliff = ["alpine_cliff_a", "alpine_cliff_b", "alpine_cliff_c"];
var tSecondary = "alpine_grass_rocky";
var tHalfSnow = ["alpine_grass_snow_50", "alpine_dirt_snow"];
var tSnowLimited = ["alpine_snow_rocky"];
var tRoad = "new_alpine_citytile";
var tRoadWild = "new_alpine_citytile";
var tShore = "alpine_shore_rocks_grass_50";
var tWater = "alpine_shore_rocks";
var oPine = "gaia/flora_tree_pine";
var oBerryBush = "gaia/flora_bush_berry";
var oDeer = "gaia/fauna_deer";
var oFish = "gaia/fauna_fish";
var oRabbit = "gaia/fauna_rabbit";
var oStoneLarge = "gaia/geology_stonemine_alpine_quarry";
var oStoneSmall = "gaia/geology_stone_alpine_a";
var oMetalLarge = "gaia/geology_metal_alpine_slabs";
var aGrass = "actor|props/flora/grass_soft_small_tall.xml";
var aGrassShort = "actor|props/flora/grass_soft_large.xml";
var aRockLarge = "actor|geology/stone_granite_med.xml";
var aRockMedium = "actor|geology/stone_granite_med.xml";
var aBushMedium = "actor|props/flora/bush_medit_me.xml";
var aBushSmall = "actor|props/flora/bush_medit_sm.xml";
}
else if (biome == "winter")
{
log("Winter biome...");
var heightSeaGround = -3;
var heightShore = 1;
var heightLand = 3;
var fishCount = { "min": 20, "max": 80 };
var bushCount = { "min": 13, "max": 200 };
setFogFactor(0.35);
setFogThickness(0.19);
setPPSaturation(0.37);
setPPEffect("hdr");
var tPrimary = ["alpine_snow_a", "alpine_snow_b"];
var tForestFloor = "alpine_forrestfloor_snow";
var tCliff = ["alpine_cliff_snow"];
var tSecondary = "alpine_grass_snow_50";
var tHalfSnow = ["alpine_grass_snow_50", "alpine_dirt_snow"];
var tSnowLimited = ["alpine_snow_a", "alpine_snow_b"];
var tRoad = "new_alpine_citytile";
var tRoadWild = "new_alpine_citytile";
var tShore = "alpine_shore_rocks_icy";
var tWater = "alpine_shore_rocks";
var oPine = "gaia/flora_tree_pine_w";
var oBerryBush = "gaia/flora_bush_berry";
var oDeer = "gaia/fauna_deer";
var oFish = "gaia/fauna_fish";
var oRabbit = "gaia/fauna_rabbit";
var oStoneLarge = "gaia/geology_stonemine_alpine_quarry";
var oStoneSmall = "gaia/geology_stone_alpine_a";
var oMetalLarge = "gaia/geology_metal_alpine_slabs";
var aGrass = "actor|props/flora/grass_soft_dry_small_tall.xml";
var aGrassShort = "actor|props/flora/grass_soft_dry_large.xml";
var aRockLarge = "actor|geology/stone_granite_med.xml";
var aRockMedium = "actor|geology/stone_granite_med.xml";
var aBushMedium = "actor|props/flora/bush_medit_me_dry.xml";
var aBushSmall = "actor|props/flora/bush_medit_sm_dry.xml";
}
else if (biome == "frozen_lake")
{
log("Frozen lake biome...");
var heightSeaGround = 0;
var heightShore = 2;
var heightLand = 3;
var fishCount = { "min": 0, "max": 0 };
var bushCount = { "min": 0, "max": 0 };
setFogFactor(0.41);
setFogThickness(0.23);
setPPSaturation(0.34);
setPPEffect("hdr");
var tPrimary = ["alpine_snow_a", "alpine_snow_b"];
var tForestFloor = "alpine_snow_a";
var tCliff = ["alpine_cliff_snow"];
var tSecondary = "polar_ice_snow";
var tHalfSnow = ["polar_ice_cracked"];
var tSnowLimited = ["alpine_snow_a", "alpine_snow_b"];
var tRoad = "new_alpine_citytile";
var tRoadWild = "new_alpine_citytile";
var tShore = "polar_ice_snow";
var tWater = ["polar_ice_snow", "polar_ice"];
var oPine = "gaia/flora_tree_pine_w";
var oBerryBush = "gaia/flora_bush_berry";
var oDeer = "gaia/fauna_deer";
var oFish = "gaia/fauna_fish";
var oRabbit = "gaia/fauna_rabbit";
var oStoneLarge = "gaia/geology_stonemine_alpine_quarry";
var oStoneSmall = "gaia/geology_stone_alpine_a";
var oMetalLarge = "gaia/geology_metal_alpine_slabs";
var aGrass = "actor|props/flora/grass_soft_dry_small_tall.xml";
var aGrassShort = "actor|props/flora/grass_soft_dry_large.xml";
var aRockLarge = "actor|geology/stone_granite_med.xml";
var aRockMedium = "actor|geology/stone_granite_med.xml";
var aBushMedium = "actor|props/flora/bush_medit_me_dry.xml";
var aBushSmall = "actor|props/flora/bush_medit_sm_dry.xml";
}
const fishCount = g_ResourceCounts.fish;
const bushCount = g_ResourceCounts.bush;
const pForest = [tForestFloor + TERRAIN_SEPARATOR + oPine, tForestFloor];
@ -323,14 +232,6 @@ createStragglerTrees(
// Avoid the lake, even if frozen
placePlayersNomad(clPlayer, avoidClasses(clWater, 4, clForest, 1, clMetal, 4, clRock, 4, clHill, 4, clFood, 2));
setSkySet("stormy");
setSunRotation(randomAngle());
setSunElevation(Math.PI * randFloat(1/6, 1/4));
setWaterColor(0.035,0.098,0.314);
setWaterTint(0.28, 0.3, 0.59);
setWaterWaviness(5.0);
setWaterType("lake");
setWaterMurkiness(0.88);
g_Map.ExportMap();

View file

@ -4,6 +4,7 @@
"Script" : "gulf_of_bothnia.js",
"Description" : "Players start around a gulf dotted with small islands.\n\nThe Gulf of Bothnia is the northernmost arm of the Baltic Sea.",
"Preview" : "gulf_of_bothnia.png",
"CircularMap" : true
"CircularMap" : true,
"SupportedBiomes": "gulf_of_bothnia/"
}
}

View file

@ -5,7 +5,7 @@
"Description" : "Players start with some light fishing opportunities in the calm waters of a sheltered harbor. A large bounty of seafood lays beyond the protective cliffs in the deep ocean. Small passages at the base of the cliffs make for tight fighting and easy fortification. Will you fight your way through the narrow passageways or take to the sea?",
"Keywords": [],
"Preview" : "harbor.png",
"SupportedBiomes": true,
"SupportedBiomes": "generic/",
"CircularMap" : true
}
}

View file

@ -4,7 +4,7 @@
"Script" : "hells_pass.js",
"Description" : "A narrow pass between steep mountains promotes tight, defensive combat. With bountiful resources far from the front lines, teams may choose to support their exposed teammates financially, or retreat to more fertile, but less defensible ground.",
"Preview" : "hells_pass.png",
"SupportedBiomes": true,
"SupportedBiomes": "generic/",
"CircularMap" : true
}
}

View file

@ -6,13 +6,13 @@
"Keywords": ["naval"],
"Preview" : "island_stronghold.png",
"SupportedBiomes": [
"temperate",
"snowy",
"desert",
"alpine",
"mediterranean",
"tropic",
"autumn"
"generic/temperate",
"generic/snowy",
"generic/desert",
"generic/alpine",
"generic/mediterranean",
"generic/tropic",
"generic/autumn"
],
"CircularMap" : true
}

View file

@ -5,7 +5,7 @@
"Description" : "Players start in small islands while there are many others around.",
"Keywords": ["naval"],
"Preview" : "islands.png",
"SupportedBiomes": true,
"SupportedBiomes": "generic/",
"CircularMap" : true
}
}

View file

@ -4,7 +4,7 @@
"Script" : "lake.js",
"Description" : "Players start around a lake in the center of the map.",
"Preview" : "lake.png",
"SupportedBiomes": true,
"SupportedBiomes": "generic/",
"CircularMap" : true
}
}

View file

@ -5,7 +5,7 @@
"Description" : "High cliffs protect each player's main base. Venturing into the unknown can be risky, but necessary.",
"Preview" : "lions_den.png",
"Keywords": [],
"SupportedBiomes": true,
"SupportedBiomes": "generic/",
"CircularMap" : true
}
}

View file

@ -4,7 +4,7 @@
"Script" : "mainland.js",
"Description" : "A typical map without any water.",
"Preview" : "mainland.png",
"SupportedBiomes": true,
"SupportedBiomes": "generic/",
"CircularMap" : true
}
}

View file

@ -5,7 +5,7 @@
"Description" : "Players start in small islands in the eastern part of the map. There is a big continent in the west ready for expansion.",
"Keywords": ["naval"],
"Preview" : "migration.png",
"SupportedBiomes": true,
"SupportedBiomes": "generic/",
"CircularMap" : true
}
}

View file

@ -4,7 +4,7 @@
"Script" : "rivers.js",
"Description" : "Rivers flow between players and join each other in the center of the map.",
"Preview" : "rivers.png",
"SupportedBiomes": true,
"SupportedBiomes": "generic/",
"CircularMap" : true
}
}

View file

@ -57,9 +57,11 @@
"bushSmall": "actor|props/flora/bush_medit_sm.xml",
"tree": "actor|flora/trees/oak.xml"
},
"TreeCount": {
"minTrees": 500,
"maxTrees": 3000,
"forestProbability": 0.7
"ResourceCounts": {
"trees": {
"min": 500,
"max": 3000,
"forestProbability": 0.7
}
}
}

View file

@ -77,9 +77,11 @@
"bushSmall": "actor|props/flora/bush_dry_a.xml",
"tree": "actor|flora/trees/baobab.xml"
},
"TreeCount": {
"minTrees": 200,
"maxTrees": 1250,
"forestProbability": 0
"ResourceCounts": {
"trees": {
"min": 200,
"max": 1250,
"forestProbability": 0
}
}
}

View file

@ -84,9 +84,11 @@
"bushSmall": "actor|props/flora/plant_tropic_large.xml",
"tree": "actor|flora/trees/tree_tropic.xml"
},
"TreeCount": {
"minTrees": 1000,
"maxTrees": 6000,
"forestProbability": 0.52
"ResourceCounts": {
"trees": {
"min": 1000,
"max": 6000,
"forestProbability": 0.52
}
}
}

View file

@ -0,0 +1,67 @@
{
"Description": {
"Title": "Frozen Lake"
},
"Environment": {
"SkySet": "stormy",
"Water": {
"WaterBody": {
"Type": "lake",
"Color": { "r": 0.035, "g": 0.098, "b": 0.314 },
"Tint": { "r": 0.28, "g": 0.3, "b": 0.59 },
"Murkiness": 0.88,
"Waviness": 5
}
},
"Fog": {
"FogThickness": 0.23,
"FogFactor": 0.0041
},
"Postproc": {
"PostprocEffect": "hdr",
"Saturation": 0.68,
"Contrast": 1.03,
"Bloom": 0.176
}
},
"Terrains": {
"mainTerrain": ["alpine_snow_a", "alpine_snow_b"],
"forestFloor1": "alpine_snow_a",
"cliff": "alpine_cliff_snow",
"tier1Terrain": "polar_ice_snow",
"tier2Terrain": "polar_ice_cracked",
"tier3Terrain": ["alpine_snow_a", "alpine_snow_b"],
"road": "new_alpine_citytile",
"roadWild": "new_alpine_citytile",
"shore": "polar_ice_snow",
"water": ["polar_ice_snow", "polar_ice"]
},
"Gaia": {
"tree1": "gaia/flora_tree_pine_w",
"fruitBush": "gaia/flora_bush_berry",
"chicken": "gaia/fauna_chicken",
"mainHuntableAnimal": "gaia/fauna_deer",
"secondaryHuntableAnimal": "gaia/fauna_rabbit",
"fish": "gaia/fauna_fish",
"stoneLarge": "gaia/geology_stonemine_alpine_quarry",
"stoneSmall": "gaia/geology_stone_alpine_a",
"metalLarge": "gaia/geology_metal_alpine_slabs"
},
"Decoratives": {
"grass": "actor|props/flora/grass_soft_dry_small_tall.xml",
"grassShort": "actor|props/flora/grass_soft_dry_large.xml",
"rockLarge": "actor|geology/stone_granite_med.xml",
"rockMedium": "actor|geology/stone_granite_med.xml",
"bushMedium": "actor|props/flora/bush_medit_me_dry.xml",
"bushSmall": "actor|props/flora/bush_medit_sm_dry.xml"
},
"ResourceCounts": {
"fish": { "min": 0, "max": 0 },
"bush": { "min": 0, "max": 0 }
},
"Heights": {
"seaGround": 0,
"shore": 2,
"land": 3
}
}

View file

@ -0,0 +1,67 @@
{
"Description": {
"Title": "Late Spring"
},
"Environment": {
"SkySet": "stormy",
"Water": {
"WaterBody": {
"Type": "lake",
"Color": { "r": 0.035, "g": 0.098, "b": 0.314 },
"Tint": { "r": 0.28, "g": 0.3, "b": 0.59 },
"Murkiness": 0.88,
"Waviness": 5
}
},
"Fog": {
"FogThickness": 0.26,
"FogFactor": 0.004
},
"Postproc": {
"PostprocEffect": "hdr",
"Saturation": 0.96,
"Contrast": 1.03,
"Bloom": 0.176
}
},
"Terrains": {
"mainTerrain": "alpine_dirt_grass_50",
"forestFloor1": "alpine_forrestfloor",
"cliff": ["alpine_cliff_a", "alpine_cliff_b", "alpine_cliff_c"],
"tier1Terrain": "alpine_grass_rocky",
"tier2Terrain": ["alpine_grass_snow_50", "alpine_dirt_snow"],
"tier3Terrain": "alpine_snow_rocky",
"road": "new_alpine_citytile",
"roadWild": "new_alpine_citytile",
"shore": "alpine_shore_rocks_grass_50",
"water": "alpine_shore_rocks"
},
"Gaia": {
"tree1": "gaia/flora_tree_pine",
"fruitBush": "gaia/flora_bush_berry",
"chicken": "gaia/fauna_chicken",
"mainHuntableAnimal": "gaia/fauna_deer",
"secondaryHuntableAnimal": "gaia/fauna_rabbit",
"fish": "gaia/fauna_fish",
"stoneLarge": "gaia/geology_stonemine_alpine_quarry",
"stoneSmall": "gaia/geology_stone_alpine_a",
"metalLarge": "gaia/geology_metal_alpine_slabs"
},
"Decoratives": {
"grass": "actor|props/flora/grass_soft_small_tall.xml",
"grassShort": "actor|props/flora/grass_soft_large.xml",
"rockLarge": "actor|geology/stone_granite_med.xml",
"rockMedium": "actor|geology/stone_granite_med.xml",
"bushMedium": "actor|props/flora/bush_medit_me.xml",
"bushSmall": "actor|props/flora/bush_medit_sm.xml"
},
"ResourceCounts": {
"fish": { "min": 20, "max": 80 },
"bush": { "min": 13, "max": 200 }
},
"Heights": {
"seaGround": -3,
"shore": 1,
"land": 3
}
}

View file

@ -0,0 +1,67 @@
{
"Description": {
"Title": "Winter"
},
"Environment": {
"SkySet": "stormy",
"Water": {
"WaterBody": {
"Type": "lake",
"Color": { "r": 0.035, "g": 0.098, "b": 0.314 },
"Tint": { "r": 0.28, "g": 0.3, "b": 0.59 },
"Murkiness": 0.88,
"Waviness": 5
}
},
"Fog": {
"FogThickness": 0.19,
"FogFactor": 0.0035
},
"Postproc": {
"PostprocEffect": "hdr",
"Saturation": 0.74,
"Contrast": 1.03,
"Bloom": 0.176
}
},
"Terrains": {
"mainTerrain": ["alpine_snow_a", "alpine_snow_b"],
"forestFloor1": "alpine_forrestfloor_snow",
"cliff": ["alpine_cliff_snow"],
"tier1Terrain": "alpine_grass_snow_50",
"tier2Terrain": ["alpine_grass_snow_50", "alpine_dirt_snow"],
"tier3Terrain": ["alpine_snow_a", "alpine_snow_b"],
"road": "new_alpine_citytile",
"roadWild": "new_alpine_citytile",
"shore": "alpine_shore_rocks_icy",
"water": "alpine_shore_rocks"
},
"Gaia": {
"tree1": "gaia/flora_tree_pine_w",
"fruitBush": "gaia/flora_bush_berry",
"chicken": "gaia/fauna_chicken",
"mainHuntableAnimal": "gaia/fauna_deer",
"secondaryHuntableAnimal": "gaia/fauna_rabbit",
"fish": "gaia/fauna_fish",
"stoneLarge": "gaia/geology_stonemine_alpine_quarry",
"stoneSmall": "gaia/geology_stone_alpine_a",
"metalLarge": "gaia/geology_metal_alpine_slabs"
},
"Decoratives": {
"grass": "actor|props/flora/grass_soft_dry_small_tall.xml",
"grassShort": "actor|props/flora/grass_soft_dry_large.xml",
"rockLarge": "actor|geology/stone_granite_med.xml",
"rockMedium": "actor|geology/stone_granite_med.xml",
"bushMedium": "actor|props/flora/bush_medit_me_dry.xml",
"bushSmall": "actor|props/flora/bush_medit_sm_dry.xml"
},
"ResourceCounts": {
"fish": { "min": 20, "max": 80 },
"bush": { "min": 13, "max": 200 }
},
"Heights": {
"seaGround": -3,
"shore": 1,
"land": 3
}
}

View file

@ -1,11 +1,10 @@
Engine.LoadLibrary("rmbiome/biomes");
var g_BiomeID;
var g_Terrains = {};
var g_Gaia = {};
var g_Decoratives = {};
var g_TreeCount = {};
var g_ResourceCounts = {};
var g_Heights = {};
function currentBiome()
{
@ -14,11 +13,13 @@ function currentBiome()
function setSelectedBiome()
{
setBiome(g_MapSettings.Biome || "alpine");
// TODO: Replace ugly default for atlas by a dropdown
setBiome(g_MapSettings.Biome || "generic/alpine");
}
function setBiome(biomeID)
{
log("Setting biome "+ biomeID);
loadBiomeFile("defaultbiome");
setSkySet(pickRandom(["cirrus", "cumulus", "sunny"]));
@ -27,13 +28,17 @@ function setBiome(biomeID)
g_BiomeID = biomeID;
loadBiomeFile("biomes/" + biomeID);
loadBiomeFile(biomeID);
Engine.LoadLibrary("rmbiome/" + biomeID.slice(0, biomeID.lastIndexOf("/")));
let setupBiomeFunc = global["setupBiome_" + biomeID];
if (setupBiomeFunc)
setupBiomeFunc();
}
/**
* Copies JSON contents to defined global variables.
*/
function loadBiomeFile(file)
{
let path = "maps/random/rmbiome/" + file + ".json";
@ -62,15 +67,22 @@ function loadBiomeFile(file)
};
for (let rmsGlobal in biome)
if (rmsGlobal != "Description")
copyProperties(biome[rmsGlobal], global["g_" + rmsGlobal]);
{
if (rmsGlobal == "Description")
continue;
if (!global["g_" + rmsGlobal])
throw new Error(rmsGlobal + " not defined!");
copyProperties(biome[rmsGlobal], global["g_" + rmsGlobal]);
}
}
function rBiomeTreeCount(multiplier = 1)
{
return [
g_TreeCount.minTrees * multiplier,
g_TreeCount.maxTrees * multiplier,
g_TreeCount.forestProbability
g_ResourceCounts.trees.min * multiplier,
g_ResourceCounts.trees.max * multiplier,
g_ResourceCounts.trees.forestProbability
];
}

View file

@ -4,7 +4,7 @@
"Script" : "snowflake_searocks.js",
"Description" : "Many small islands connected to each other by narrow passages.",
"Preview" : "snowflake_searocks.png",
"SupportedBiomes": true,
"SupportedBiomes": "generic/",
"CircularMap" : true
}
}

View file

@ -4,7 +4,7 @@
"Script" : "stronghold.js",
"Description" : "Teams start off with nearly adjacent civic centers, offering easy military and construction cooperation. With slivers of personal territory, teammates must rely on each other to defend their rear.",
"Preview" : "stronghold.png",
"SupportedBiomes": true,
"SupportedBiomes": "generic/",
"CircularMap" : true
}
}

View file

@ -5,7 +5,7 @@
"Description" : "[color=\"red\"]IMPORTANT NOTE: AI PLAYERS DO NOT WORK WITH THIS MAP[/color]\n\nProtect your base against endless waves of enemies. Use your woman citizen to collect the treasures at the center of the map before others do, and try to build your base up. The last player remaining will be the winner!",
"Keywords": ["trigger"],
"Preview" : "survivalofthefittest.png",
"SupportedBiomes": true,
"SupportedBiomes": "generic/",
"CircularMap" : true,
"TriggerScripts": [
"scripts/TriggerHelper.js",

View file

@ -4,7 +4,7 @@
"Script" : "unknown.js",
"Description" : "The unknown. Warning: May be a naval map.",
"Preview" : "unknown.png",
"SupportedBiomes": true,
"SupportedBiomes": "generic/",
"CircularMap" : true
}
}

View file

@ -4,7 +4,7 @@
"Script" : "unknown_land.js",
"Description" : "The unknown.",
"Preview" : "unknown.png",
"SupportedBiomes": true,
"SupportedBiomes": "generic/",
"CircularMap" : true
}
}

View file

@ -6,6 +6,6 @@
"Description" : "A lake surrounded by hills.",
"CircularMap" : true,
"Keywords": [],
"SupportedBiomes": true
"SupportedBiomes": "generic/"
}
}