I was building an airlock on my ship the other day, and thought about how much more fun it would be if it actually had a gameplay purpose rather than just a roleplay one. The first problem that needs to be overcome is how to tell if a space is sealed, and do it without murdering everyone's CPU all the time.
My idea is thus:
Astronauts would have limited oxygen in their suits, and would need to enter an oxygen-balanced environment to refill. The suit's oxygen would fill slowly over time when the astronaut's helmet is off, and could be filled almost instantly at a refilling station, which would draw power from the structure it is mounted to in order to refill the astronaut's O2 tanks and dispose of waste CO2.
Life support systems would center around a single block called an Atmosphere Module. When activated, it attempts to create an atmosphere in the area where it is. If the area is open to space, this will not work.
Establishing an atmosphere takes a little time time and a substantial amount of power depending on the size of the area to be filled. Filling a 27 m^3 airlock for example might take about a second and 270 energy. Once an atmosphere is established, there is negligible to no energy draw to keep it, a small draw per person breathing it, and a slightly bigger draw for a refilling O2 tank. Something on the order of 1 e/sec per 1000 m^3 to maintain, 5 e/sec per person breathing the air, and 50 e/sec for a tank refilling from the ambient air.
Planetary atmospheres could have different effects on astronauts with their helmets off. These are just ideas:
My idea is thus:
- When there's nothing creating a breathable atmosphere, make no calculations. There's no atmosphere to calculate.
- When a life support unit on a ship is trying to create breathable atmosphere, check for an enclosed space. To prevent spamming these calculations, there could be a high power requirement or a resource cost (air, easily vacuumed up from a planet) to establish an atmosphere where there was none before. A quick check is raycasting to see if there is a path to space in any direction. If not, block based calculations can check for certain whether a space is enclosed.
- When an atmosphere is established, save a mesh in the shape of the atmosphere with the ship.
- If a block is destroyed or a door is opened next to the mesh, see if air leaks.
- First check if there is an established atmosphere on the other side. If so, do nothing.
- If not, air starts leaking and the game raycasts to see if it leaks to space or another chamber of the ship. If it leaks to space, the atmosphere begins leaking away rapidly and cannot be reestablished until the area is sealed.
- If none of the initial rays reach space, block-based calculations check if the space is really sealed, then find the size of the space and reduce the pressure of the air as it fills the other space. If the pressure drops too low, unprotected astronauts may begin to suffocate. Atmosphere may be repressurized immediately.
- A ship built on a planet's surface would be filled by the planet's atmosphere. Upon leaving the atmosphere, the game would have to know if the ship is sealed. I haven't got any bright ideas for this yet...
- A provision should be made for sealing across multiple entities docked together so that people don't have to put on their helmets to walk between ships docked together with USDs (docking collars).
- IMPORTANT EDIT: While block-to-block calculations might be too computationally heavy, I have another alternative idea.
- Start with a virtual box made of 1-block square tiles around the atmosphere generator. It expands outward block by block, one meter on each side at a time.
- When it runs into a block, the contacting squares disappear and the rest continues outward.
- When a square advances into a wider space, it raycasts for space, then if no LOS to space is detected the surface widens to the walls and continues outward.
- EDIT again: Not every tile need send out raycasts. One tile per opening should be enough. This is just to check if the face just exited the ship, in which case calculations need not continue as the space is definitely not sealed.
- The atmosphere is successfully created when all tiles of the virtual box run into something and are deleted.
Astronauts would have limited oxygen in their suits, and would need to enter an oxygen-balanced environment to refill. The suit's oxygen would fill slowly over time when the astronaut's helmet is off, and could be filled almost instantly at a refilling station, which would draw power from the structure it is mounted to in order to refill the astronaut's O2 tanks and dispose of waste CO2.
Life support systems would center around a single block called an Atmosphere Module. When activated, it attempts to create an atmosphere in the area where it is. If the area is open to space, this will not work.
Establishing an atmosphere takes a little time time and a substantial amount of power depending on the size of the area to be filled. Filling a 27 m^3 airlock for example might take about a second and 270 energy. Once an atmosphere is established, there is negligible to no energy draw to keep it, a small draw per person breathing it, and a slightly bigger draw for a refilling O2 tank. Something on the order of 1 e/sec per 1000 m^3 to maintain, 5 e/sec per person breathing the air, and 50 e/sec for a tank refilling from the ambient air.
Planetary atmospheres could have different effects on astronauts with their helmets off. These are just ideas:
- Green: Rich atmosphere increases athletic ability. Running speed increases.
- Ice: Chilly. Standing in one place too long with your helmet off will cause you to get cold and move sluggishly, but thick air lets you run slightly faster as long as you remain active.
- Desert: M-class atmosphere increases running speed slightly, but if you run too much you will get hot and slow down slightly instead.
- Red: Poor atmosphere quality reduces running speed.
- Purple: Makes you feel funny. Breathing the air accumulates a rosy tint in your vision which leaves at a similar rate after you stop breathing the strange air. Fun extra: eating plants from this planet has a similar effect, plus a slight view shimmer.
Last edited: