Space ship tin can

Oxygen O2 !

Oxygen O2 !

When I first started thinking about how the air would work in the escape pod, I thought it would be relatively easy to make.
I was visualising it as a simple percentage of oxygen, 100% being perfect and 0% being death. Of course I wanted players to experience the effects of the lack of oxygen, and not just losing health and dying when the oxygen would get too low.
So after a bit or research I discovered that it was called hypoxia, and I found out it started when below 17% of oxygen at a pressure of one bar (normal pressure at sea level).
This also lead me to the discovery of hyperoxia, meaning an excess of oxygen in the blood.
Both lead to certain symptoms and eventually to death and I thought it would be extremely interesting to implement these symptoms into the game.
Unless monitoring the oxygen levels with the instruments inside the pod the player would not have any indication on them and would be unaware of anything wrong until the first symptoms would appear. Dizziness (unstable camera and controls), slower movements, visions issues, all of them getting worse over time until the player would fall unconscious and eventually die.

The idea

I really liked the idea, so I started looking for the percentage that would lead to the different symptoms and how fast they would kill a human being.
This is when I realised it was much more complex than I anticipated, but also a lot more interesting.
So for example hypoxia is a lack of oxygen in our blood, but the level of oxygen in the air that leads to hypoxia depends on pressure levels. This means that if 20% of oxygen under 1 bar would be ideal, 20% of Oxygen/O2 under a lower pressure would lead to hypoxia. In the same way, a 100% of oxygen under 1 bar would lead to hyperoxia and eventually death, but 100% under a lower pressure could be sustainable, and that was actually commonly done in space flights to allow for a lighter and simpler atmosphere. Of course, with a 100% oxygen atmosphere, even at a lower pressure, fire becomes a much bigger issue. Terrible? Yes. Interesting? Damn yes! Who wouldn’t want to play a game where a bad oxygen mix would burn you alive with any spark?


So to be able to have a kind of realistic system I needed to add a pressure variable to the game and find a way to link it to the percentage of oxygen to determine if the air is breathable.
At first I thought it would be relatively easy. I would just have to find the simple linear formula that links pressure to oxygen percentage and voilà!
But, alas, I found out that the formula I would need was not only complex but not linear at all. It looked more like a weird curve than a nice smooth line. Much harder to implement properly as you might imagine.