Lineage System

From Rain World Wiki
Jump to navigation Jump to search

This is a technical page, which may have unmarked spoilers.

Technical pages document the mechanics of Rain World in much greater detail than is necessary to know for most purposes.

Technical pages may also make use of terms defined in the technical glossary.

Other languages:

Some dens use a lineage system wherein killing a creature has a chance to replace it permanently with a different creature.

Overview

A lineage den consists of multiple stages. Each stage contains a chance to progress to the next one and a creature (including NONE). On the last stage, the chance is necessarily set to 0%. There are two types of stages:

  • Creature of NONE results in the den not being occupied for the cycle. This chance is rolled when the region is loaded.[1] This includes but is not limited to crossing a gate into the region, starting a cycle in it, or passaging into it. Passaging in particular results in this check being done 5 times.
  • If the stage is a creature, then the chance is rolled if and only if the creature inside was killed by a Slugcat, and it's checked on the moment of the kill.[2]However, the lineage den does not save progress until a successful hibernation happens.

Not directly related to the Lineage mechanic, if a creature occupying the den is killed by a Slugcat, the den gets marked as awaiting a roll. For such dens, on the end of a cycle there is a 1/3 chance (1/2 chance for Hunter, Artificer, and Spearmaster) for it to allow respawning the creature that's currently there. If the creature wasn't killed by Slugcat, then the den will necessarily allow a respawn on the next cycle.

This is usually called the respawn chance. If a den doesn't have a lineage, then this is effectively equivalent to a 1/3 (1/2) chance that a creature of the same type as was killed will spawn on the beginning of the next cycle. However, the ID of the respawned creature will be distinct, possibly creating a unique appearance and personality values.

This process does not check what creature is currently located in the den: even if it's a lineage den on a stage with no creature, it may still be in the state of awaiting a roll and will indeed do the roll on the beginning of the cycle to see whether the den will allow a creature to be respawned on the next cycle. It is possible for a lineage stage to succeed, but for the den to remain marked as awaiting the roll if the respawn chance fails, therefore it is only possible to tell whether a lineage has succeeded or not when the next creature stage spawns.

Examples

A lineage den is defined internally in a region's world.txt. Each lineage specifies a room, a den number, and a list of creatures, each with a probability to lineage when killed.

For instance, Outskirts has the following lineage den:

LINEAGE : SU_A40 : 2 : Green-0.1, Pink-0.5, Blue-0.2, Red-0

The first time Outskirts is loaded, a Green Lizard spawns from this den. Each time this Green Lizard is killed, there is a 10% chance that it lineages to a Pink Lizard which permanently replaces the Green Lizard for this campaign. The Pink Lizard has a 50% chance per kill to be replaced by a Blue Lizard, which has a 20% chance per kill to be replaced by a Red Lizard. The Red Lizard has a 0% chance to lineage and thus is never replaced.

A lineage den may have an empty spawn in its list:

LINEAGE : SU_A02 : 3 : NONE-0.05, Mimic-{18}-0.4, Mimic-{14}-0.4, TentaclePlant-0

Empty spawns roll their chance to lineage every cycle. Starting from when this den is first loaded, there is a 5% chance each cycle that the den lineages to a size 18 Pole Plant.

Cumulative probability

If a creature has some individual probability PI to lineage, the chance that it lineages in n kills or fewer is . For instance, killing a creature with a 1% individual chance to lineage 100 times gives a cumulative probability to lineage.

The number of kills needed to reach some target cumulative lineage probability PT is . For instance, a creature with a 1% individual chance to lineage has to be killed times to have a 50% cumulative probability to lineage - that is, there is about a 50% chance that it will take more than 69 kills to lineage.

The median number of cycles to lineage a den depends on the current creature respawning when it does not lineage. If the respawn chance is 33%, then the average number of cycles between lineage rolls is about 3, and the median number of cycles to cause a 1% individual lineage chance to pass is about 69 * 3 = 207.

Unless the individual lineage chance is 100%, lineage is never guaranteed for any number of kills, although the cumulative lineage chance grows arbitrarily close to 100% with each kill.

Trivia

  • Lineaging is the only way to encounter Red Lizards, King Vultures and Red Centipedes as Survivor and Monk.
  • In game versions between v1.5 and v1.8, injured creatures do not regain health at the end of a cycle and so remain in their den indefinitely. It is possible to despawn entire regions this way. This glitch was fixed in the v1.9 update.
  • If a region is multi-spawned, each creature belonging to a given lineage den rolls a separate chance to advance the same lineage (that is, they do not belong to two separate lineages).
  • Lineages are depicted in the interactive maps for vanilla and Downpour as vertical lists of creature icons with lineage chances printed on top.

Notes

  1. See WorldLoader.GeneratePopulation()
  2. The console log receives Lineage <DEN_ID> progressed to <NEW_CREATURE_TYPE>. See World.Lineage.ChanceToProgress().