Jump to content

Slanted gas layers?


Recommended Posts

Does anyone know what's going on with my gas layers? I'd have thought that all the layers would be roughly horizontal over time, as the hydrogen rose to the top, and the oxygen (and other gases) to the bottom. However, in all of my games, it seems like I always end up with slanted gas layers, which makes it hard to keep breathable air in my sleeping quarters, med-bay, and other habitable zones. See screenshot.

slanted-gas-layers.png

Link to comment
Share on other sites

11 minutes ago, thewreckedangle said:

i thought gas in ONI always has a slanted bias.

I don't know the algorithmic bias that cause it, but it definitely does. It actually makes things easier IMO: Carbon sink goes int the bottom right, hydrogen pick-off in the upper left. Done and done.

Link to comment
Share on other sites

The axis isn't exactly up/down, but more like upper-left/lower-right.

This is because the processing of gas has an inherent order in the code, most likely clockwise starting from upper-left (because it's the (-1,-1) coordinate). The lighter gas goes upper-left and is done for current physics tick, meaning that it won't try to swap upper-right until it can't swap upper-left or directly up.

Link to comment
Share on other sites

16 minutes ago, thewreckedangle said:

i thought gas in ONI always has a slanted bias.

They do. Less so now as you can see in the OP pic.

Heavier gases always moves to the lower right corner, and lighter gases always move to the upper left corner.

That's why all people put carbon skimmers in the lowest right corner, and air pumps to pick up hydrogen in the top left corner.

You can see it as the gases are affected by the rapid rotation of the asteroid but it's really just a boring quirk of how the game handles gases.

Link to comment
Share on other sites

It seems to have to do with the decision making on how gases move.  When "blocked" from moving upwards, they seem to prefer to move to the left over going to the right.  The opposite is true for moving downward -- when blocked, they prefer to move right rather than left.

Link to comment
Share on other sites

21 minutes ago, Wolfcream23 said:

yeah, but i still think that it counts as a bug and should be fixed though.

Not all bugs needs to be fixed, you know. Although strange at first, the way gas flows actually makes the game better in my opinion.

Link to comment
Share on other sites

I also think this is a bug, but I'm going to test it in my game, to see if it was just the position of my oxygen producer. It was on the right side of the base, and most of the dupes were on the left, working machines, and using the base entrance/exit (and breathing up all the air).

EDIT: Yeah, the game definitely has a bias in what direction gases float.

Should be easy enough to fix - just randomize the order the cels swap, instead of always going in a specific order.

Link to comment
Share on other sites

14 hours ago, AileTheAlien said:

Should be easy enough to fix - just randomize the order the cels swap, instead of always going in a specific order.

I don't think it would improve the game to have such chaotic gas interactions; i imagine it would also be more computationally intensive...

Link to comment
Share on other sites

2 hours ago, caffeinated21 said:

I don't think it would improve the game to have such chaotic gas interactions; i imagine it would also be more computationally intensive...

Gas interactions are pretty chaotic already. You can see it by creating a high pressure room of oxygen with one tile of polluted oxygen, then tracking it around. Removing that tiny bit of order would not be noticeable on small scale.

It could be made pretty cheap by only choosing the order once per tick, for all gas cells at once.

The only real problem is that this slanted behavior is in some ways better than "the right thing". For example, it makes CO2 "slide" on the floor instead of forming a layer.

Link to comment
Share on other sites

It would be almost the same amount of computation if you do it right. There's algorithms for generating pseudorandom numbers in bulk, to speed it up. i.e. roll all the dice for every cell in the game world, instead of a different function call for each. Doing them in bulk would pretty much just make sure your instructions stay in cache, and the memory for a large amount of numbers is cheap. I wrote one in an afternoon back in college, although I cannot recall the name of the particular algorithm / link to it on wikipedia.

As far as the logic for deciding what order, it'd change from a four-direction if-else chain (if up is free swap upwards, else left...) to a four-long loop, over the four randomly decided directions for that particular cell. I'm sure there's other tricks you can do, or you can rely on the compiler. Compilers are in general pretty damn good these days.  : )

As far as "chaotic", if you've ever watched the gas overlay, tracking blobs of gas, as @Coolthulhu pointed out, is already very chaotic-looking to a human observer, on the small scale. The problem is however, that the current implementation leads to this weird, slanted behaviour. Also note, that something which is "chaotic" on a small scale, will usually end up with smooth, regular-looking behaviour on the large scale. For example, the behaviour of a single electron, verus the behaviour of a large number, flowing through an electrical wire. Or the random roll of a single dice, versus the smooth curve of rolling thousands of them. Averaged out over the many game-update cycles of a minute, or the many cells of the game world, it shouldn't be noticable, except for getting rid of the slant.

Link to comment
Share on other sites

6 minutes ago, Wolfcream23 said:

well in reality gasses will also "slide" on the floor, just not preferring to one direction.

But they can form a very thin layer, slip into tiny holes and so on. In ONI, gases are fat packets.

If not the directional movement, heavy gases would cling to the floor on the "level" they were produced on and would not slide off it into pits.

Link to comment
Share on other sites

I agree with the OP that this functionality is sub-optimal. Gasses should move much more freely than they do presently.

They should stratify horizontally based on buoyancy more than anything else.

The weighting of the pressure, buoyancy and temperature must be off in the controlling formula.

Coolthulu is correct in saying the gas should move when on a floor or ceiling but when it is not obstructed it should immediately stratify with relative density and volume required being controlled by the gas density for the given temperature (or similar).

We currently have the top left/bottom right method allowing large pockets of gas to be trapped underwater in a very unrealistic way.

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...