Skip to content

3 comments

Is your game time based or room based? If it's tile based then you can implement a system that makes air go from high pressure to low pressure tiles, with a something like 8 pressure levels for each tile.

If it's a room based system, you'd want a room pressure and room volume (based on the size of the room) so that bigger rooms have more air.

Space tiles/rooms will always be 0% air, and the atmosphere will always want to go their if the system is implemented correctly

2 points

It's close to the "Oxygen not Included" game as I see.

Gas and liquids levels are simulated with tiles. Tiles have value how full they are, and update animations using these values. Tiles that close to doors lose oxygen first. If sum all values can get how much oxygen we have in the room.

Maybe I'm wrong but when played that game I had the impression it works that way.

1 points

There are lots of different answers to this question and which one is best for you depends on what level of physical accuracy you want and performance considerations.

​

The highest level of physical accuracy would be to directly use fluid dynamic equations (ie Navier-Stokes equations) to calculate how the gas actually would move. This is probably impossible to do in a game. I believe analytic solutions to the NS equations only exist in certain limited cases.

​

A lower level of accuracy (but still potentially very high accuracy) would be to do some kind of finite difference modeling to approximate the actual flow of gas in small regions. You essentially divide the room into a grid and take small time-steps. At each time step you calculate how gas flows from each cell of your grid to the neighboring cells depending on the differences in pressure. This is how most engineering applications deal with this kind of modelling.

​

But do you really need that much accuracy? What if you just give each room a gas value based on its size, and when two rooms become connected the gas between them equalizes instantly? When a room becomes connected to "outside" the gas could instantly equalize to zero.

If you don't want it to be instant, you could have a maximum rate that the gas in a room can change per frame.

If you want to add forces to objects during these changes in gas levels, just do it in a hacky unrealistic way that looks and feels convincing. Just apply some force to every object in the room toward the point connecting the room to whatever other room the gas is escaping to.

Quill18 made some kind of rudimentary oxygen-level thing in this tutorial: https://www.youtube.com/watch?v=qyvN-YolIdQ&list=PLbghT7MmckI4_VM5q3va043FgAwRim6yX&index=49 It has been a long time since I watched it, so I don't remember exactly how he approached it.

1 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

←or→
Previous / next file
↑or↓
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.