Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Problems and solutions for multiple liquid types (mostly problems)  (Read 966 times)

Tehran

  • Bay Watcher
    • View Profile
    • Dwarf Fortress Stories

I've been thinking about additional fluid types lately, and I certainly do not envy Tarn Adams for the headaches he must get while trying to figure this kind of stuff out and code for it.

First of all, here are the liquid types that have been requested in the past (I may have missed some):

-Blood
which might have to include:
-gray goo? (fire imps)
-ichor? (from trolls and stuff)

-Alcohol
which could be divided into the various types:
-beer, wine, ale, rum, spirits, sunshine, cruor, whiskey

-Oil (crude)

And here are the liquids which already exist:
Magma
Water
Ocean water
Muddy water (sort of)
Bloody water (sort of)


Well, first of all, there is no way that there should be that many liquid types for alcohol. Having to handle the ways those things could be mixed together would just be ridiculous, especially once you see my little pictures below.

I'm also going to ignore gray goo and ichor for the time being.

So basically, let's see what happens if we try to add blood, oil, and a generic booze.

First of all, it needs to be established to what degree these liquids should be allowed to mix. If you tip a barrel of wine into a large lake, should it distribute itself across the entire lake? I say no, because that would require lots of decimal places and expensive computing.

I think liquids would have to be allowed to mix only to a point. Allow me to explain with this picture:



Get it? It's pretty simple. But the problem is that even if you allow only a SINGLE mixture of liquids, you still end up with a huge amount of combinations. You guys were probably aware of this, but it still helps to visualize it.
I've started out with water, blood, booze, and ocean water on the four cardinal points. Just look at the mess which springs forth:



I've crossed off some of the double mixes. There are also some double-mixes that seem necessary, like "watered-down, bloody booze." Should this be a liquid type? I don't know. I mean, some ancient cultures found out that mixing wine into the drinking water would make it safe to drink. And I guess someone could bleed into that?

Note that I didn't even consider the addition of mud, ichor, or puke. These would have added waaay more pointless sub-liquids.

So because of the combination annoyances that mixing liquid invariably leads too, we have to start cutting out the unnecessary liquids. And I don't think alcohol should be a liquid. Yes, it would be cool to have a wine fountain in your dwarf's dining room, or a beer or whiskey fountain... but the beer would lose its carbonation and go flat, the wine would oxidize, and the whiskey would slowly evaporate. There are reasons we keep all that stuff in bottles.

Oil? Definitely. It's explosive and you don't have to let it mix with stuff.
Blood? Yeah, that would be pretty cool to have as well.

You may have noticed that I stuck sand in that last picture as well. You can read about my sand idea here, but basically sand would have some behaviors of a liquid, and some behaviors of a solid. Go read it if you haven't.

If sand is added as well, there's two and only two options for how it should interact with the other liquids. It either displaces them or it absorbs them - there can be no middle ground. If sand absorbs liquids, you could have "bloody sand" instead of just some blood sitting on top of the sand. Water would also be able to percolate through sand - (but perhaps at half or one-fourth the speed as usual?) There's also the problem of figuring out when/if water should be able to push sand around. Water doesn't really have any kind of velocity variable right now from what I understand. But anyway, sand stuff can be discussed over in the sand thread.

Sand would always sink and oil would always rise.

I have one more idea which I think is instrumental for mixing liquids and for having oil in the game: cohesion!



It would not be limited to oil. Let's say that someone bleeds 2/7 of blood into a lake. There would be a patch of four 1's of "bloody water" which would stick together, instead of there being four separate pieces floating around.

I guess that any amount of bloody water would randomly distribute itself vertically and horizontally while remaining in a blob form, and possibly sucking up a lot of processing power unless it's programmed to stop moving somehow. I think this would be the biggest problem to overcome - when two liquids cannot mix any further, will they keep... glorping around each other forever? Maybe blood should just sink... or not be a liquid type at all.


Another possibility... have as many liquids as you want, but no liquids may mix with any other liquids. It would work, but it wouldn't be very realistic.

And an alternative to everything: scrap the X/7 liquid system altogether and handle liquids differently. I have no idea how or if this would work. Maybe entire bodies of water could be done with various percentages? I read a bit of the speedy fluid mechanics thread and it seemed like an interesting alternative. I'm not sure about the plausibility of such a system, though. But I think it deserves a mention.
« Last Edit: July 24, 2010, 12:00:47 am by Tehran »
Logged
Visit http://dfstories.com for stories!
And here's my solution for sand modeling: http://www.bay12forums.com/smf/index.php?topic=58397.0

existent

  • Bay Watcher
  • I Watch Bays
    • View Profile
Re: Problems and solutions for multiple liquid types (mostly problems)
« Reply #1 on: July 24, 2010, 01:36:12 am »

A lot of this (including the sand thing) was in one of the DF talks, I forget which one.
Logged
[DF 0.31.13]  ۝ War of the Ring Mod ۝  [WotR 0.13.3]

War of the Ring is back baby!
A mod based on Lord of the Rings, by JRR Tolkien.

aepurniet

  • Bay Watcher
    • View Profile
Re: Problems and solutions for multiple liquid types (mostly problems)
« Reply #2 on: July 24, 2010, 04:22:58 am »

why bother with mixing?  why not just track all these types separately.  computationally it is easier to track the component liquids, instead of creating new types of liquids that have to be also tracked.  you would not lose anything by doing this, since the liquid type (mixed or secondary liquid like slightly salty water) can be inferred from the contents of the cell.  actually it gives you more freedom since you can now track the exact salinity of the water by not mixing it. (as exact as dwarven quantum mechanics allows).

the only reason i can think of to mix liquids and create new types (instead of just tracking the actual component liquids) is if the new liquid has drastically different properties than the components.  (different density, rates and methods of spreading, etc, maybe like wet sand or something).
Logged

TheSummoner

  • Bay Watcher
    • View Profile
Re: Problems and solutions for multiple liquid types (mostly problems)
« Reply #3 on: July 24, 2010, 12:14:11 pm »

If they don't properly mix, it makes it too easy to remove a contaminant.  If you've got a 1x1 pond with 4 levels of water and 3 of blood, why can't the Dwarves pump away the blood and then be free to use the water?  But if you've got 6 levels of bloody water and 1 of water, that makes things a bit more difficult.
Logged

NW_Kohaku

  • Bay Watcher
  • [ETHIC:SCIENCE_FOR_FUN: REQUIRED]
    • View Profile
Re: Problems and solutions for multiple liquid types (mostly problems)
« Reply #4 on: July 24, 2010, 12:39:26 pm »

Don't mean to steal your thunder, but I'm trying to work out a revision of the fluid system, myself. 

http://www.bay12forums.com/smf/index.php?topic=61215.msg1427367#msg1427367

I'm mostly focusing on ways to pull DF off of the x/7 fluid that iterates on each tile mechanic, which is highly CPU-inefficient, not on adding more fluids, myself, but it would certainly make this sort of mechanic more easily handled when fluids aren't constrained to being represented by 4 bits in every tile's mapdata.
Logged
Personally, I like [DF] because after climbing the damned learning cliff, I'm too elitist to consider not liking it.
"And no Frankenstein-esque body part stitching?"
"Not yet"

Improved Farming
Class Warfare

Mel_Vixen

  • Bay Watcher
  • Hobby: accidently thread derailment
    • View Profile
Re: Problems and solutions for multiple liquid types (mostly problems)
« Reply #5 on: July 24, 2010, 01:18:36 pm »

Well blood and Alcohol etc. could just resolve slowly (aka get so thin that it would be useless to track) in the water (over a certain time) if the amount of water is high enought. This way you get some of the minor calculations out.
Logged
[sarcasm] You know what? I love grammar Nazis! They give me that warm and fuzzy feeling. I am so ashamed of my bad english and that my first language is German. [/sarcasm]

Proud to be a Furry.