The International Simutrans Forum

 

Author Topic: Illogical flows of rivers  (Read 273 times)

0 Members and 1 Guest are viewing this topic.

Offline makie

  • Devotee
  • *
  • Posts: 194
    • Homepage PAK128-German
  • Languages: DE
Illogical flows of rivers
« on: June 26, 2020, 07:27:02 AM »
Illogical flows of rivers.
A new thread for rivers according to    https://forum.simutrans.com/index.php/topic,20086.msg188824/topicseen.html#msg188824

The river changes on a watershed between two valleys, like on a bridge, from one plateau to another. Then it seeps away in a small lake on the plateau, while the valleys are completely dry. All other lakes are also strangely on plateaus.

[de]Der Fluss wechselt auf eine Wasserscheide zwischen zwei Tälern, wie auf einer Brücke, von einer Hochebene zur anderen. Dann versickert er in einem kleinen See auf der Hochebene, während die Täler komplett trocken sind. Auch alle anderen Seen liegen seltsam auf Hochflächen.

It would be awesome if these started on hills, then searching a way without upward slopes until they meet another river, map borders or a large larke/the ocean.
The rivers more or less work like that ...
The problem on extended was that lakes acted as a black hole for rivers, so most rivers (except for a few coastal streams) never actually reached the ocean until lakes became disabled by default. Even a giant river system could end at a 1-tile lake. Does this still happen on standard? I remember reading this thread about using additional passes to create lake outflows: https://forum.simutrans.com/index.php/topic,13114.msg130518.html#msg130518

[google]In real life, water flows down a hill until it reaches a barrier. There it builds up and forms a lake. The level of the lake rises until the water exceeds the hurdle, then it flows further down the river to the sea. Lakes are formed by rivers and are created in hollows or depressions that are filled with water. If the dam is breached at the end of the lake, the lake runs empty. Lakes are created when water runs into a deepening.

[de]In echt fließt Wasser einen Hügel hinab bis es eine Barriere erreicht.  Dort staut es sich und bildet einen See. Der Pegel des Sees steigt bis das Wasser die Hürde übersteigt, dann fließt es als Fluss weiter talwärts bis zum Meer. Seen werden also von Flüssen gebildet und entstehen in Mulden oder Senken die mit Wasser aufgefüllt werden. Wird der Damm am Ende des Sees durchbrochen, dann läuft der See leer. Seen entstehen also dadurch, dass Wasser in eine Vertiefung läuft.

If terrain lead the river to the card edge, then the river exit the map there.
Water follows always the steep way down. If the valley leave the map, the river do also.

Offline Vladki

  • Devotee
  • *
  • Posts: 3328
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS
Re: Illogical flows of rivers
« Reply #1 on: June 26, 2020, 08:56:46 AM »

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4702
  • Languages: EN, DE, AT
Re: Illogical flows of rivers
« Reply #2 on: June 26, 2020, 09:23:08 AM »
It seems that the pathfinding for rivers penalizes going downhill. Huh. Cannot do any tests, as I am in a video conference right now :D

Edit: these weights do not have any impact, as source and target of rivers are predetermined.
« Last Edit: June 26, 2020, 10:32:18 AM by Dwachs »

Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1347
Re: Illogical flows of rivers
« Reply #3 on: June 26, 2020, 12:01:26 PM »
More old ideas: Patch: The Rainfall River Generator
linked by Prissi in VS's old rainfall wind climate thread: NEW CLIMATES MODEL (was: The Equatorial Wind)

Offline Vladki

  • Devotee
  • *
  • Posts: 3328
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS
Re: Illogical flows of rivers
« Reply #4 on: June 26, 2020, 12:51:23 PM »
More old ideas: Patch: The Rainfall River Generator
That's the one I was looking for.

Offline Andyh

  • *
  • Posts: 81
Re: Illogical flows of rivers
« Reply #5 on: June 26, 2020, 04:55:02 PM »
I notice from another thread that someone is creating an in-game scripting function.  Perhaps it would be possible to write a script that generates a single river based on a specified starting tile.  Functionality would be something like this:

* User selects a tile... typically this would be at or close to the top of a mountain.
* User runs script
* Single river is generated that runs downhill from the point of origination. 
* Rules of the script would be something like:
     * At any given tile the river will choose the downhill route
     * If only flat routes are available river chooses a direction at random
     * If a choice of downhill routes is available, river chooses the steepest (i.e. prefers full-slope to half-slope) or at random if there is a choice of equally attractive routes
* Script ends when any of these conditions are fulfilled:
     * River reaches the edge of the map
     * River reaches the sea or a lake
     * River reaches another river
     * River cannot find a viable route (i.e. no downhill or flat routes are available)
* The size of the river would increase with length (e.g. first 10 tiles small stream, next 10 tiles medium stream... etc.)

This method would not solve the 'black hole lake' issue referred to above, but if a river runs into such a black hole it could easily be re-started on an adjacent tile (perhaps with a bit of judicious terraforming first)

This method probably isn't perfect, but would give the user a good deal of control and it would be possible to very quickly add a large number of rivers to any map.  And the number of rivers could easily be tailored to the type of region being modelled: e.g. fewer rivers in arid areas, more rivers in wetter areas.

Offline isidoro

  • Devotee
  • *
  • Posts: 1136
Re: Illogical flows of rivers
« Reply #6 on: June 26, 2020, 10:54:13 PM »
Two more ideas to complete the algorithm:
  • One can consider farther tiles if in a plateau (4x4), (5x5), etc.
  • Kind of speed of water:  if on a plateau, a uniform random direction isn't chosen but forward direction (downstream) is preferred.  It can be absolute, or it can be weighed.
Example of case 2): If last tile of the river was on the right, then, in a plateau, going left is preferred over turning up or down.