Biomes

From RimWorld Wiki
Jump to navigation Jump to search


Modding Tutorials

?
Under Review
This tutorial or guide is currently undergoing review and may be subject to further revision.


This is a basic overview of biomes and their creation. As well as different places that a biome is taken into consideration.

BiomeDef[edit]

Biomes are defined in XML using BiomeDef Defs. As with all Defs, looking at the vanilla examples is a great way to get a feel for how the system is used. In order to generate a biome on the world map, biomes also require a workerClass defined in code. See Setting up a solution to get started.

Fields[edit]

The following are valid fields in BiomeDef. Not all fields are necessary, look at vanilla BiomeDefs for examples.

XML Example Description
<workerClass>MyCustomBiome.BiomeWorker_CustomForest</workerClass>

A reference to code that defines where your biome will spawn on the world map. In Rimworld, these start with BiomeWorker

<implemented>true</true>

Determines if the biome gets generated from WorldGenStep_Terrain. Defaults to true. Likely this is used for debugging/development purposes

<generatesNaturally>true</generatesNaturally>

Determines if the biome gets generated from WorldGenStep_Terrain. Requires implemented to be true. Defaults to true.

<canBuildBase>true</canBuildBase>

Determines if a player or npc faction can be generated here. Defaults to true.

<settlementSelectionWeight>0.75</settlementSelectionWeight>

How likely a settlement can spawn on the selected tile. This is a value from 0-1. Defaults to 1

<allowRoads>true</allowRoads>

Whether roads can appear on this biome. Note that unless both this and allowRivers are false, roads will still display visually. Defaults to true.

<allowRivers>true</allowRivers>

Whether rivers can appear on this biome. Note that unless both this and allowRoads are false, rivers will still display visually. Defaults to true.

<animalDensity>3.5</animalDensity>

How much animals will spawn on your biome. Higher numbers lead to an increase in animals.

<plantDensity>0.7</plantDensity>

How many plants will spawn on your biome. Higher numbers lead to an increase in plants.

<allowFarmingCamps>true</allowFarmingCamps>

(Ideology Content added by the Ideology DLC Only) Allow farming camps to spawn. Defaults to true.

<campSelectionWeight>0.65<campSelectionWeight>

(Ideology Content added by the Ideology DLC Only) How likely a camp can spawn on the selected tile. This is a value from 0-1. Defaults to 1

<pollutionOffset>0.2<pollutionOffset>

(Biotech Content added by the Biotech DLC Only) This will be the biomes initial pollution. This can be increased during the world creation screen.

<impassable>false</impassable>

Whether the biome can be passed via caravan.

<hasVirtualPlants>true</hasVirtualPlants>

Determines if animals are allowed to graze on this tile while caravanning. Defauilts to true.

<forageability>0.75<forageability>

A multiplier of nutrition foraged per day. Requires a foragedFood defined. This is also used for animals that can forageOdyssey Content added by the Odyssey DLC.

<foragedFood>RawBerries</foragedFood>

Food that will be retrieved.

<wildPlantsCareAboutLocalFertility>false</wildPlantsCareAboutLocalFertility>

If this is false and the tile you are in is not a mixed biome, total plant population is based on the whole map rather than a 20 cell radius. Defauilts to true.

<wildPlantsAreCavePlants>

Cave plants will count towards the total amount of plants on the tile. Defaults to false.

<wildPlantRegrowDays>13</wildPlantRegrowDays>

A wild plant has a chance to regrow after a set number of days. Defaults to 25.

<movementDifficulty>1.25</movementDifficulty>

The base movement difficulty for a caravan to travel across the tile.

<baseWeatherCommonalities>
  <Clear>18</Clear>
  <Fog>1</Fog>
  <Rain>2</Rain>
  <DryThunderstorm>1</DryThunderstorm>
  <RainyThunderstorm>1</RainyThunderstorm>
  <FoggyRain>1</FoggyRain>
  <SnowGentle>4</SnowGentle>
  <SnowHard>4</SnowHard>
  <GrayPall MayRequire="Ludeon.RimWorld.Anomaly">1</GrayPall>
  <Overcast MayRequire="Ludeon.RimWorld.Odyssey">2</Overcast>
</baseWeatherCommonalities>

What weather events can occur and how often they can occur. Note that multiple other variables are taken into effect with weather

<terrainsByFertility>
  <li>
    <terrain>Soil</terrain>
    <min>-999</min>
    <max>0.87</max>
  </li>
  <li>
    <terrain>SoilRich</terrain>
    <min>0.87</min>
    <max>999</max>
  </li>
</terrainsByFertility>

The terrain that will appear based on fertility values generated by the genSteps ElevationFertility and MutatorPostElevationFertility. Will default to regular soil if a value is omitted.

<terrainPatchMakers>
  <li>
    <perlinFrequency>0.04</perlinFrequency>
    <thresholds>
      <li>
        <terrain>MarshyTerrain</terrain>
        <min>0.7</min>
        <max>999</max>
      </li>
    </thresholds>
  </li>
</terrainPatchMakers>

Terrain generated through perlin noise. This can be used for patches of highly fertile soil, marshes, ponds, or other variable land. For a visual representation, you can use the Dev mode command Map noise visualizer.

<soundsAmbient>
  <li>Ambient_NightInsects_Standard</li>
</soundsAmbient>

Sounds that will play when zoomed in on the map.

<wildPlants>
  <Plant_TallGrass>3.2</Plant_TallGrass>
  <Plant_Chokevine>0.8</Plant_Chokevine>
  <Plant_Bush>0.2</Plant_Bush>
  <Plant_Witchwood MayRequire="Ludeon.RimWorld.Biotech">1.0</Plant_Witchwood>
  <Plant_Reeds MayRequire="Ludeon.RimWorld.Odyssey">1</Plant_Reeds>
  <Plant_LilyPad MayRequire="Ludeon.RimWorld.Odyssey">0.2</Plant_LilyPad>
  <Plant_Bulrush MayRequire="Ludeon.RimWorld.Odyssey">0.2</Plant_Bulrush>
</wildPlants>

What plants can spawn in the wild for this biome. Based on weight. These can also be included on a wild plants properties. Duplicates are not allowed between the two.

<wildAnimals>
  <Donkey>0.34</Donkey>
  <GuineaPig>0.48</GuineaPig>
  <Yak>0.05</Yak>
  <Bison>0.06</Bison>
  <Crow MayRequire="Ludeon.RimWorld.Odyssey">0.6</Crow>
  <Bluebird MayRequire="Ludeon.RimWorld.Odyssey">0.6</Bluebird>
  <Quail MayRequire="Ludeon.RimWorld.Odyssey">0.6</Quail>
</wildAnimals>

What animals can spawn in the biome based on weight. These can also be included on a wild animals race properties. Duplicates are not allowed between the two.

<pollutionWildAnimals>
  <Toxalope MayRequire="Ludeon.RimWorld.Biotech">0.3</Toxalope>
  <WasteRat MayRequire="Ludeon.RimWorld.Biotech">0.4</WasteRat>
  <Rat>1</Rat>
  <Raccoon>0.5</Raccoon>
</pollutionWildAnimals>

(Biotech Content added by the Biotech DLC Only) Animals defined in this field will only spawn if there is pollution on the map. The chance of these animals spawning is based on a curve with a 10% chance at 25% pollution, 90% chance at 75% pollution and 100% at 100% pollution

<coastalWildAnimals>
  <SeaLion MayRequire="Ludeon.RimWorld.Odyssey">0.1</SeaLion>
  <Seal MayRequire="Ludeon.RimWorld.Odyssey">0.1</Seal>
</coastalWildAnimals>

(Odyssey Content added by the Odyssey DLC Only) Animals defined here will spawn if the tile has the Coast TileMutatorDef. A coast requires a tile neighboring an ocean tile.

<diseaseMtbDays>50</diseaseMtbDays>

The mean time between a disease incident occurring. Possible diseases are chosen from diseases.

<diseases>
  <li>
    <diseaseInc>Disease_Flu</diseaseInc>
    <commonality>120</commonality>
  </li>
  <li>
    <diseaseInc>Disease_Plague</diseaseInc>
    <commonality>80</commonality>
  </li>
</diseases>

Possible diseases that can occur. One will be chosen at random by weight

<allowedPackAnimals>
  <li>Muffalo</li>
  <li>Alpaca</li>
</allowedPackAnimals>

Pack animals that can appear from caravan traders.

<hasBedrock>true</hasBedrock>

If a tile can be deep drilled for materials. Defaults to true. Also prevents the Ground-penetrating scanner from working on this tile.

<isExtremeBiome>true</isExtremeBiome>

Prevents spawning of Special trees. Defaults to false.

<isWaterBiome>false</isWaterBiome>

Unused field that is located on Ocean and Lake biomes.

<allowPollution>true</allowPollution>

Pollution can appear on the world maps tile. Defaults to true. Note that this tile can still be polluted while on the map tile or by sending a drop-pod of wastepacks to the area.

<wildAnimalsCanWanderInto>true</wildAnimalsCanWanderInto>

If false, animals will not appear when using the draw animals Anomaly Ritual. Defaults to true.

<noAmbientWind>false</noAmbientWind>

If false, When the camera is zoomed out, you will hear wind effects.

<inVacuum>false</inVacuum>

(Odyssey Content added by the Odyssey DLC Only) Tiles from this map will have no oxygen. Wind turbines will be unable to function.

<disableSkyLighting>false</disableSkyLighting>

Enables Sky Lighting. This is from weather events as well as day/night time.

<disableShadows>false</disableShadows>

Shadows from buildings and structures will not be displayed.

<canExitMap>true</canExitMap>

Determines if pawns are able to leave the map through caravan or other means. Defaults to True.

<onlyAllowWhitelistedArrivalModes>false</onlyAllowWhitelistedArrivalModes>

Only allow arrival modes for pawns as specified in their PawnsArrivalModeDef

<isBackgroundBiome>false</isBackgroundBiome>

Rotates coastal landmarks in the correct orientation when needed. Used for Ocean and Lake biomes.

<wildAnimalScariaChance>0.3</wildAnimalScariaChance>

The chance that a wild animal spawned will have scaria. Defaults to 0.

<geyserCountFactor>0.75</geyserCountFactor>

Multiplies the amount of Steam Geysers that can appear on the map. Defaults to 1

<constantOutdoorTemperature>10</constantOutdoorTemperature>

A set temperature for a map. Measured in Celsius.

<coastalBeachTerrain>Mud</coastalBeachTerrain>

Defines what terrain should be used when generating beach. Defaults to sand.

<lakeBeachTerrain>Ice</lakeBeachTerrain>

Defines what terrain should be used when generating a lake or beach. Defaults to sand.

<riverbankTerrain>Marsh</riverbankTerrain>

Defines what terrain should be used for the sides of a river. Requires a riverbankSizeRange defined. Defaults to RiverBank.

<riverbankSizeRange>

Size of a riverbank that can appear alongside a river.

<mudTerrain>MossyTerrain</mudTerrain>

(Odyssey Content added by the Odyssey DLC Only) Defines what terrain should be used when generating a Wetlands Tile mutator. Defaults to Mud.

<noGravel>false</noGravel>

If Gravel (Stony soil) should be generated.

<gravelTerrain>Ice</gravelTerrain>

Defines what terrain to use when generating gravel. Defaults to Stony Soil. Requires noGravel to be false.

<waterShallowTerrain>SoilRich<waterShallowTerrain>

Defines what terrain to use when generating shallow water for TileMutatorDefs. Defaults to shallow water.

<waterDeepTerrain>WaterOceanDeep</waterDeepTerrain>

Defines what terrain to use when generating deep water for TileMutatorDefs. Defaults to deep water.

<oceanShallowTerrain>MossyTerrain</oceanShallowTerrain>

Defines what terrain should be used when generating shallow ocean water for TileMutatorDefs. Defaults to shallow ocean Water

<oceanDeepTerrain>Mud</oceanDeepTerrain>

Defines what terrain should be used when generating Deep ocean water for TileMutatorDefs. Defaults to deep ocean water

<waterMovingShallowTerrain>Mud</waterMovingShallowTerrain>

Defines what terrain should be used when generating shallow moving water for TileMutatorDefs. Defaults to shallow moving water

<waterMovingChestDeepTerrain>Sand</waterMovingChestDeepTerrain>

Defines what terrain should be used when generating deep moving water for TileMutatorDefs. Defaults to chest-deep moving water

<biomeMapConditions>
  <li>SolarFlare</li>
<biomeMapConditions>

A list of permanent GameConditionDef that can occur on the map.

<extraGenSteps>
  <li>MNCS_CheeseChunks</li>
  <li>MNCS_MoonHives</li>
  <li>MNCS_FixPlayerStartSpot</li>
</extraGenSteps>

Extra GenStepDef that can occur on this biomes maps.

<preventGenSteps>
  <li>RockChunks</li>
  <li>CaveHives</li>
</preventGenSteps>

These GenStepDef will not occur on this biomes maps.

<extraRockTypes>
  <li>SolidIce</li>
</extraRockTypes>

Provided that the rock is defined as biomeSpecific, these rocks will be able to appear on the selected biome naturally

<forceRockTypes>
  <li>Sandstone</li>
</forceRockTypes>

Only rocks defined in this field will appear. This is a 100% rate meaning no variation on the biome.

<maxFishPopulation>500</maxFishPopulation>

(Odyssey Content added by the Odyssey DLC Only) The maximum amount of fish a body of water is able to have. Defaults to 0.

<fishTypes>
  <freshwater_Common>
    <Fish_Bass MayRequire="Ludeon.RimWorld.Odyssey">1</Fish_Bass>
  </freshwater_Common>
  <freshwater_Uncommon>
    <Fish_Catfish MayRequire="Ludeon.RimWorld.Odyssey">1</Fish_Catfish>
  </freshwater_Uncommon>
  <saltwater_Common>
    <Fish_Bluefish MayRequire="Ludeon.RimWorld.Odyssey">1</Fish_Bluefish>
  </saltwater_Common>
  <saltwater_Uncommon>
    <Fish_Marlin MayRequire="Ludeon.RimWorld.Odyssey">1</Fish_Marlin>
    <Fish_Flounder MayRequire="Ludeon.RimWorld.Odyssey">1</Fish_Flounder>
  </saltwater_Uncommon>
  <rareCatchesSetMaker 
  MayRequire="Ludeon.RimWorld.Odyssey">RareFishingCatches_Temperate</rareCatchesSetMaker>
</fishTypes>

(Odyssey Content added by the Odyssey DLC Only) Fish that can appear in bodies of water. If multiple fish are in a list, one is randomly chosen.

<layerWhitelist>
  <li>MP_MyCustomPlanetLayer</li>
</layerWhitelist>

PlanetLayerDef this biome is allowed to occur in. If this is set it will only appear on the specified layers

<layerBlacklist>
  <li>Surface</li>
</layerBlacklist>

PlanetLayerDef this biome is not allowed to occur in. If this is set it will not appear in on the specified layers

<settleWarning>This biome is very dangerous.</settleWarning>

A warning that can appear when trying to settle on a tile of that biome.

<fogOfWarColor>(249,145,104)</fogOfWarColor>

The color of Fog of war. Fogged/undiscovered locations on your map. Default is null and this field is not necessary to fill in. Normal fog of war color is (77, 69, 66).

<orbitalDebris>

TODO

<texture>World/Biomes/MNCS_SurfaceSwiss</texture>

The texture that will be displayed on the world map. Vanilla uses a 512x512 texture.

Determining Biome[edit]

Biome calculation is done during world generations WorldGenStep_Terrain. Each tile is calculated individually. After verifying the biome can be placed via the BiomeDefs generatesNaturally, and the BiomeWorkers CanPlaceOnLayer, it's score is calculated from the individual biome workers GetScore. The biome with the highest score will be placed on that specific tile.

Biome Generation[edit]

There is no right or wrong way to create the score for biomes. If you look at biome workers, many of them will use different formula or logic to appear on the map. Here is an example used from the mod Gulden Biome (Continued).

// We are subclassing the temperate forest biome worker
public class BiomeWorker_GuldenForest : BiomeWorker_TemperateForest
{
  public override float GetScore(BiomeDef biome, Tile tile, PlanetTile planetTile) {
    // We don't want to completely overwrite the parent biome. 
    // That's why we only want tiles with an elevation between 500 and 800.
    if (tile.elevation is <= 500 or >= 800) {
        return 0;
    }
    
    // Get what the score is of the parent biome, temperate forest
    float score = base.GetScore(biome, tile, planetTile);
    // If that score is 0 or less we don't want this biome there.
    if (score <= 0) {
        return 0;
    }
    
    // We add 1.5 so that it is higher than the temperate forest.
    // We don't want this number too large, otherwise it will overwrite other biomes.
    return score + 1.5f;
  }
}

Places That Use Biomes[edit]

In addition to the fields required for biomes, some feilds require knowledge of the biome to trigger specific events or occurences. In these cases a patch operation will be necessary

Animals and plants[edit]

Animals and plants can also set where they spawn in their raceProperties and plantProperties respectively. Duplicates are not allowed between the biome and properties list. You are not able to set Their pollution appearance rate or coastal appearance rate through their properties either. Either method is acceptable for appearance rates. However, if you are creating a biome, it might be more sensible to place the appearances in the BiomeDef.

IncidentDefs[edit]

Ambush, ManhunterAmbush, CaravanMeeting, and CaravanDemand requires a biome listed in their mtbDaysByBiome to be considered a valid map to have their incidents occur. Some incidents have sallowedBiomes or disallowedBiomes. Alphabeavers for example can only appear in the Tundra or Arid Shrubland.

FeatureDefs[edit]

FeatureDefs generate names that can appear alongside landforms on the world map. These are things like "Barra Sea", "Bat Cheek Flats", and "Gorar Desert". Some FeatureDefs have rootBiome and acceptableBiome. For example, the Desert FeatureDef has Desert and ExtremeDesert as rootBiomes meaning at least one of these are required for an area to be given this name. acceptableBiomes are adjacent biomes that can also fulfill the qualifications for the Desert Feature. This is purely for visual and does not have impact on gameplay.

TileMutatorDefs[edit]

Most TileMutatorDefs, as well as landmarks in Odyssey will not be active on a biome unless they are patched into the TileMutatorDefs biomeWhitelist. You can also restrict certain biomes using the biomeBlacklist. LoadFolders is recommended here.