Rest

From RimWorld Wiki
Revision as of 02:08, 27 July 2021 by Kaedys (talk | contribs) (Updated formatting in several places. Added columns to a couple tables with more information. Added analysis section for converting a given rest effectiveness and rest rate multiplier into the percentage of a day that a pawn can stay awake and still get enough sleep to reach 100% rest again.)
Jump to navigation Jump to search


Rest is the game mechanic that controls Characters' needs for sleep. A character with a higher rest value has slept recently, and is less tired than another character with a low rest level.

Levels of Rest

Characters' rest level is grouped into four thresholds: Rested, Tired, Very Tired, and Exhausted. Each threshold exhibits different effects on a character, especially their Thoughts. When a character's rest level is zero they may collapse from exhaustion; they will immediately begin sleeping on the ground wherever they are.

The rest levels are as follows:

Label Rest
Rested >= 28%
Tired >=14% and <28%
Very Tired >=1% and <14%
Exhausted <=1%

Rest caps at 0% and 100%.

Rest Changes

Negative

When awake, rest goes down every 150 ticks (1/400 of a game day) depending on the character's current rest.

Rest threshold Rest change per 150 ticks Rest change per game day Time between previous and next thresholds Time since 100% rest
Rested (100 => 28) -0.2375% -95% ~0.758 days / ~18.189 hours ~0.758 days / ~18.189 hours
Tired (28 => 14) -0.16625% -66.5% ~0.211 days / ~5.053 hours ~0.968 days / ~23.242 hours
Very Tired (14 => 1) -0.07125% -28.5% ~0.456 days / ~10.947 hours ~1.425 days / ~34.189 hours
Exhausted (1 => 0) -0.1425% -57% ~0.018 days / ~0.421 hours ~1.442 days / ~34.611 hours

Positive

When a character rests in a bed, their Rest value increases over time. At 100% Rest Effectiveness and 100% Rest Rate Multiplier, a character requires 10.5 hours (26,250 ticks) to full rest from 0% to 100%.

 Every 150 ticks (2.5 seconds at 1x speed), rest increases by 100% * (Ticks in interval (150) / Ticks Per Game Day (60000)) * (Hours per day (24) / Sleep Hours for Full (10.5)) * Rest Effectiveness * Rest Rate Multiplier
 = 100% * (150 * 24) / (60000 * 10.5) * Rest Effectiveness * Rest Rate Multiplier
 = (100%/175) * Rest Effectiveness * Rest Rate Multiplier
 = ~0.57143% * Rest Effectiveness * Rest Rate Multiplier

175 of these 150-tick intervals is the 26,250 ticks (10.5 in-game hours) required to fully rest from 0%.

Multipliers

Rest Rate Multiplier is a character (pawn) stat that defaults at 1.0 and is based off blood pumping, metabolism, and breathing capacities (and thus is affected by relevant injuries, bionics, etc.)

  • Blood Pumping has a .3 weight
  • Metabolism has a .3 weight
  • Breathing has a .3 weight

Rest Effectiveness depends on the object the character is sleeping on:

Object Rest Effectiveness at Normal quality Rest increase per 150 ticks Rest increase per full 24-hour game day
Sleeping Spot or Ground 0.8 ~0.45714% ~182.857%
Bedroll 0.95 ~0.54286% ~217.143%
Bed 1.0 ~0.57143% ~228.571%
Royal Bed 1.05 0.6% 240%

and the quality of that object:

Quality Rest Effectiveness Multiplier
Awful 0.86
Poor 0.92
Normal 1.0
Good 1.08
Excellent 1.14
Masterwork 1.25
Legendary 1.6

Therefore, when a character with 100% Rest Rate Multiplier reaches the Tired threshold (28%), it takes them this long to return to full (100%) rest:

Object Ticks to Full Rest Hours to Full Rest % of Day to Full Rest
Sleeping Spot / Ground (0.8) 23,625 ‭9.45 39.375%
Normal Bed (1.0) 18,900 7.56 31.5%
Legendary Royal Bed (1.05 * 1.6 = 1.68) 11,250 4.5 18.75%

Analysis

There exists a balance point for every type/quality of bed (and character, if that character has offsets to Rest Rate Multiplier or Rest Fall Rate), in which the hours spent sleeping and the hours spent awake during a 24-hour period precisely balance. This is ultimately a piecewise equation, as the rest fall rate is piecewise based on the current rest level (see above). We can ignore the Exhausted category, as a character must spend >24 hours awake (if starting at 100% rest) before reaching that threshold.

As long as the character is awake for less than 18.189 hours per day, however, this is a single-part equation, as the character will never reach Tired. The percentage of the day that the character may stay awake, expressed as a decimal value, with a given RestMult (equal to Rest Effectiveness * Rest Rate Multiplier) is reached by solving the following equation for %DayAwake:

 0.95 * %DayAwake = (1 - %DayAwake) * (24/10.5) * RestMult

This gives the following equation:

 %DayAwake = (320 * RestMult) / (320 * RestMult + 133)

At 1.0 RestMult (normal unmodified character in a normal quality regular bed), this gives a value of 70.64% of the day awake, or ~16.95 hours. Higher RestMults will grant more hours per day awake per this equation, up to 18.189 hours (75.789% of the day) awake.

Beyond that point, we need a piecewise equation. The RestMult needed to be awake for 18.189 hours per day (0.75789 %DayAwake) is 1.301, which can be achieved with only a masterwork Royal Bed. After this point, we can use a fixed value for the ~75% of the day awake before hitting Tired, which results in a 72% drop in rest, and then compute the remainder of the time awake off of the rest fall rate when Tired (66.5% per day rather than 95% per day). This can be found by solving:

 0.72 + (%DayAwake - (0.72/0.95))*0.665 = (1 - %DayAwake) * (24/10.5) * RestMult

This gives:

 %DayAwake = (16000*RestMult - 1512) / (16000*RestMult + 4655)

At 1.3125 RestMult (an unmodified character in a masterwork Royal Bed), which is just past the threshold where this equation is needed, this gives a value of 75.962% 0f the day awake, or 18.231 hours.

At 1.68 Rest Effectiveness (the legendary quality Royal Bed in the table above) and a character with the Quick Sleeper trait (+50% Rest Rate Multiplier), a Bionic Heart (+25% Blood Pumping = +7.5% Rest Rate Multiplier), and a Bionic or Royalty stomach (all of which are +25% part efficiency -> +12.5% Metabolism -> +3.75% Rest Rate Multiplier), for a net of 1.6125 Rest Rate Multiplier, the RestMult = 1.68 * 1.6125 = 2.709. At that level, the character can be awake for 87.152% of the day, or 20.916 hours.

In theory, there also exists a point at which the Exhausted piece of the equation becomes a factor, but this would require a pawn to be awake for at least 96.84% of the day (23.242 hours). This would require a RestMult of at least 11.915 (ie. 1191.5%), which is impossible to hit in the base game (and even with most mod setups), and thus can be ignored.

If the character is using a Circadian assistant, their rest fall rate is reduced by 20%, meaning it takes 25% longer to reach each threshold. The equations in this case must be re-derived (derivation is left as an exercise for the reader), but the simple answer is:

  • A character otherwise unmodified except for the Circadian Assistant, using a normal quality bed, can be awake for ~75.047% of the day (~18.011 hours), about 6.3% more of the day than without the implant.
  • An otherwise-unmodified character in a masterwork Royal Bed can be awake for ~79.787% of a day (~19.149 hours), about 5% more of the day.
  • The above bionically-modified Quick Sleeper pawn in a legendary quality Royal Bed, with the addition of a Circadian Assistant, could be awake for ~89.068% of a day (~21.376 hours), about 2.2% more of the day.
  • None of these characters would ever reach "Tired", which takes ~94.737% of a day, or ~22.737 hours, with a Circadian Assistant installed.

See Also

Pawn Sleeping furniture:

  • Sleeping spot - a free method to designate a place to sleep, but uncomfortable with terrible rest effectivness.
  • Double sleeping spot - a sleeping spot equvialent bed that allows up to two pawns to sleep together.
  • Bedroll - a portable, lower tech version of the bed that provides less comfort and rest effectivness.
  • Double bedroll - a bedroll equvialent bed that allows up to two pawns to sleep together.
  • Double bed - a bed equvialent bed that allows up to two pawns to sleep.
  • Royal bed - an expensive double bed that provides additional comfort and rest effectiveness.
  • Hospital bed - a bed equivalent with a larger immunity gain speed factor

Animal Sleeping furniture: