Random map scripts can use predefined biomes. This allows specification of one biome that will be used by many maps.

Using The Random Biome System

In order to use the random biome library, the JSON file of the random map script needs to either specify that it can support all biomes, or specify an array of supported biome names. So for instance

"SupportedBiomes": true


"SupportedBiomes": [

These biomes are then selectable in the gamesetup.

The random map script has to to include and initialize the library using


// ...


After that, four globals inform the random map script which values to use for map generation:

  • g_Environment: sun, water, fog settings
  • g_Terrains: texture filenames
  • g_Gaia: template names of animals, trees and mines
  • g_Decoratives: grass, rocks and flower template names
  • g_TreeCount: determines the total of trees and the likelihood of a tree being part of a forest. These values are specifically useful for the createStragglerTrees and createForests function.

See the issue below for the properties in detail.

Adding New Biomes

A biome is defined by a JSON file in binaries/data/mods/public/maps/random/rmbiome/biomes/. See this example:

	"Description": {
		"Title": "Savanna",
		"Description": "The savanna, a dry climate in which only the hardy Baobab trees thrive. Solitary gazelles graze the sparse grass, while herds of zebras, wildebeest, giraffes or elephants roam the wild in search of food."
	"Environment": {
		"Water": {
			"WaterBody": {
				"Color": { "r": 0.055, "g": 0.176, "b": 0.431 },
				"Tint": { "r": 0.227, "g": 0.749, "b": 0.549 },
				"Murkiness": 0.77,
				"Waviness": 1.5
		"Fog": {
			"FogThickness": 0.15,
			"FogFactor": 0.0025,
			"FogColor": { "r": 0.847059, "g": 0.737255, "b": 0.482353 }
		"Postproc": {
			"PostprocEffect": "hdr",
			"Contrast": 1.07031,
			"Bloom": 0.132
	"Terrains": {
		"mainTerrain": [
		"forestFloor1": "savanna_forestfloor_a",
		"forestFloor2": "savanna_forestfloor_b",
		"cliff": [
		"tier1Terrain": "savanna_shrubs_a",
		"tier2Terrain": "savanna_dirt_rocks_b",
		"tier3Terrain": "savanna_dirt_rocks_a",
		"tier4Terrain": "savanna_grass_a",
		"hill": [
		"dirt": [
		"road": "savanna_tile_a",
		"roadWild": "savanna_tile_a",
		"shoreBlend": "savanna_riparian",
		"shore": "savanna_riparian_bank",
		"water": "savanna_riparian_wet"
	"Gaia": {
		"tree1": "gaia/flora_tree_baobab",
		"tree2": "gaia/flora_tree_baobab",
		"tree3": "gaia/flora_tree_baobab",
		"tree4": "gaia/flora_tree_baobab",
		"tree5": "gaia/flora_tree_baobab",
		"fruitBush": "gaia/flora_bush_grapes",
		"chicken": "gaia/fauna_chicken",
		"fish": "gaia/fauna_fish",
		"secondaryHuntableAnimal": "gaia/fauna_gazelle",
		"stoneLarge": "gaia/geology_stonemine_desert_quarry",
		"stoneSmall": "gaia/geology_stone_savanna_small",
		"metalLarge": "gaia/geology_metal_savanna_slabs"
	"Decoratives": {
		"grass": "actor|props/flora/grass_savanna.xml",
		"grassShort": "actor|props/flora/grass_medit_field.xml",
		"reeds": "actor|props/flora/reeds_pond_lush_a.xml",
		"lillies": "actor|props/flora/reeds_pond_lush_b.xml",
		"rockLarge": "actor|geology/stone_savanna_med.xml",
		"rockMedium": "actor|geology/stone_savanna_med.xml",
		"bushMedium": "actor|props/flora/bush_desert_dry_a.xml",
		"bushSmall": "actor|props/flora/bush_dry_a.xml",
		"tree": "actor|flora/trees/baobab.xml"
	"TreeCount": {
		"minTrees": 200,
		"maxTrees": 1250,
		"forestProbability": 0

A biome can optionally execute some JavaScript code upon initialization. In that case there should be a JS file with the same name in that biomes directory. It must contain a function starting with setupBiome_ followed by the name of the Biome identifier:

function setupBiome_savanna()
	g_Gaia.mainHuntableAnimal = pickRandom([
Last modified 6 years ago Last modified on Dec 5, 2017, 11:36:41 PM
Note: See TracWiki for help on using the wiki.