UE4 Creating Oxygen System

Hi All,

I am making a space exploration game and am struggling with oxygen. I need to be able to detect if the player is in an oxygenated environment or not. It would be as simple as making trigger volumes for all the places that have oxygen, but the player is able to build and create their own bases, and place oxygen distributor machines inside them.

One idea I had was using invisible actors to represent particles of oxygen. The oxygen machines would spawn them regularly and they would move around very fast, bouncing off solid surfaces. Then, I could constantly check if the player character was within range of one of these particles and that would determine if they were able to breathe or not. I am not sure if this would work. Is it possible to do something like this? How would it impact performance? If not, is there a way I could optimise it to make it work? And if not, what other method could I use to determine if the player is in an oxygenated environment or not?

Thanks in advance!

NOTE: I am using blueprints.

One way of detecting an enclosed room would be with a flood fill algorithmen.
Every time you place or delete a block you need to check if that room is now sealed.
However, the short answer is: it’s not that easy.
I would make a internet search about that, because you are not the first person with that problem.

Do you think it would be possible though to use the invisible actors flying around?

Theoretically yes, practically no.
It would not be possible, or rather very unlikely, to detect a hole in a room.
In order to be detected, a significant amount of those particles would need to exit the room through that hole.
If you already have a sealed room and can tell the room “there is a hole here”, then you could despawn the air actors a specific rate, which would simulate the air getting sucked out really good. When you know, that the room is sealed, you also can despawn the actors or at least stop their movement.
BUT
the main problem is still the performance.

However it sounds like a very cool idea, I would at least try it out.