Bay 12 Games Forum

Please login or register.

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

Author Topic: I proppose a new-ish fluid sistem.  (Read 9632 times)

Aachen

  • Bay Watcher
  • Wenzo Pilgrim cancels job: unstuck in time.
    • View Profile
Re: I proppose a new-ish fluid sistem.
« Reply #45 on: November 21, 2011, 04:27:52 pm »

Moreover, once we define the mixture of, say, vinegar and sulfuric acid, how does that new liquid interact with ammonia?
Logged
Quote from: Rithol Camus
There is but one truly serious philosophical problem and that is magma.

Quote from: Chinua Achebe
.... For Cliché is pauperized Ecstasy.

Draco18s

  • Bay Watcher
    • View Profile
Re: I proppose a new-ish fluid sistem.
« Reply #46 on: November 21, 2011, 04:49:57 pm »

Moreover, once we define the mixture of, say, vinegar and sulfuric acid, how does that new liquid interact with ammonia?

Indeed.
Logged

King Mir

  • Bay Watcher
    • View Profile
Re: I proppose a new-ish fluid sistem.
« Reply #47 on: November 21, 2011, 05:18:54 pm »

A horizontal boundary would make a good default action. That does mean you need multiple liquids in a tile, and code to make liquid swap places if a dense liquid is a z-level above a light liquid, and for a liquid to spread out on top of another it the two are adjacent.

Forming a vertical boundary only makes sense for powders. That is something you want, but powders behave differently in other ways, so you do want a different system for them anyway. For instance, you want to have ramps of sand.


Putnam

  • Bay Watcher
  • DAT WIZARD
    • View Profile
Re: I proppose a new-ish fluid sistem.
« Reply #48 on: November 21, 2011, 11:19:55 pm »

Moreover, once we define the mixture of, say, vinegar and sulfuric acid, how does that new liquid interact with ammonia?

Full simulation of chemical reactions at the atomic level, of course!

Ain't it obvious? :P

harborpirate

  • Bay Watcher
  • cancels eat: job item lost or destroyed.
    • View Profile
Re: I proppose a new-ish fluid sistem.
« Reply #49 on: November 21, 2011, 11:49:29 pm »

Some possibilities:
1. The two fluids block each other from flowing as if they had run into a solid.
2. DF is updated to track multiple liquids in a given tile and the tile gets about half of each. (3 of one and 4 of the other).
3. Both tiles form a default compound, like "sludge" or somesuch.

And those would have to be coded in the RAWs as well.  Very very VERY (if any) few liquid interactions in the real world do 1 (form a vertical boundary).  Most will either mix (3ish*) or layer on top of each other based on density (2).  2, however, is very easy to code, as it can be implied based on the material definitions.  3is is harder, but possible as it depends on what type of material each is (a water-soluable liquid won't mix with a lipid-soluable liquid, even if both are the same density).

It's the acid/base, water/magma type reactions that are extremely difficult to code as every liquid likely interacts in some way to large numbers of every other liquid.  I.e. vinegar and ammonia would both (in large quantities) turn magma into obsidian.

The trickies reactions of all are the ones that involve three or more liquids.  I.e. one is a catalyst for a chemical reaction of the other two (I do not know of any that exist in pure liquid states).

*By which I mean two liquids mixing homogeonously into a "new" liquid.  I.e. water and milk.

Keep in mind that I'm only talking about the default reaction, when a reaction is not explicitly defined in the RAWs. The point is to support lots of liquids without having to define hundreds or thousands of interactions in the RAWs.

There is a fourth option for default reaction that I didn't think of until later:
Swap these two tiles.
If two liquid types with no defined reaction to each other interacted, you'd end up with a pool of "mixed" liquids, but each individual tile would only contain a single type. This would also make the interaction of 2 or more liquids a snap (it would just work automatically), and it would simulate pollution pretty well.

Example (Oil=o, Water=w)
Spoiler (click to show/hide)

I doubt #2 will be easy to code. The game is not set up to handle multiple liquids in a single tile - the game would likely need a new data structure and it could get ugly (especially in regards to performance) when more than just 2 liquids interact. Could be a real CPU hog.

As for #3, the "sludge option", my assumption was that if it was the default to create sludge, most things interacting with sludge would just form more sludge. So you don't have to worry about whether things without defined reactions mix, because they'll just turn into sludge. You could always define how some material reacts with sludge, which would apply no matter what previous interaction created the sludge in the first place. Not very realistic, but easy.

Let me give a little more detail about why I'm advocating the options that I am: I'd like to see other liquids get into the game soon. Pie-in-the-sky perfection takes forever. If we can get something interesting and useful that requires 80% less effort, I'd like to see Toady go for that.

To be honest I think the default of "swap tiles" would be the best default option. You could end up with lakes that were part oil, part water, part whatever; all without doing heavy modifications to the game. Meanwhile, modders could go crazy defining every possible interaction to satisfy the desire for more detail.
Logged

knutor

  • Bay Watcher
  • ..to hear the lamentation of the elves!
    • View Profile
Re: I proppose a new-ish fluid sistem.
« Reply #50 on: November 21, 2011, 11:55:52 pm »

I'm not so sure I'm prepared to replay a 4x4 embark region entirely engulfed in miasma because I broke a catastrophic aquifer.  At least not just yet.  Not until I can embark with a space suit for my hunting dog.  Ha!

Sincerely,
Knutor
Logged
"I don't often drink Mead, but when I do... I prefer Dee Eef's.  -The most interesting Dwarf in the World.  Stay thirsty, my friend.
Shark Dentistry, looking in the Raws.

Draco18s

  • Bay Watcher
    • View Profile
Re: I proppose a new-ish fluid sistem.
« Reply #51 on: November 22, 2011, 12:09:26 am »

As for #3, the "sludge option", my assumption was that if it was the default to create sludge, most things interacting with sludge would just form more sludge. So you don't have to worry about whether things without defined reactions mix, because they'll just turn into sludge. You could always define how some material reacts with sludge, which would apply no matter what previous interaction created the sludge in the first place. Not very realistic, but easy.

1/7 blood meets ocean.

Ocean becomes sludge.
Logged

harborpirate

  • Bay Watcher
  • cancels eat: job item lost or destroyed.
    • View Profile
Re: I proppose a new-ish fluid sistem.
« Reply #52 on: November 22, 2011, 12:57:25 am »

As for #3, the "sludge option", my assumption was that if it was the default to create sludge, most things interacting with sludge would just form more sludge. So you don't have to worry about whether things without defined reactions mix, because they'll just turn into sludge. You could always define how some material reacts with sludge, which would apply no matter what previous interaction created the sludge in the first place. Not very realistic, but easy.

1/7 blood meets ocean.

Ocean becomes sludge.

Good point, another one of the reasons #3 is problematic.
Logged

harborpirate

  • Bay Watcher
  • cancels eat: job item lost or destroyed.
    • View Profile
Re: I proppose a new-ish fluid sistem.
« Reply #53 on: November 22, 2011, 01:17:32 am »

The more I think about option #4, "swap tiles when no reaction is defined", the more positives I see for it.

When tiles full of different liquids are on multiple z levels, the denser of the two could be swapped to the bottom (again as the default, when no reaction is defined).

It also allows reactions to continue to take place in the presence of inert substances.

Here's an example of Ammonia, Vinegar, and Water (and Foam representing ammonium acetate).
Spoiler (click to show/hide)
« Last Edit: November 22, 2011, 01:40:33 am by harborpirate »
Logged

antymattar

  • Bay Watcher
  • *Antymattar has created a Cat-ass-trophy*
    • View Profile
Re: I proppose a new-ish fluid sistem.
« Reply #54 on: November 22, 2011, 02:29:00 am »

As for #3, the "sludge option", my assumption was that if it was the default to create sludge, most things interacting with sludge would just form more sludge. So you don't have to worry about whether things without defined reactions mix, because they'll just turn into sludge. You could always define how some material reacts with sludge, which would apply no matter what previous interaction created the sludge in the first place. Not very realistic, but easy.

1/7 blood meets ocean.

Ocean becomes sludge.
Not true. If you remember what I mentioned before, I said that water would be the purification liquid. Anything that is in water can "somehow" be purified by letting it flow (Ie, dumping it in a river). The sludge would eventually turn back into water if propper actions are taken. If not then it will probably evaporate.

Moreover, once we define the mixture of, say, vinegar and sulfuric acid, how does that new liquid interact with ammonia?

Full simulation of chemical reactions at the atomic level, of course!

Ain't it obvious? :P
Not quite. What I am saying is that if this system is built in then yes, someone MIGHT actually make something close to a full set chemical reactions for all sorts of fluid. As of now all we need is for alcochol, milk, blood, booze, vomit and oil(rock nut) to be in game. I dint see what is it with people trying to suggest ammonia and make it realistic to combine phosphorous with hypercooled liquid hidrogen to create gems of hydrofosphate or something other :p.
« Last Edit: November 23, 2011, 11:18:29 am by antymattar »
Logged

King Mir

  • Bay Watcher
    • View Profile
Re: I proppose a new-ish fluid sistem.
« Reply #55 on: November 22, 2011, 02:47:28 pm »

With the horizontal swapping, what would you do if the liquids were at different levels? Like you have a shallow reservoir of oil, and open a floodgate of 7/7 water at the side. With naive horizontal swapping you'd end up with a few towers of 7/7 water scattered is a pool of 1/7 oil. Similarly vertically swapping 1/7 tile of water with a 7/7 tile of oil would be strange. And a potential water pumping exploit, though not much different from pistons.
« Last Edit: November 22, 2011, 02:53:46 pm by King Mir »
Logged

alfie275

  • Bay Watcher
    • View Profile
Re: I proppose a new-ish fluid sistem.
« Reply #56 on: November 22, 2011, 03:13:45 pm »

I doubt we'll be seeing stuff like this till multithreading.
Logged
I do LP of videogames!
See here:
http://www.youtube.com/user/MrAlfie275

harborpirate

  • Bay Watcher
  • cancels eat: job item lost or destroyed.
    • View Profile
Re: I proppose a new-ish fluid sistem.
« Reply #57 on: November 22, 2011, 04:03:08 pm »

The simplest way to deal with non full tiles is to cause it to try to combine with the tile directly away from where the interaction is taking place. This does raise the issue of what to do in the case where it cannot combine though.
The effect in game of this proposed answer to your example would be that the full water tiles would push a building wave of oil in front until only full oil tiles remained, which would then start to intermingle with the water.
Logged

King Mir

  • Bay Watcher
    • View Profile
Re: I proppose a new-ish fluid sistem.
« Reply #58 on: November 22, 2011, 04:44:37 pm »

Given how pressure works in DF, it wouldn't be easy to make water push other liquids. So you may as well do it right and layer them.

antymattar

  • Bay Watcher
  • *Antymattar has created a Cat-ass-trophy*
    • View Profile
Re: I proppose a new-ish fluid sistem.
« Reply #59 on: November 23, 2011, 11:20:45 am »

Did you guys like totally not even read what I just said?

Anyway, tile swaping IS a dumb idea. One tile can have 7 units of ANY kind of liquid at once. Dont you understand. This means that the tiles dont have to "swap", the water and oil can just mix on a tile basis. They wont create a new liquid but they will mix in one tile. the 7/7 water will go over the 1/7 tiles of oil and the oil will be on the top.
Pages: 1 2 3 [4] 5