Jump to content

How much gas can an airlock crush if an airlock can crush gas? A (mad) scientific experiment.


Recommended Posts

Prompted by an "argument" on Reddit, I decided I had to answer a question, when a double-airlock closes on unmixed gas, how many of tiles of gas get trapped and crushed?
272823529_Screenshotfrom2022-07-3114-53-54.thumb.png.b2a74720a7878d1d3a5c8ec15bfd3a10.png

How many gas tiles get crushed? 0? 2? 4?. What about on average? Pip?
 

If you think you know your arcane ONI game mechanics, then make a guess now about the expected number of gas tiles that will get trapped and destroyed, vs expelled back out.

This answer is not nearly as simple as one might hope it would be, because the order that airlocks close in is infuriatingly non-deterministic! If behind the scenes the top airlock closes first, then the gas tiles in the bottom airlock get destroyed since they have nowhere to go. On the other hand, if the bottom airlock closes first all the gas gets pushed up and out. And then there's the matter of which direction the top airlock tries to displace the gas: up to freedom or down to join the trapped tiles about to be crushed.

Incidentally, Airlocks are never observed to split tiles they close on, they push (merge) the entire tile in the same direction, rather than sending half in each possible direction or some such.

 

The Experiment

So the only thing for it was to make a grid of double-airlocks, cycled open and shut a few times, then each filled with 6 kg of gas (1 kg per tile when the airlocks are open - I will always use 1 kg/tile in the open state), and with an Atmo Sensor and Light. The atmo sensor can be set to a value and copy-pasted to all 160 rooms, and the wattage drawn by the lights can be measured by the wire and divided by 10 to get the exact number of atmo sensors that are green. So I can quickly ask a question like "is there at least 900 g of gas, copy-paste the sensor, and read the number of lights off the wire.
1121295029_Iamnormal.thumb.jpg.ad0d376b88033840a474abbdf69c6403.jpg

A normal way to spend one's Sunday.


I have some Questions and some Hypothesis's based on prior experiments with double airlocks:

  • Q: How many gas tiles will be crushed.
  • H: Either 0 or 4 depending on whether the top or bottom airlock closes first.

 

  • Q: What is the chance of no gas being crushed?
  • H: There is a significant bias towards top-to-bottom simulation, meaning gas is more likely crushed than not.



Test One:

  • In 48 chambers (30%) 0 kg was destroyed.
  • In 112 chambers (70%), 2 kg was destroyed.

This was a doubly unexpected outcome, as testing had indicated all gas tiles within both doors should be crushed, if the doors closed top-to-bottom. Also even with the small sample size of 160, this definitely indicates a strong skew towards the airlocks closing top-to-bottom.


Test Two: After a reload.

  • In 69 chambers (43.1%), 0 kg was destroyed.
  • In 91 chambers (56.9%), 4 kg was destroyed.

Oh f*ck me with a broomstick, reload dependent simulation behavior? Before the reload the doors has squished their gas up, after reload they squished it down.

 

Test Three-a: After a reload. Let the simulation run a while a few minutes.
 

  • In 44 chambers, 0 kg was destroyed.
  • In 116 chambers, 4 kg was destroyed.


Consistent with the second reload test, again showing an extremely strong statistical bias towards top-to-bottom order, even stronger than in test one.


Test Three-b, cycling the airlocks a second time

  • In 18 chambers (11.25%), 0 kg has been destroyed.
  • in 72 chambers (45%), 4 kg has been destroyed.
  • In 88 chambers (55%), 5.333 kg has been destroyed.


In this case, 41% of the chambers where the airlocks had closed bottom-to-top in test three-a, did so again, with the other 59% flipping their order to top-to-bottom. Overall 11.25% crushed neither time, and 55% crushed both times.



Test Four: After a reload. Flicked the switch before unpausing.

  • In 115 chambers, 0 kg was destroyed.
  • In 45 chambers, 4 kg was destroyed.

While one might be tempted to attribute this outcome to poor record-keeping, I triple-checked and crushing definitely only occurred in about a third of the chambers, a reversal of normal simulation behavior. That simulation behavior is whack when reloading is well known.



Test Five: After a reload. Flicked the switch before unpausing.

  • In 115 chambers, 0 kg was destroyed.
  • In 45 chambers, 4 kg was destroyed.

No, I didn't just copy-paste test four. The thing I was testing is there's any randomness introduced "between" saving and loading, but it really went exactly the same way.



Test Six: After a reload. Flicked the switch before unpausing and set game speed to 3x:

  • In 119 chambers, 0 kg was destroyed.
  • In 41 chambers, 4 kg was destroyed.

Huh. Seems like game speed effected the order the airlocks closed (previous tests were at 1x). Not a huge surprise. However the pattern of lit and unlit lights is pretty similar so it didn't diverge much.

883984349_Screenshotfrom2022-07-3113-37-28.thumb.png.e0dd87d1e1930ceffd153cee69852feb.png1411404857_Screenshotfrom2022-07-3113-36-02.thumb.png.b32e3a20d5870a4f637e0270409c9b94.png

 

Test Seven-a: After a reload. Let the game run a while before flipping the switch. 

  • In 64 chambers, 0 kg was destroyed.
  • In 96 chambers, 2 kg was destroyed.

Bring back the broomstick! It's clearly back to shoving gas up instead of down when the top airlock closes first. This time a reload doesn't explain it.


Test Seven-b: cycled the airlocks again.

  • In 35 chambers, 0 kg has been destroyed. (54% of 64)
  • In 34 chambers, 2 kg has been destroyed. (35% of 96)
  • In 29 chambers, 4 kg has been destroyed. (45% of 64)
  • In 62 chambers, 4.7 kg has been destroyed. (65% of 96)

I'm not crying, it's sand in my eye. Why must the simulation be like this! So the simulation changed from "shoving up" to "shoving down" between tests.


Test Eight: after a reload, let the game run several minutes. Flipped switch while at 3x speed.

  • In 53 chambers, 0 kg was destroyed.
  • In 107 chambers, 2 kg was destroyed.

I'm starting to wonder if there's a game speed correlation.

Test Nine: after a reload, let the game run, flipped switch while at 1x speed.

  • In 60 chambers, 0 kg was destroyed.
  • In 100 chambers, 4 kg was destroyed.

Well huh, two tests don't allow for any real conclusion, but a new test could be formulated specifically to test shove up vs shove down.

 

A new setup.

Because I do not in fact hate myself, I made a copy-pasteable setup that uses Gas Meter Valves to insert 6 kg of gas into each chamber, so I can just copy-paste the setup.

Each row of 16 chambers is connected to a single Switch. If the mechanical airlocks shove down when closing, the gas pressure in the 2 open tiles will be either 1 kg/tile or 3 kg/tile, but if they shove up the gas pressure will either be 2 kg/tile or 3kg/tile. Hence an atmo sensor set to something like "above 1.1 kg" indicates the airlock shoved the gas down, if any light in a row lights up, that row was "shoved down".
1661323016_Screenshotfrom2022-07-3114-28-37.thumb.png.d313b18e9f003728d154762a0832820f.png


Test 9: For each alternating row, I changed the game speed to either 1x or 3x before flipping the switch.
 

  • In 6 rows (60%), gas was shoved down.
  • In 4 rows (40%), gas was shoved up.


I alternated game speed for each row, but no such alternation was observed in the results, indicating no simple correlation with game speed. I also measured how much gas was destroyed:

  • In 53 chambers, 0 kg was destroyed. 
  • In 52 chambers, 2 kg was destroyed.
  • In 55 chambers, 4 kg was destroyed.

This result is broadly compatible with the earlier result, that there is around a 1 in 3 chance of the the top airlock closing before the bottom airlock. It's also pointing to a 50% chance that the gas will be shoved up or down.

Test 10: Flipped all rows, individually, at 1x speed.

  • In 5 rows, gas was shoved up.
  • In 5 rows, gas was shoved down.

Strong evidence for the game alternating between shoving gas up and down each time the simulation advances.

  • In 41 chambers, 0 kg was destroyed.
  • In 67 chambers, 2 kg was destroyed.
  • In 52 chambers, 4 kg was destroyed.

Trends continue.

Test 11: Flipped all rows, individually, at 3x speed.

  • In 3 rows, gas was shoved up.
  • In 7 rows, gas was shoved down.

This is still perfectly compatible with 50% odds, considering small sample size.

  • In 79 chambers, 0 kg was destroyed.
  • In 26 chambers, 2 kg was destroyed.
  • In 55 chambers, 4 kg was destroyed.
     

A third flipping setup.

To better test the question of the probability of whether gas will be shoved up or down, I made a third test with a single horizontal Mechanical Airlock, which starts open, in the middle of a 6 tile room containing 6 tile of hydrogen. If it shoves up the hydrogen will be 2 kg in top, 1 kg in bottom, vice-verca if it shoves down. The atmo sensor is set to turn the light on if the gas is shoved up.

Because I'd gotten less dumb at making these setups, this time I filled it by closing the airlocks and painting 1.5 kg/tile with a big brush, a much quicker way of getting an exact amount of gas into each chamber than flood-fill (which does fill open airlocks, unlike painting). I wired 100 airlocks together using BUFFER gates, and varied the timing on the BUFFER gates from 0.1s to 1s, and it quickly became clear there is a sequence rather than randomness.

Since this test was fully and trivially reset-able I could easily do repeats, and you can see a video here:

The number of lights that lit up on various runs with various BUFFER settings were 26, 27, 27, 24, 26, 23, 26, 25, 25. This looks suspiciously like 25 +/- 2 depending where the sequence gets cut. Or in other words in the long term a 25% chance the gas will be shoved up, a 75% chance it will be shoved down.

An easy way to test this: copy-pasting the setup. When duplicated 3 times, for 300 lights.

1200028870_Screenshotfrom2022-07-3119-37-21.thumb.png.895612dad6339500f6412aff14b730c2.png

Results of three trials: 74 lights, 77 lights, 75 lights, consistent with 75 +/- 2. However when the same test was executed at Super Speed (debug mode) it appears to degenerate, producing numbers like 86, 87 and 72, suggesting the simulation becomes unstable at super speed.

Conclusion based on inadequate data:

Let's return to my original two questions, with Answers:

  • Q: How many gas tiles will be crushed.
  • H: Either 0 or 4 depending on whether the top or bottom airlock closes first.
  • A: 0, 2, or 4 depending on which airlock closes first, and whether gas is being shoved up (25% chance) or down (75% chance).

 

  • Q: What is the chance of no gas being crushed?
  • H: There is a significant bias towards top-to-bottom simulation, meaning gas is more likely crushed than not.
  • A: Excluding the "immediately after reload" tests, the actual measured chance was 35%, with 1440 samples.

 

What other conclusions:

Though data is not truly adequate, it appears that the simulation alternates between shoving gas up and shoving gas down when an airlock closes. The same shove direction will be used for the entire simulation update ("tick"). The alternating isn't 50/50, instead it appears in pattern strongly suggestive of 3 shoves down, 1 shove up (but often manifesting as 6:2 or more complicated sub-sequences). When airlocks aren't operating in a tight automation sequence, it can likely be considered just a random chance, 25% up, 75% down. Also it doesn't seem trivial to time the sequence to always get shove up or shove down, at least not with the resolution that BUFFER gates provide.

SO HOW MUCH GAS CAN THE FRICKEN DOUBLE AIRLOCK DESTROY ON AVERAGE?!

Ooooh yeah, I knew there was a point to this post.

So basically we need to enumerate the possibilities, I'm going to use a 66.7% chance of top-to-bottom simulation order - but really the sample size isn't big enough to rule out anything from 60% to 75% - and a 25% chance of shoving gas up.

  • The top airlock closes first (66.7% chance), and shoves the gas down (75% chance), 4 tiles of gas are trapped and destroyed.
  • The top airlock closes first (66.7% chance, and shoves the gas up (25% chance), 2 tiles of gas are destroyed.
  • The top airlock closes last (33.3% chance), and has a 100% chance to shove the gas up since it has nowhere else to go.

The sum of probabilities:

  • 50% chance that 4 tiles are destroyed.
  • 16.7% chance that 2 tiles are destroyed.
  • 33% chance that 0 tiles are destroyed.

Hence the expected tiles destroyed each time the double airlock closes, is 2.33 tiles. Did you get it right?

 

Final Notes

One thing I didn't cover, is that it seems a pair of airlocks can get stuck in a particular simulation order for a long periods of time, thus either destroying gas extra effectively (4 tiles each time), or ineffectively (0 tiles each time). It's not really a random chance each simulation update what the order will be, though in the long term it seems to be possible to treat it as such.

I also found it interesting how I updated my conceptions updated based on improved data. Preliminary testing had indicated airlocks always shove down: and with a 75% chance of this happening, it really wouldn't be that unexpected to do 10 tests in a row, have it shove down every time, and conclude that 10 tests is proof enough that it shoves down every time, specifically there's a 5.6% chance of such an outcome, and it doesn't take exceptional luck to get a 5% outcome.

And of course, a lot more experimentation would be needed to be truly confident, with factors like game speed or simulation lag plausibly skewing the odds.

Screenshot from 2022-07-31 13-36-02.png

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...