Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: How to extend fluid logic n/7 numbers to use for air pressure  (Read 837 times)

denito

  • Bay Watcher
    • View Profile

Now I know the idea of modeling air pressure in the game has been suggested before, but what I'm proposing is how you might extend the fluid logic the game already has to represent air as well.  Basically it would model a "compressible fluid".

Air being a "compressible fluid", a 1..7 "air level" in a cell could correspond to 1 to 7 of pressure.  In a column of water you have 7/7, 7/7, and only the top is something different like 3/7; air could just have every cell in a column of air is the same pressure, so a column of air would look like 3/7, 3/7, 3/7.  Adding extra air would create a tile of 4/7 and then a tile of 5/7 that would move around in the same way that a 5/7 water tile moves on the surface of water looking for an exit, but instead of moving on the surface the extra unit of air would move randomly in any 3d direction (up and down as well as N/S/E/W).

You could get effects like blowing the doors off a tunnel if there's a 3/7 air tile on one side a 6/7 on the other (i.e. subtract one from the other to figure out if the door can handle it).  To model air pressure blowing water out of a submerged room, you look at the boundary between the air and the water; pathfind in the water until you get to the first column of water which is exposed to a different chamber of air (e.g. the outside) and check if the difference in pressure between the two is great enough to move some water, and if so, you teleport a unit of water from the submerged chamber up to the surface.  That'll create a bubbling effect / gusher effect as the water is pushed out.  (This doesn't take into account weight of the water column.)

This would be awesome for sea side forts because storms could be modeled as disturbances in air pressure, which when they hit the ocean surface would push down into the water, displacing it to places where the air pressure is lower.  This would create "real" waves and a powerful sea side storm could throw a lot of water up onto the beach.

Things you could do with air pressure:
- Build ventilation shafts for mines
- Ability to use air pressure to push water out of a flooded room
- Use a bunch of pumps pumping air out of a room to make a vacuum chamber, either for killing invaders or to put out a fire
- Blow air through magma to superheat it
- Drop water on magma in a sealed chamber to make steam pressure
- Etc.

Obviously the computation needed to do air pressure would be a problem.  If you modeled all the air space cells with fluid logic, every embark would be like draining the ocean in terms of CPU usage.  But maybe it can be optimized (for instance blocks of non-moving air could be ignored).  Maybe there'll be computers in 4 or 5 years that can handle it.
Logged
My wife: "Are you playing that midget fort game again?"

noodle0117

  • Bay Watcher
  • I wonder what would happen if I pull it.
    • View Profile
Re: How to extend fluid logic n/7 numbers to use for air pressure
« Reply #1 on: June 20, 2010, 11:53:06 pm »

would greatly change the way mining in aquifer zones might work.
Would be a nice addition, although don't expect it to come any time soon
Logged

MaDeR Levap

  • Bay Watcher
    • View Profile
Re: How to extend fluid logic n/7 numbers to use for air pressure
« Reply #2 on: June 21, 2010, 11:35:39 am »

As if we need another excuse to rape CPU...
Logged