Difference between revisions of "Gas"

From RimWorld Wiki
Jump to navigation Jump to search
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{stub}}
+
{{Stub|reason=General}}
{{image wanted}}
+
{{Image wanted|reason=Illustrative examples of spreading, dissipation, and other mechanics.}}
 
'''Gases''' are a class object that behaves in a certain way. There are currently three gasses:
 
'''Gases''' are a class object that behaves in a certain way. There are currently three gasses:
 
* [[Blind smoke]]
 
* [[Blind smoke]]
Line 6: Line 6:
 
* [[Tox gas]] {{BiotechIcon}}
 
* [[Tox gas]] {{BiotechIcon}}
 
== Mechanics ==
 
== Mechanics ==
????
+
 
 +
Gasses have a density of 0-100% (which is represented in the engine as 1 byte for a maximum integer value of 255 density). This is calculated for each tile that contains gas, separately for each type of gas. Walls, closed doors, and other blocking structures such as [[Nutrient paste dispenser]]s prevent gas from spawning or diffusing onto their tiles.
 +
 
 +
=== Dissipation ===
 +
 
 +
Dissipation causes gas density to be reduced in each tile overtime.
 +
 
 +
On each tick, a random 1/64 of all map tiles are ticked for gas dissipation. Smoke and Rot stink dissipate at an average rate of ~1.57% (4) density per 64 ticks, while Tox gas dissipates at an average rate of ~1.18% density (3) per 64 ticks.  60 ticks is 1 second at 1x speed, for reference.
 +
 
 +
=== Diffusion ===
 +
 
 +
Diffusion causes gas density to spread from tiles of higher density to lower density. Tox gas and Rot stink gases may diffuse, while Smoke does not. The minimum density for Tox gas and Rot stink to diffuse is ~6.66% (17), below which diffusion ceases.
 +
 
 +
On each tick, a random 1/32 of all map tiles are ticked for gas Diffusion. For each tick of diffusion, the tile being ticked will average its gas density with that of an adjacent tile with a lower density of gas.
 +
 
 +
Gases can only diffuse to open tiles, without walls, closed doors, or other blocking structures like nutrient paste dispensers.
 +
 
 +
=== Spawning ===
 +
 
 +
When gas is spawned, if gas already exists in the tile, any resulting gas density over 100% is pushed out to adjacent tiles, up to 40 tiles away from the source. Multiple sources spawning gas, such as multiple pawns using tox weapons, will fill much more space, much faster, with gas than a single pawn due to this.
 +
 
 +
==== Explosives ====
 +
Explosives that spawn gas such as the projectiles of the [[Toxbomb launcher]], [[Tox grenades]], and [[Smoke launcher]] spawn 100% density of gas on each tile within their explosive radius. Any tiles in their explosive radius that does not allow gas such as a wall causes that gas density to not be spawned. Thus for maximum tox gas spawning into a confined space, an open 3x3 space for all 9 tiles of tox gas generation should be used.
 +
 
 +
==== Packs ====
 +
Packs that release gas such a deployed [[Tox pack]] or [[Smokepop pack]] have a total density (defined as a number of cells filled to 100% density) they release over their duration at their position, spawning gas every 1/30 ticks (2 times a second at 1x speed).
 +
 
 +
==== Rot Stink ====
 +
Rot stink is generated from a rotting corpse on each rare tick (1/250 ticks, or 4.16 seconds at 1x speed), with a density of ~20.4% (52) per unit of of the corpse's body size. Rot stink is generated on the corpse's cell.
 +
 
 +
=== Vents ===
 +
 
 +
Tox gas and rot stink pass through vents, while smoke does not.
 +
 
 +
On each rare tick (1/250 ticks, or 4.16 seconds at 1x speed), the gas density of tox gas and rot stink on each side of a vent is averaged and equalized. For example, if one side has 90% and the other 20%, after a rare tick both sides will have 55%.
 +
 
 +
=== Doors ===
 +
 
 +
A closed door acts the same as a wall, preventing spawning and diffusion of gas onto the tile. Open doors act the same as an open tile for spawning and diffusion. Closing a door with existing gas will cause the gas to remain on the tile, but no longer diffuse to or from other tiles, or be spawned on that tile. Gas on closed door tiles will dissipate over time as normal.
 +
 
 +
== Testing ==
  
 
[[File:Smokelauncher gas physics comparison.mp4|thumb|left|Gas expanding from a single point to fill a room]]
 
[[File:Smokelauncher gas physics comparison.mp4|thumb|left|Gas expanding from a single point to fill a room]]
Line 13: Line 53:
 
== Version history ==
 
== Version history ==
 
* [[Version/1.4.3523|1.4.3523]] - Gas system added. Previously smoke was the only gas and it only existed as a temporary object with a set but refreshable duration.
 
* [[Version/1.4.3523|1.4.3523]] - Gas system added. Previously smoke was the only gas and it only existed as a temporary object with a set but refreshable duration.
 +
* [[Version/1.4.3555|1.4.3555]] - Gases can now travel through vents.
  
 
[[Category: Game mechanics]]
 
[[Category: Game mechanics]]

Latest revision as of 06:24, 1 January 2024

Gases are a class object that behaves in a certain way. There are currently three gasses:

Mechanics[edit]

Gasses have a density of 0-100% (which is represented in the engine as 1 byte for a maximum integer value of 255 density). This is calculated for each tile that contains gas, separately for each type of gas. Walls, closed doors, and other blocking structures such as Nutrient paste dispensers prevent gas from spawning or diffusing onto their tiles.

Dissipation[edit]

Dissipation causes gas density to be reduced in each tile overtime.

On each tick, a random 1/64 of all map tiles are ticked for gas dissipation. Smoke and Rot stink dissipate at an average rate of ~1.57% (4) density per 64 ticks, while Tox gas dissipates at an average rate of ~1.18% density (3) per 64 ticks. 60 ticks is 1 second at 1x speed, for reference.

Diffusion[edit]

Diffusion causes gas density to spread from tiles of higher density to lower density. Tox gas and Rot stink gases may diffuse, while Smoke does not. The minimum density for Tox gas and Rot stink to diffuse is ~6.66% (17), below which diffusion ceases.

On each tick, a random 1/32 of all map tiles are ticked for gas Diffusion. For each tick of diffusion, the tile being ticked will average its gas density with that of an adjacent tile with a lower density of gas.

Gases can only diffuse to open tiles, without walls, closed doors, or other blocking structures like nutrient paste dispensers.

Spawning[edit]

When gas is spawned, if gas already exists in the tile, any resulting gas density over 100% is pushed out to adjacent tiles, up to 40 tiles away from the source. Multiple sources spawning gas, such as multiple pawns using tox weapons, will fill much more space, much faster, with gas than a single pawn due to this.

Explosives[edit]

Explosives that spawn gas such as the projectiles of the Toxbomb launcher, Tox grenades, and Smoke launcher spawn 100% density of gas on each tile within their explosive radius. Any tiles in their explosive radius that does not allow gas such as a wall causes that gas density to not be spawned. Thus for maximum tox gas spawning into a confined space, an open 3x3 space for all 9 tiles of tox gas generation should be used.

Packs[edit]

Packs that release gas such a deployed Tox pack or Smokepop pack have a total density (defined as a number of cells filled to 100% density) they release over their duration at their position, spawning gas every 1/30 ticks (2 times a second at 1x speed).

Rot Stink[edit]

Rot stink is generated from a rotting corpse on each rare tick (1/250 ticks, or 4.16 seconds at 1x speed), with a density of ~20.4% (52) per unit of of the corpse's body size. Rot stink is generated on the corpse's cell.

Vents[edit]

Tox gas and rot stink pass through vents, while smoke does not.

On each rare tick (1/250 ticks, or 4.16 seconds at 1x speed), the gas density of tox gas and rot stink on each side of a vent is averaged and equalized. For example, if one side has 90% and the other 20%, after a rare tick both sides will have 55%.

Doors[edit]

A closed door acts the same as a wall, preventing spawning and diffusion of gas onto the tile. Open doors act the same as an open tile for spawning and diffusion. Closing a door with existing gas will cause the gas to remain on the tile, but no longer diffuse to or from other tiles, or be spawned on that tile. Gas on closed door tiles will dissipate over time as normal.

Testing[edit]

Version history[edit]

  • 1.4.3523 - Gas system added. Previously smoke was the only gas and it only existed as a temporary object with a set but refreshable duration.
  • 1.4.3555 - Gases can now travel through vents.