1. This forum is obsolete and read-only. Feel free to contact us at support.keenswh.com

water

Discussion in 'General' started by n7m6e7, Apr 27, 2015.

Thread Status:
Not open for further replies.
This last post in this thread was made more than 31 days old.
  1. n7m6e7

    n7m6e7 Trainee Engineer

    Messages:
    61
    It has been suggested, and i was wondering how it can be implemented, since water does so many things.
    It pools, it flows from high to low, it drains, it floods across flat surfaces.

    All of that requires "pool" or "lake" objects to keep track of volume, adjust which blocks the water occupies, based on impassable blocks on all sides, besides up, maybe treat it like oxygen calculation, and detect "leaks" and form running streams if water is constantly escaping, letting streams connect 2 pools of varrying elevation,...

    Point is, that would all take MASSIVE computing, i believe. Do you guys think there is a simple "dumb" way to make streams for water wheels? Something a step above minecraft's infinite-water-ability? I was thinking just pre-generated streams... But lets face it, players are going to terraform, build canals, dig tunnels, and if i dig under a stream, i want that water to flood my workers out, re-direct thr stream, and ruin any small villages further down stream who rely on it.
     
  2. Me 10 Jin

    Me 10 Jin Apprentice Engineer

    Messages:
    463
    I don't know how minecraft does it, but there is a way for "dumb" water to behave sort of like real volumetric water. You're right that real volumetric fluids are computationally expensive.

    Instead of going all technical, imagine that water is made of marbles. You can put the marbles in a cup and they stay. You can spill them and they'll roll, obeying the forces acting upon them until they stop moving. Then imagine that these marbles could magically divide into smaller marbles or combine into bigger marbles depending on whether they are bunched up (e.g: in a cup) or rolling freely, all while conserving the original volume of marble. Wouldn't the result be indistinguishable from real water? Aren't voxels a good way to describe where marbles can/can't go?
     
  3. n7m6e7

    n7m6e7 Trainee Engineer

    Messages:
    61
    I was thinking about that, since there are so many 2-D "fluid" games that use a similar method. Like "Spewer", if anyone remembers that game, or "where's my water?"
     
  4. EternityTide

    EternityTide Senior Engineer

    Messages:
    1,950
    The problem is that to do that, the game has to render virtual objects that move, and the apply a volumetric shell that adapts to the movements of the virtual "marbles" underneath (like draping a blanket over a ball pit) Unfortunately, for this to work, you will have to massively increase the number of objects rendered by the game, and performance will take a big hit.
    I prefer the concept of graphically calculating vectors and volumetric displacement:
    [​IMG]
    In this case, the graph is mapping gravitational field strength to calculate lagrangian points, but the method still stands. This eliminates the need for particles and still works nicely with the computer's cartesian grid system.
     
  5. n7m6e7

    n7m6e7 Trainee Engineer

    Messages:
    61
    Nice, but i was thinking a system that involves pools and streams. Like water will run downhill, in a stream, until it can no longer go down. There it forms a pool, and the resulting stream becomes a kind of "conveyor" moving water from one pool to another of lower elevation. If it is not contained on 3 sides (blocked by more "stream" or solid earth) it should split. After streams are established, the impact should be minimal.
     
  6. Me 10 Jin

    Me 10 Jin Apprentice Engineer

    Messages:
    463
    The purpose of the marble analogy is to show that it is possible to approximate flowing fluids (including collisions, inertia, friction, etc...) using discrete units. Implementing it exactly as described would be quite naive (but it would look awesome as a prerendered animation).

    I'm curious though, how do you imagine 3D vector fields being used to approximate flowing water on dynamic terrain?
     
  7. EternityTide

    EternityTide Senior Engineer

    Messages:
    1,950
    Using the same method we use to chart pressure and airflow in our weather isobar systems. Denser lines mean higher pressure, and if there are a number of denser lines next to an area of no lines, the lines will spread out into that area until they can get no more diffuse.
    [​IMG]
    with the bulk of the calculation done by this simplistic means, more memory is freed up to render surface affects.
     
  8. DarkGhost

    DarkGhost Junior Engineer

    Messages:
    765
    Belongs to suggestion where it has been posted over 9000 times (along with why it's impossible for now).
     
Thread Status:
Not open for further replies.
This last post in this thread was made more than 31 days old.