Mechanics

From Lethal Company Wiki
This page contains changes which are not marked for translation.
Global Game Variables
Game Cycle
Hour Length60
Hour Count18
Time Speed Multiplier1.4
Ship Leave Time11:55 PM
Level Generation
Scrap Value Multiplier0.4
Scrap Amount Multiplier1.0
Map Size Multiplier1.5
Spawning Cooldown2h


This article is meant to give experienced employees an in-depth view behind various game mechanics such as entity spawning, game cycles, scrap collection and much more to come.

This article is still in its early stages and more information will be added in the future as our team gathers more behind the scenes intel. All the values and information referenced here is up-to-date as of Version 45.

Game variables[edit]

The infobox on the right provides global variables that define game values. These and other moon / entity / scrap specific variables will be referenced in camel case notation (e.g. 'Hour Length' will be referred as hourLength and a moon's 'Map Size Multiplier' will be referred as mapSizeMultiplier).

Game variables are static, meaning they are the same for everyone and don't change over the course of a game. They might be adjusted by Zeekerss in future Lethal Company updates.

General principles[edit]

Time calculations[edit]

Time in Lethal Company is defined by the variables hourLength and hoursCount. To be able to use time with curves, we need to work with normalized time. To get the normalized time, we have to divide current time by the total time (hourLength * hoursCount). Normalized time is a value between 0 and 1 and can be seen as the fraction of the day that has already passed.

Animation curves[edit]

Many mechanics in Lethal Company are based on Unity's Animation Curves. An animation curve is a mathematical function, that maps a value X (e.g. Time of Day) to another value Y (e.g. Spawn Chance). In the case of Lethal Company, the curves are interpolated using Hermite cubic spline interpolation, which basically means that we are given set of input points, or keyframes (the black dots) and slopes that define how the curve is 'bent' around the points to then calculate the actual curve (the orange line). Here are the three Entity Spawn Curves of Experimentation.

And here is the spawn probability curve of a Baboon Hawk.

When describing a value retrieved from a curve, the pseudo-function curve.eval(Y) will be used.

Entity spawning[edit]

Entity spawning in Lethal Company is quite complicated and dependent on a lot of variables. This section provides a very detailed description of the different spawning algorithms and the involved parameters.

The entity spawning cycle runs once at the start of each round and periodically after that until the day ends or the ship leaves early. The interval of the spawning cycle is dependent on the spawningCooldown. A cooldown of 2 (the default value) means that the game waits for 2 hours before the next spawn cycle is executed.

Spawning requirements[edit]

The spawning algorithm for an entity category is only executed if that category's Power Count is not yet at its maximum. For example, if the Bracken (Power Level 3) and a Thumper (Power Level 3) are already present on Assurance, the moon's Max Indoor Power of 6 is reached and no additional indoor entities will spawn until the power count goes down.

Spawning algorithm (Daytime Entities)[edit]

The amount of daytime entities spawned is based of the moon's Daytime Spawn Probability Curve and Daytime Spawn Deviation. The base spawn count is retrieved from evaluating the curve with the normalized time of day. Normalized day of time is calculating by dividing the current time by the total time, this way it is possible to time as a decimal between 0 and 1.

The actual spawn count is a number, randomly chosen in the following range.

  • Min Spawn Count: daytimeCurve.eval(normalizedTime) - daytimeSpawnDeviation
  • Max Spawn Count: daytimeCurve.eval(normalizedTime) + daytimeSpawnDeviation

This spawn count is then clamped between 0 and 20. There will never be more than 20 daytime entities on the map at the same time.

After the amount of entities to be spawned has been determined, the game determines which entities to spawn. For each entity slot, a list of spawn probabilities is created based on each entity's eligibility to be spawned. The eligibility is calculated based on the following factors.

  • Max Count: The entity's spawn count wouldn't exceed its own Max Count
  • Power Level: The added entity's power level wouldn't exceed the moon's Max Daytime Power
  • Latest Spawn Time: The entity's latest spawn time has not yet passed (e.g. Roaming Locusts stop spawning after 7:41 PM)

The spawn chance for ineligible entities is set to 0. Eligible entities get their current moon spawn chance multiplied by their own Spawn Probability Curve value that is based on the Time of Day. If the entity uses Spawn Count Falloff and therefore has a Spawn Count Falloff curve, the spawn chance also gets multiplied by that curve value, evaluated for the amount of already spawned entities of the same type. Finally, the game picks a random weighted index from the list of eligible entities. The selected entity gets spawned immediately at one of the predefined daytime entity spawn points.

Spawning algorithm (Nighttime Entities)[edit]

The amount of nighttime entities spawned is based of the moon's Nighttime Spawn Probability Curve and Nighttime Spawn Deviation. The base spawn count is retrieved from evaluating the curve with the normalized time of day. Normalized day of time is calculating by dividing the current time by the total time, this way it is possible to time as a decimal between 0 and 1.

The actual spawn count is also a number, randomly chosen from a range. The minimum count is dependent on how many days are left until the quota must be reached (daysUntilDeadline). The more days have passed, the more likely it becomes for entities to spawn.

  • Min Spawn Count: nighttimeCurve.eval(normalizedTime) + abs(daysUntilDeadline-3) / 1.6 - 3
  • Max Spawn Count: nighttimeCurve.eval(normalizedTime) + 3

This spawn count is then clamped between minOutsideEnemiesToSpawn and 20. The variable minOutsideEnemiesToSpawn is set to 0 by default but can change to a predefined value if the current moon is eclipsed. Each moon has its own minOutsideEnemiesToSpawn during eclipses which can be found on their individual pages.

After the amount of entities to be spawned has been determined, the game determines which entities to spawn. For each entity slot, a list of spawn probabilities is created based on each entity's eligibility to be spawned. The eligibility is calculated based on the following factors.

  • Max Count: The entity's spawn count wouldn't exceed its own Max Count
  • Power Level: The added entity's power level wouldn't exceed the moon's Max Nighttime Power
  • Latest Spawn Time: The entity's latest spawn time has not yet passed

The spawn chance for ineligible entities is set to 0. Eligible entities get their current moon spawn chance multiplied by their own Spawn Probability Curve value that is evaluated for the current Time of Day. If the entity uses Spawn Count Falloff and therefore has a Spawn Count Falloff curve, the spawn chance also gets multiplied by that curve value, evaluated for the amount of already spawned entities of the same type. Finally, the game picks a random weighted index from the list of eligible entities. The selected entity gets spawned immediately at one of the predefined nighttime entity spawn points.

Spawning algorithm (Indoor Entities)[edit]

The spawn algorithm for indoor entities is more complicated than the previous two since indoor enemies don't spawn instantly and are instead assigned a vent and a timer that specifies when the entity will be spawned from that vent.

The amount of indoor entities spawned is based of the moon's Indoor Spawn Probability Curve and Indoor Spawn Deviation. The base spawn count is retrieved from evaluating the curve with the normalized time of day.

The actual spawn count is again, a number that is randomly chosen from a range. As with outdoor entities, the minimum count is dependent on how many days are left until the quota must be reached (daysUntilDeadline). The more days have passed, the more likely it becomes for indoor entities to spawn.

  • Min Spawn Count: indoorCurve.eval(normalizedTime) + abs(daysUntilDeadline-3) / 1.6 - indoorSpawnDeviation
  • Max Spawn Count: indoorCurve.eval(normalizedTime) + indoorSpawnDeviation

This spawn count is then clamped between minEnemiesToSpawn and 20 or the amount of free vents on the map. Every selected entity must be able to be assigned to a free vent later. The variable minEnemiesToSpawn is set to 0 by default but can change to a predefined value if the current moon is eclipsed, or to 2 (with a 70% chance) when an apparatus is collected. Each moon has its own minEnemiesToSpawn during eclipses which can be found on their individual pages.

In addition to this, before clamping occurs, if one day has already passed and minEnemiesToSpawn is still set to 0 (the current moon is not eclipsed, and apparatus has not increased spawn rates), minEnemiesToSpawn will be set to 1 if one of the following conditions is met.

  • Percentage of scrap found in the current round is greater than or equal to the profit quota and it's after 11:24 AM (intended to be greater than 80% of quota, but a typo causes percentage to round down to a multiple of 100%)
  • Percentage of scrap found in the current round is greater than 65% of the total scrap value on the map
  • At least 5 rounds have passed (total, not necessarily consecutively) where more than 30 credits worth of scrap was collected and no players died. If a player dies at any point, the count starts over from 0.

After the amount of entities to be spawned has been determined, the game determines which entities to spawn. For each entity slot, a list of spawn probabilities is created based on each entity's eligibility to be spawned. The eligibility is calculated based on the following factors.

  • Max Count: The entity's spawn count wouldn't exceed its own Max Count
  • Power Level: The added entity's power level wouldn't exceed the moon's Max Indoor Power
  • Latest Spawn Time: The entity's latest spawn time has not yet passed

The spawn chance for ineligible entities is set to 0. Eligible entities get their current moon spawn chance multiplied by their own Spawn Probability Curve value that is evaluated for the current time of day. Entities that use Spawn Count Falloff and therefore have a Spawn Count Falloff curve, also have their spawn chance multiplied by that curve's value, evaluated for the amount of already spawned entities of that same type.

Finally, the game picks a random weighted index from the list of eligible entities. The selected entity is then assigned to a randomly picked free vent on the map alongside a randomly determined spawn delay. The spawn delay is clamped between the current time and the start of the next spawn cycle.

An indoor entity's spawningDelay defines how far in advance the vent crawling sound will be played. The sound starts off quiet and gets louder over time. Once the spawningDelay is over the sound stops, the vent opens and the assigned entity spawns in front of the vent. The vent then resets and is ready to be assigned again in the next spawn cycle.