Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 3 [4]

Author Topic: The Fluid Body: A theory for hydro physics in Dwarf Fortress  (Read 8893 times)

Qyubey

  • Bay Watcher
    • View Profile
Re: The Fluid Body: A theory for hydro physics in Dwarf Fortress
« Reply #45 on: September 19, 2016, 12:52:07 am »

Regarding gas systems, although this could apply to fluids as well: I've recently discovered that my proposal of an idea for how to manage gas and pressure is EXACTLY (well, more or less) how it works in certain versions of Space Station 13. Specifically those with the FEA or LINDA system; simple averaging of each tile. Of course, there they actually record the moles of air, and derive pressure from a subsequent calculation of temperature, pressure, the ideal gas constant, and volume of the container/tile. Feeling quite proud that I stumbled upon the same system~

Adapting it to DF would be tricky however, as it uses a lot of strange measuring systems for temperature and volume. You'd need to overhaul a lot of how it works to get that working, so you'd need to pick and choose which effect you want to have. If you want them all, a total rewrite. Just the movement of pressure or temperature? Averaging them is sufficient.
Logged

Heretic

  • Bay Watcher
    • View Profile
Re: The Fluid Body: A theory for hydro physics in Dwarf Fortress
« Reply #46 on: September 19, 2016, 02:50:44 am »

PTW
And... do you need some calculation system for test all these staff you made? I can write simple app on C++ to help ou with it if I will have some time(I strongly wish I will).
Logged

Qyubey

  • Bay Watcher
    • View Profile
Re: The Fluid Body: A theory for hydro physics in Dwarf Fortress
« Reply #47 on: September 19, 2016, 05:37:16 am »

PTW
And... do you need some calculation system for test all these staff you made? I can write simple app on C++ to help ou with it if I will have some time(I strongly wish I will).

Regarding what? If the simulation would work? By all accounts it should, I ran enough excel 'simulations' during my time with this. However, by all means proceed if you wish to. Toady has ultimate say in what goes in his game, but the easier we make it for him to understand and implement, the better.


ALSO- Regarding the hideous monster that is MIXING FLUIDS. I looked again at the SS13 code and saw a curiosity. They have multiple gases that remain conserved, each representing their own units... because it averages each type of gas individually.

Spoiler (click to show/hide)

Each gas has an ID and their moles are recorded individually within a tile. Pressure is the combined total of all gases. For each ID within a tile, where air_gases is the total of all gases within the tile, it averages the moles. Each type of gas is averaged individually. I'd actually torn on just how much more computationally expensive this concept is though, and my gut is saying not all that much. Since it only averages for the IDs which exist, on average it only does 3 averaging for common gases (O2,N2,CO2), and an additional averaging for temperature. Adding more gases adds another layer of checks, but only on the tiles which contain them. This isn't a bad idea for a system at all. Bit expensive, maybe, but it handles mixtures exceptionally well.

As for its use in 3 dimensional space, it already only works in 4 cardinal directions, so its a matter of adding 2 more directions up and down. there's a bit of handling involved for when air flows out into space (gets deleted), so something like that could work for open sky in DF.

EDIT: Upon subsequent testing I can absolutely confirm that - while triggering gas flow definitely causes everything in a tile to perform averaging calculations - specific moles of gas remain untarnished when mixed. I mixed O2 and Freon, and found that after filling a vacuum to roughly 100% of O2 with an average of 108 moles per tile, then releasing freon into the chamber, the moles of O2 remained roughly at 108. Definitely shows this system is the case; it averages each individually.
« Last Edit: September 19, 2016, 06:17:22 am by Qyubey »
Logged

Bumber

  • Bay Watcher
  • REMOVE KOBOLD
    • View Profile
Re: The Fluid Body: A theory for hydro physics in Dwarf Fortress
« Reply #48 on: September 20, 2016, 02:45:34 pm »

Are there any good existing prototypes for 3D fluid systems?

I know Minecraft has two mods, Finite Liquids and Fysiks Fun. The former does limited updates per second to deal with its slowness. The later seems similar to the proposed idea, but it was really buggy the last time I tried it.
Logged
Reading his name would trigger it. Thinking of him would trigger it. No other circumstances would trigger it- it was strictly related to the concept of Bill Clinton entering the conscious mind.

THE xTROLL FUR SOCKx RUSE WAS A........... DISTACTION        the carp HAVE the wagon

A wizard has turned you into a wagon. This was inevitable (Y/y)?

Qyubey

  • Bay Watcher
    • View Profile
Re: The Fluid Body: A theory for hydro physics in Dwarf Fortress
« Reply #49 on: September 20, 2016, 09:46:07 pm »

Are there any good existing prototypes for 3D fluid systems?

I know Minecraft has two mods, Finite Liquids and Fysiks Fun. The former does limited updates per second to deal with its slowness. The later seems similar to the proposed idea, but it was really buggy the last time I tried it.

Finite Liquids is buggy as shit from the short time I experimented with it. Never tried Fysiks before.

Build & Defend has a model very similar to Dwarf Fortress, but that manages to completely equalise water level. I'm not entirely sure how it does it, but I think it's just a broader version of Toady's teleporting water pressure - no inertia. However, it does do something that no other game seems to do; physical displacement. Pistons actually displace water instead of deleting it: http://buildanddefend.com/readnews_news_44

As for existing models, if you want to dive into the world of Cellular Automation in a professional sense, there's a lot of mathematical models out there that seem to exist. Might be a bit complex for our purposes though - especially since we're trying to simulate certain forces like pressure and inertia which those studies aren't worried about.
Logged

Fleeting Frames

  • Bay Watcher
  • Spooky cart at distance
    • View Profile
Re: The Fluid Body: A theory for hydro physics in Dwarf Fortress
« Reply #50 on: September 20, 2016, 09:55:09 pm »

DF pistons also displace water, in a sense, though the result is bit different than expected.

Anyway, come to think of it, if the fluid model has to check every tile above it, wouldn't it end up doing more calculations than tile-based DF currently uses for single-z lakes?

Qyubey

  • Bay Watcher
    • View Profile
Re: The Fluid Body: A theory for hydro physics in Dwarf Fortress
« Reply #51 on: September 20, 2016, 10:32:29 pm »

DF pistons also displace water, in a sense, though the result is bit different than expected.

Anyway, come to think of it, if the fluid model has to check every tile above it, wouldn't it end up doing more calculations than tile-based DF currently uses for single-z lakes?

Yeah, it would, but that's the cost of maintaining pressure and depth. At least my cheap way of doing it; actual pressure and inertia can get pretty complex pretty quickly.

It also depends how many directions you want to manage. Going only for face directions (no diagonals) decreases the amount of checks a fair bit. SS13 uses a curious handling method that, if every space around it is open, it can do diagonals, but only in that instance. Not quite sure how it works.
Logged
Pages: 1 2 3 [4]