Skip to main content

ForestBiome

A class in Root.Township, the global namespace.

A forest generation biome asset, with weighting and noise settings used to score which biome wins at a point. Looked up by hash like other HashedGeneralValue assets.

Constructors​

MemberWhat it is
ForestBiome()Use ScriptableObject.CreateInstance instead of new; Unity loads the saved ones from assets.

Fields​

10 private and internal fields
MemberWhat it is
private Biome biomeDefinitionBacking field for BiomeDefinition, the biome this forest biome spawns.
private Color colorBacking field for Color, probably for debug views. Default white.
private float maximumRadiusBacking field for MaximumRadius. Default 500.
private float minimumRadiusBacking field for MinimumRadius. Default 100.
private ForestBiome parentBacking field for Parent.
private ForestBiome[] parentsBacking field for Parents.
private float randomExtraWeightBacking field for RandomExtraWeight: up to this much random weight is added in GetScore. Default 0.2.
private float simplexScaleBacking field for SimplexScale: noise coordinates are divided by this in GetScore. Default 100.
private float weightingBacking field for Weighting, multiplied into the noise score. Default 1.
private int wOffsetBacking field for WOffset, the noise's fourth coordinate. OnValidate picks a random one when it's 0 or less.

Properties​

MemberWhat it is
Biome BiomeDefinition { get; }The Biome this forest biome is tied to.
Color Color { get; }Display colour for the biome, probably for debug maps.
float MaximumRadius { get; }Largest radius setting for a patch of this biome (500 by default).
float MinimumRadius { get; }Smallest radius setting for a patch of this biome (100 by default).
ForestBiome Parent { get; }A single parent biome.
ForestBiome[] Parents { get; }Parent biomes this one can appear inside.
float RandomExtraWeight { get; }Most random weight added to the score per call (0.2 by default).
float SimplexScale { get; }Noise scale. Larger values make bigger, smoother patches.
float Weighting { get; }Multiplier on the noise when scoring.
int WOffset { get; }Fourth noise coordinate (divided by 10000), so each biome gets different noise.

Methods​

MemberWhat it is
float GetScore(SimplexNoise noise, Random random, Vector3 point, float strengthMultiplier = 1)Simplex noise at the point (scaled by SimplexScale, offset by WOffset) times the weighting plus a random extra.
protected override void OnValidate()Editor: gives the biome a random noise offset if it has none.

Used in​

Members of other types that take, return or hold a ForestBiome: