Bay 12 Games Forum

Please login or register.

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

Author Topic: Waterfall object  (Read 1121 times)

Fieari

  • Bay Watcher
    • View Profile
Waterfall object
« on: May 01, 2009, 11:25:37 am »

In order to save CPU cycles, what if waterfalls weren't handled as flows, but like a structure.  When water reaches a cliff, instead of having it run over the edge and then be effected by gravity, have it spawn a "waterfall" object over the edge that extends downwards to one z-level above the ground.  This object would read the level of the flow at the top, and spawn that level at the bottom beneath it, so a stream would remain a stream, while a river would remain a river.

The key benefit to this would be that flows would remain -constant-, and non-fluctuating, even with a waterfall.
Logged

alfie275

  • Bay Watcher
    • View Profile
Re: Waterfall object
« Reply #1 on: May 01, 2009, 11:44:08 am »

And how would it handle being blocked, umm checking if its blocked, and what about custom defined flows so it must say what type it is and whats to stop it from being destroyed by building destroyers? Basically what I'm saying is that it wouldn't save CPU cycles that much and there are far more important things for what it's worth.
Logged
I do LP of videogames!
See here:
http://www.youtube.com/user/MrAlfie275

Aldaris

  • Bay Watcher
  • [LIBERAL] [WANNABE_DORF] [CAVE_ADAPTED]
    • View Profile
Re: Waterfall object
« Reply #2 on: May 01, 2009, 01:00:27 pm »

It would just be a map-tile that generates mist every once in a while. it simply blocks constructions, and whenever all river tiles adjacent to the top of the waterfall are blocked, the waterfall will 'switch off'. If you open the floodgates/obsidian/ w/e, thewaterfall will be recalculated, taking new constructions or deeper drops into account.

It might actually work.
Logged
but Baron Aqizzar had the firm advantage, battering Cthulhu with his Mighty Chin.
^Totally not out of context, promise.
The Liberal Crime Squad Community game, now with a Liberal Overdose of Liberally aplied Liberalism. -Liberally. (UBER-Hiatus, next update somewhere between now and 2012.)

alfie275

  • Bay Watcher
    • View Profile
Re: Waterfall object
« Reply #3 on: May 01, 2009, 01:07:46 pm »

Yeah but you are actually handling more information: Fluid type, top depth and bottom depth and you are having to check for blocking, when to make mist and making sure the depths are right. With current system it is: fluid type, depth, if hit object from above create mist, simple.
Logged
I do LP of videogames!
See here:
http://www.youtube.com/user/MrAlfie275

Rysith

  • Bay Watcher
    • View Profile
Re: Waterfall object
« Reply #4 on: May 01, 2009, 02:51:12 pm »

Yeah but you are actually handling more information: Fluid type, top depth and bottom depth and you are having to check for blocking, when to make mist and making sure the depths are right. With current system it is: fluid type, depth, if hit object from above create mist, simple.

Right now, waterfalls are flows. Flows are computationally expensive, because they involve pathfinding. each bit of water needs to path to where its trying to go, and since the place it is trying to go changes often, caching doesn't help. Type, two depths, a random mist counter, and a check each frame to make sure that it should still exist are trivial in comparison. Nobody complains that the plants and trees outside are slowing their fortress down, for example.
Logged
Lanternwebs: a community fort
Try my orc mod!
The OP deserves the violent Dwarven equivalent of the Nobel Peace Prize.

Draco18s

  • Bay Watcher
    • View Profile
Re: Waterfall object
« Reply #5 on: May 02, 2009, 12:36:01 am »

Nobody complains that the plants and trees outside are slowing their fortress down, for example.

YES I DO!  THEY'RE SLOWING THINGS DOWN!

That's why I butcher them, them and their elven companions!

 ;)
Logged

alfie275

  • Bay Watcher
    • View Profile
Re: Waterfall object
« Reply #6 on: May 02, 2009, 08:50:57 am »

Fluids don't path find, they just flow to an adjecent tile with less depth.
Logged
I do LP of videogames!
See here:
http://www.youtube.com/user/MrAlfie275

Volfram

  • Bay Watcher
  • hate you all.
    • View Profile
Re: Waterfall object
« Reply #7 on: May 02, 2009, 09:34:59 am »

Fluids don't path find, they just flow to an adjecent tile with less depth.
And if all adjacent tiles have equal depth, they path through those tiles to find one with less, stopping if it's determined that the fluid has reached level.

If nothing, fluids may be more pathfinding intensive than dwarves(per unit), because they path in 9 or 10 directions instead of just 8, and all of those one-depth differences skittering across the tops of your ponds are fluids trying to path to level.

Personally, I think the idea has merit, if handled properly.
« Last Edit: May 02, 2009, 09:36:49 am by Volfram »
Logged
Andir and Roxorius "should" die.

Yes, actually, I am trying to get myself banned.  I wish Toady would quit working on this worthless piece of junk and go back to teaching math.

alfie275

  • Bay Watcher
    • View Profile
Re: Waterfall object
« Reply #8 on: May 02, 2009, 11:17:37 am »

Really? I assumed they just waited till there was less than 7 depth and that was the reason 7 depth doesn't push objects, if they are pathing through tiles that are adjecent to less than 7 depth wouldn't the ones it is pathibng through just goto less than 7 depth? Diagram of 1 tile wide tunnel:

666000

Does not path straight to:
333333

It goes:
665100
654200
etc.
Logged
I do LP of videogames!
See here:
http://www.youtube.com/user/MrAlfie275

Silverionmox

  • Bay Watcher
    • View Profile
Re: Waterfall object
« Reply #9 on: May 02, 2009, 11:25:05 am »

It would be useful to have actual quantum water levels in ponds where we now have the water locked in a perpetual pathfinding motion in search of equilibrium. Instead of continuously pathfinding, the game just needs a connectivity map for that body of water. It then stores the average amount of water per square for that body of water, as defined by the connectivity map. At that point no calculations are needed until something messes with the body of water, i.e. makes the connectivity map need to update. The situation can be restored by having the height of tiles randomly generated as indicated by the average, on an as-needed basis.
Logged
Dwarf Fortress cured my savescumming.

Draco18s

  • Bay Watcher
    • View Profile
Re: Waterfall object
« Reply #10 on: May 02, 2009, 12:13:06 pm »

Really? I assumed they just waited till there was less than 7 depth and that was the reason 7 depth doesn't push objects, if they are pathing through tiles that are adjecent to less than 7 depth wouldn't the ones it is pathibng through just goto less than 7 depth? Diagram of 1 tile wide tunnel:

And what would this water do?

77777####
777770000
Logged

alfie275

  • Bay Watcher
    • View Profile
Re: Waterfall object
« Reply #11 on: May 02, 2009, 01:49:00 pm »

Are those grates? If so here is a side diagram:
Numbers are depths _ is grate(note that if there is no grate where was before because number there instead then assume grate is still there)

1st step:
77777____

2nd step:
777761___

3rd step:

777661___
        1(goes to floor below)


etc

of course exact numbers depend on which order tiles are simulated (here I am assuming right to left).
Logged
I do LP of videogames!
See here:
http://www.youtube.com/user/MrAlfie275

Draco18s

  • Bay Watcher
    • View Profile
Re: Waterfall object
« Reply #12 on: May 02, 2009, 06:17:52 pm »

Are those grates?

No, they're solid stone.  Because I didn't want to break out my Assembler book and look up the extended ASCII character code for rock.

You also completely missed the fact that that was seen from the side view.


~~~~~.....
77777█████
77777.....
██████████
« Last Edit: May 02, 2009, 06:20:59 pm by Draco18s »
Logged

alfie275

  • Bay Watcher
    • View Profile
Re: Waterfall object
« Reply #13 on: May 02, 2009, 06:42:33 pm »

Bottom right 7 flows right making it a 6 then the next simulated 7 to the 6 flow into the 6 making it a 7 etc, next turn the 1 does not move, 7 next to it moves into 1 making it a 2 etc etc. Of course it may flow more than 1 depth at a time. Oh and how does the 'waterfall' structure tell the difference between falling like a water fall and being in a pressure cistern filled from above?
Logged
I do LP of videogames!
See here:
http://www.youtube.com/user/MrAlfie275

Draco18s

  • Bay Watcher
    • View Profile
Re: Waterfall object
« Reply #14 on: May 03, 2009, 01:01:32 am »

Bottom right 7 flows right making it a 6 then the next simulated 7 to the 6 flow into the 6 making it a 7 etc, next turn the 1 does not move, 7 next to it moves into 1 making it a 2 etc etc. Of course it may flow more than 1 depth at a time. Oh and how does the 'waterfall' structure tell the difference between falling like a water fall and being in a pressure cistern filled from above?

So with all that pressure behind it it only goes

~~~~~.....
77776█████
777771....
██████████

in the first frame?

As opposed to the way pressure in DF actually works:

     .....
~~~~~█████
7777777777
██████████
Logged
Pages: [1] 2