The International Simutrans Forum

 

Author Topic: Dry land below/on water level  (Read 11351 times)

0 Members and 1 Guest are viewing this topic.

Offline isidoro

  • Devotee
  • *
  • Posts: 1129
Dry land below/on water level
« on: February 21, 2009, 06:45:50 PM »
Once we've got rivers, the next step would be lakes, wouldn't it?

My idea is this:
  • Create a new "artificial slope" tile made of water.  That artificial slope will be only of the flat type: no slopes
  • When used in a map, the sea graphic would be reused to paint it
  • Two, three, etc. lake tiles piled on top of each other, would make a darker blue, like sea.

There would be a new button in the artificial slope window for this new tile with this behavior:
  • If used, a full layer of water would flood from the point used under the following conditions.
  • The flood will succeed only if that layer will not go down (i.e. keep flat at that level), will not reach the sea and will not destroy buildings, roads, etc.
  • As it is an artificial slope, if players try to move the ground near it, the message "clear the tile before" would appear and prevent it
  • The regular remove artificial slope would "dry" a layer of water if used on a "lake slope"

What do you think?

Offline sojo

  • Devotees (Inactive)
  • *
  • Posts: 851
  • Maintainer pak96.comic
    • German home of Simutrans
Re: Lakes
« Reply #1 on: February 21, 2009, 07:39:39 PM »
I don't know. Looks this good on a mountainous map? A lake between a moutain and a valley?

There must be a minimum of size for free to looks good. Mayby a 8x8 space for a 3x3 lake.

Offline whoami

  • Devotees (Inactive)
  • *
  • Posts: 693
Re: Lakes
« Reply #2 on: March 04, 2009, 03:06:39 PM »
I guess it would be easiest to just code lakes as special river tiles, and adapt the code to only use them if the surrounding terrain fits. The effort in graphics would be the same: nine tiles (edit: for convex/brick shape only) for each lake style/colour. Rotating needs to be adapted, too.
« Last Edit: March 04, 2009, 06:17:25 PM by whoami »

Offline isidoro

  • Devotee
  • *
  • Posts: 1129
Re: Lakes
« Reply #3 on: March 05, 2009, 01:18:01 AM »
Being a special artificial slope tile has some advantages too:
  • No need for extra graphics.  It is only a flat tile.  Sea tiles would do with automatic animation too.
  • Can be easily reverted.  If it is a river tile, first you should make the terrain flat.  Then, the river.  If you erase the lake, the artificial slope remains.  You have a limit of 2-height difference for land tiles.
  • You can build the bottom of the lake with artificial slopes and then, on top of them, lake tiles.
  • The color of the tile will be darker if the lake is deeper, just like seas, with not much programming
  • Consistent graphics between lakes and sea.
  • No need to alter pakset files specification.  Will work with older games or newer paks with no change

Offline Václav

  • Devotee
  • *
  • Posts: 3267
  • formerly VaclavMacurek
  • Languages: CZ, EN
Dry land below/on water level
« Reply #4 on: February 22, 2012, 02:04:25 PM »
I have following (may be fully crazy) idea:

It is clear that water is on any level and so if I make decision to use terrain tools to create canal with this (instead of building of classical canal) from shore, water will flow there - and place will be flooded.

But if I use terrain tools to dig somewhere inside (for example) desert, I don't see why there should be water - if I would dig into water level (it means mostly from level -1 to level -2 ).

This minor extension would be very good to avoid quite strange situations like tunnel entrances on water level - where any way touches water in that place where land is on water level.
« Last Edit: February 26, 2012, 07:17:36 AM by IgorEliezer »

Offline isidoro

  • Devotee
  • *
  • Posts: 1129
Re: Dry land below/on water level
« Reply #5 on: February 22, 2012, 05:57:38 PM »
And you have just the opposite: lakes above sea level.  In my last map, I built some more rivers by hand when extending the map.  Unfortunately, some of them ended in hollow pieces of land above sea level where I would like a lake to be...
 

Offline Václav

  • Devotee
  • *
  • Posts: 3267
  • formerly VaclavMacurek
  • Languages: CZ, EN
Re: Dry land below/on water level
« Reply #6 on: February 22, 2012, 07:25:39 PM »
Yes. It is another thing that is sometimes at least strange - because lakes in deep hollows - like they are on water level but close land is elevated too much - in opposite to that water area.

And small comment based on experience from TTD - I saw there town placed on land on the same level as water - and that dry land was separated from water by something like rockfill dam ... and I did not see it and town was flooded - for ever after.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4602
  • Languages: EN, DE, AT
Re: Dry land below/on water level
« Reply #7 on: February 22, 2012, 07:30:33 PM »
The first idea: land below sea level would require a lot of code reworking.

The second one: lakes above sea level are much 'easier' to realize.

Offline Václav

  • Devotee
  • *
  • Posts: 3267
  • formerly VaclavMacurek
  • Languages: CZ, EN
Re: Dry land below/on water level
« Reply #8 on: February 22, 2012, 07:43:21 PM »
And both ones have minor weak point: connection with water of else elevation. You can do it only with canals because water graphics has not slopes. But it surely may lead to very interesting water ways.

Offline AP

  • Devotee
  • *
  • Posts: 1202
  • Languages: EN
Re: Dry land below/on water level
« Reply #9 on: February 22, 2012, 08:34:03 PM »
The logical outcome would be for the terrain map to be somehow analysed for watersheds, identifying each drainage basin, which will mostly be exorheic (drain to a common ocean) but some of which will be endorheic (self contained).
Quote
The second one: lakes above sea level are much 'easier' to realize.
It would then be logical for "ocean" to appear in the bottom of each drainage basin it is not already present in.

This, I suspect would make the automatic river-building code much more reliable, since often at the moment it struggles as all rivers must ( I presume) flow downhill to the ocean, but if a low sea level is used, many endorheic basins in simutrans lack any ocean tiles and thus the terrain-builder generates them as implausibly dry.

Edit: typo.
« Last Edit: February 22, 2012, 08:46:27 PM by AP »

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2269
Re: Dry land below/on water level
« Reply #10 on: February 22, 2012, 08:38:45 PM »
This has got my interest, I have some time and just got simutrans to compile again. I'll see what I can come up with...

Offline Fabio

  • Devotee
  • Administrator
  • *
  • Posts: 2898
  • The Pak128 Guy
    • Visit me on Facebook
  • Languages: EN, IT, RO, FR
Re: Dry land below/on water level
« Reply #11 on: February 22, 2012, 08:59:16 PM »
Separating water from height would be also related to  different climates on the same level, IMHO. There was a thread about it, if you're interested too.

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2269
Re: Dry land below/on water level
« Reply #12 on: February 22, 2012, 09:12:33 PM »
I'm aware, I did contribute to that heavily! Yes having water at different levels could need some more tiles, however this is a special case of climates as it does impact on functionality and it should be possible to limit the new tiles needed.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9568
  • Languages: De,EN,JP
Re: Dry land below/on water level
« Reply #13 on: February 22, 2012, 10:41:09 PM »
Different climates tilewise could be achieved easily, by making the climate part of grund_t. The problems are rather the images. Btw, in OpenTTD this is also done very abrupt, i.e. flat transition tiles are one of one type (but that is ok, otherwise one would really too many transition tiles ... )

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2269
Re: Dry land below/on water level
« Reply #14 on: March 01, 2012, 07:51:42 PM »
Screenshot attached....
 
 Current progress:
 Water heights greater than sea level supported (yes I know this is exactly the opposite of the request but for now at least it was easier to use this constraint).
 Raise and lower water tool can be used in map editing tools (currently just raises and lowers water height on selected tile).
 Tile transition generation code has been written (but not tested).
 
 Current thoughts on way forward:
 Raise and lower tool should raise/lower "lake" level. If lake level would spill over into raising sea level this should be prohibited.
 Where there is edge of lake and land slopes downwards there should be a one tile border (to allow for correct graphics).
 
 

Offline Fabio

  • Devotee
  • Administrator
  • *
  • Posts: 2898
  • The Pak128 Guy
    • Visit me on Facebook
  • Languages: EN, IT, RO, FR
Re: Dry land below/on water level
« Reply #15 on: March 01, 2012, 08:00:14 PM »
Amazing! Thank you for working on this.

Offline AP

  • Devotee
  • *
  • Posts: 1202
  • Languages: EN
Re: Dry land below/on water level
« Reply #16 on: March 01, 2012, 08:06:18 PM »
Raise and lower water tool can be used in map editing tools (currently just raises and lowers water height on selected tile).
Can we create water where none exists? If I dig a hole, can I fill it with water now? I ask because I realised in a game yesterday there are no "ship canals" - at least not in the pak.gb - so the ability to dig one would be useful!

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2269
Re: Dry land below/on water level
« Reply #17 on: March 01, 2012, 08:24:16 PM »
Quote
Can we create water where none exists? If I dig a hole, can I fill it with water now? I ask because I realised in a game yesterday there are no "ship canals" - at least not in the pak.gb - so the ability to dig one would be useful!
Yes, however you would need rivers/canals to connect lakes (i.e. raised water sections) with rest of water network. Ships can use canals in pak128.Britain, in standard at least.

Offline isidoro

  • Devotee
  • *
  • Posts: 1129
Re: Dry land below/on water level
« Reply #18 on: March 01, 2012, 11:16:59 PM »
Really beautiful!

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2908
  • D'oh
    • by An_dz
  • Languages: pt, en, it, (de)
Re: Dry land below/on water level
« Reply #19 on: March 01, 2012, 11:46:45 PM »
Really awesome!

Ctrl+C isidoro post

Offline Isaac.Eiland-Hall us

  • Benevolent Dictator
  • Administrator
  • *
  • Posts: 3659
  • PanamaCityPC.com/support/
    • Facebook Profile
  • Languages: EN
Re: Dry land below/on water level
« Reply #20 on: March 02, 2012, 06:13:35 AM »
Really awesome!

It's useless to CTRL-C if you don't CTRL-V. Just sayin'

But seriously, really awesome. :)

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2269
Re: Dry land below/on water level
« Reply #21 on: March 02, 2012, 01:37:09 PM »
Away for weekend now but did some more work last night. Transitions from water to different climates with slopes work, level transitions are in progress. Raise and lower water tool still only affects one tile and is somewhat unstable even after some debugging... Transitions to water add about 100 tiles per climate (700 overall) even with some restrictions. Game seems to cope so farthough... (unrestricted transitions would add about 2000 tiles overall).

Offline Ashley

  • Coder/Patcher
  • Devotee
  • *
  • Posts: 1288
    • entropy.me.uk
Re: Dry land below/on water level
« Reply #22 on: March 02, 2012, 04:53:12 PM »
It may be found that generating the tiles on-the-fly, and caching them only for a short time is more efficient than generating them all at once.

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2269
Re: Dry land below/on water level
« Reply #23 on: March 06, 2012, 07:45:21 AM »
A night of coding....

Restrictions when using raised water:
Cannot have one tile wide land in middle of water
Cannot have water next to a downward slope

Graphics are now complete (raising number of tiles per climate to 195 from 43 in trunk) - aside from above restrictions any combination of slope and water is possible, however logic for enforcing these restrictions and code for save/load still to do.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9568
  • Languages: De,EN,JP
Re: Dry land below/on water level
« Reply #24 on: March 06, 2012, 09:10:47 AM »
Hmm, in OpenTTD open water must be always surrounded by a trench. Imho this would make very much sense (and would also remove the problems with Water flowing around harbours in you image). One would just have to forbid to remove the last of such barriers (which should not be too hard.

By the way, would this show the animation?

And now the ground textures will use 4000 images --- I think we sooner or later have to extend image IDs to 32 bit ...

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2269
Re: Dry land below/on water level
« Reply #25 on: March 06, 2012, 12:14:29 PM »
Requiring a sloped barrier around any water considerably reduces the number of images required certainly! Hower some landscape generation such as rivers flowing out of lakes is then not possible. I'm also considering whether level shores for sea should be allowed. Piers can still only be built on slopes, but shipyards can be built next to shore whether that is sloped or flat. Not checked animation yet no reason why it should not though. I'm aware of the behaviour in TTD it is a useful guide but we do not have to copy it exactly!

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9568
  • Languages: De,EN,JP
Re: Dry land below/on water level
« Reply #26 on: March 06, 2012, 12:41:55 PM »
One could require either a river or a trench ...

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2269
Re: Dry land below/on water level
« Reply #27 on: March 06, 2012, 01:46:46 PM »
Yes the thing is if you allow rivers out you need just as many tiles to avoie ugly transitions! Thinking of the logic to enforce slopes around water I do remember with TTD constructing large areas at sea level then flooding them by breaching the dyke...

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9568
  • Languages: De,EN,JP
Re: Dry land below/on water level
« Reply #28 on: March 06, 2012, 03:18:40 PM »
The breaching could be easily forbidden ...

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2269
Re: Dry land below/on water level
« Reply #29 on: March 06, 2012, 06:08:44 PM »
Yes of course, but prohibiting breaching when you also allow rivers may give result in a non-intuitive interface. It may not be directly obvious when a breach would occur for example.

Originally I was planning for these lakes to be constrained by slopes apart from the edge of a "hanging valley" (screenshot 1), as I thought this the best balance between number of transitions and landscape freedom however in the end the number of transitions required for this meant that in practice it was just as easy to allow level transitions anywhere (of the 152 extra tiles required per climate, 12 were the additional ones required for full flexibility!).

Screenshot 2 illustrates what happens if rivers are permitted to leave lakes but they are otherwise constrained, screenshot 3 illustrates if the barrier is fixed. My opinion is that neither looks that great, particularly when the barrier length is much longer....

Offline omikron

  • *
  • Posts: 110
  • Languages: EN, DE, NO, FR, EE
Re: Dry land below/on water level
« Reply #30 on: March 06, 2012, 08:21:15 PM »
What about the option from screenshot 2, with four extra tiles per climate for N, S, E and W river entrance/exit? I would say that is a better alternative.

Otherwise, are you still considering the necessity to select each and every tile of the lake, or would there be a 'fill basin'-option?

omikron

Offline Isaac.Eiland-Hall us

  • Benevolent Dictator
  • Administrator
  • *
  • Posts: 3659
  • PanamaCityPC.com/support/
    • Facebook Profile
  • Languages: EN
Re: Dry land below/on water level
« Reply #31 on: March 06, 2012, 08:29:30 PM »
re: selecting every tile... Maybe now's the time to revisit extension requests for two-dimensional click-dragging tools? Level land, fill water... would be useful, nu? ;-)

Meanwhile, this is such an amazing development. I really love that river coming out of the lake... it's fantastic! :D

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2269
Re: Dry land below/on water level
« Reply #32 on: March 06, 2012, 08:55:37 PM »
Screenshots are using current code which has smooth transitions for all possibilities (barring restrictions I mentioned - not next to down slope or single land tile in water). Allowing rivers as in screenshot 2 uses 40 transition tiles per climate over base. Currently tool is just per tile however I'm thinking how to best implement fill and drain basin. As for click-drag versions of height tools I think that's another topic entirely!

Incidentally, I've answered my own question as to whether a level sea shore is possible. The answer is no, because in winter this would require tiles to blend 4 textures, code only supports 3 and there are no easy (i.e. fast and not complex) ways to change this. However, levels below sea level are possible as long as a dyke is present (it does work technically with flat transitions but is ugly so logic will stop this)...
« Last Edit: March 06, 2012, 09:01:24 PM by kierongreen »

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9568
  • Languages: De,EN,JP
Re: Dry land below/on water level
« Reply #33 on: March 06, 2012, 09:02:12 PM »
I think the river out of the lake is beautiful. Maybe allow only player 1 to alter a "dyke" and built a river as a flat exit?

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2269
Re: Dry land below/on water level
« Reply #34 on: March 06, 2012, 09:23:58 PM »
Currently these are in map edit tools i.e. only usable by public player. Maybe tools should be:
* Raise/lower water area - usable by player as long as only affects nature. Can be used to drain polders or remove the water from sea level tunnel entrances (which should then be forbidden unless water has been removed).

* Raise/lower tile - same as current tool except takes into account water - will not allow you to breach a dyke (whether at sea level or above), however widening existing gaps by rivers would be allowed. Subject to this restriction will resolve any potential problems with water height - lowering or raising it as appropriate to link to neighbouring water, if it cannot then will fail (and may have to switch to public player to edit tiles individually).

* Slope editing tools - same as current tools again but with same restrictions as raise/lower tile.

* Raise/lower individual water tiles - only usable by public player for map editing purposes. Will prevent graphical problems but otherwise any action is permitted.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9568
  • Languages: De,EN,JP
Re: Dry land below/on water level
« Reply #35 on: March 06, 2012, 09:27:16 PM »
Why the widening of existing gaps from rivers?

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2269
Re: Dry land below/on water level
« Reply #36 on: March 06, 2012, 10:06:38 PM »
If you were trying to be strict about enforcing restrictions then I guess this would not be allowed.

Consider however the following landscape in two versions, one allowing level transitions, one forcing a dyke which only a river can pass through. The requirement for a dyke, while not that noticeable on smaller valleys looks quite unnatural here in my opinion. Also this shows that small channels leading off the lake, which at sea level would be filled with water are here dry land (see towards top of open ended valley, or behind dyke in closed valley). This is due to the way slopes and water combinations are detected - unless a dyke is required 100% of the time (even with rivers) it must work this way. It does however also complicate dyke detection code. Of course, I've no idea under what circumstances a revised map builder if implemented might automatically generate lakes, but I think that logic for it to insist on single tile wide outlets for rivers might also be difficult to code.

Offline Isaac.Eiland-Hall us

  • Benevolent Dictator
  • Administrator
  • *
  • Posts: 3659
  • PanamaCityPC.com/support/
    • Facebook Profile
  • Languages: EN
Re: Dry land below/on water level
« Reply #37 on: March 07, 2012, 12:11:23 AM »
One thing to bear in mind, although I hesitate to bring it up, but I anticipate that people are going to want to see hydroelectric dams somehow. Certainly, I'd love to be able to have a canyon and place a road on top of a dam, hydroelectric or not. :D

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9568
  • Languages: De,EN,JP
Re: Dry land below/on water level
« Reply #38 on: March 07, 2012, 09:27:36 AM »
A river during creation lower the itself one tile deep into the ground. Thus, as soon as you have lakes, the river generator will automatically take care of making such a one tile outlet.

And personally, I really like screenshot 2 more. I think, given the simutrans scale, those lakes are rather huge. As such a real beach is more pleasant to the eye.

Offline el_slapper

  • *
  • Posts: 211
  • Languages: FR, EN, DE
Re: Dry land below/on water level
« Reply #39 on: March 07, 2012, 09:30:54 AM »
Question I didn't see asked(maybe I missed it) : will it be possible(and shall it be) to drown cities under man-made lakes?
« Last Edit: March 07, 2012, 11:50:45 AM by fabio »

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2269
Re: Dry land below/on water level
« Reply #40 on: March 07, 2012, 11:28:02 AM »
No, code will only allow water to be raised if empty landscape (or just trees) will be flooded.

Offline The Hood

  • Devotee
  • *
  • Posts: 2889
  • pak128.Britain developer
Re: Dry land below/on water level
« Reply #41 on: March 07, 2012, 09:05:06 PM »
I think the level transitions look really nice - it's a shame these can't be done for sea levels as the way it is currently implemented, with a +1 level rise on all coasts, it seems like a large vertical drop when many coastal areas are very flat indeed (especially in e.g. Eastern England, Netherlands etc.). Similarly with rivers - it never quite looks right to me to have rivers sitting in such a narrow, deep channel all of the time as the lower reaches of most rivers are broad, flat flood plains.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9568
  • Languages: De,EN,JP
Re: Dry land below/on water level
« Reply #42 on: March 07, 2012, 09:26:20 PM »
Just use a lower height step (like 8 or 12 pixel for pak128 britain shoudl be easily possible. Yuu "just" need the change all ways at slopes, pilalrs and tunnel entraces and the articifial slopes. Since pak128.britain is rendered, this is not completely out of question.

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2269
Re: Dry land below/on water level
« Reply #43 on: March 07, 2012, 09:39:58 PM »
Playing devils advocate about those low lying areas you mention, if they have significant populations they tend to be defended with dykes, naturally they tend to be marshland which simutrans does not attempt to depict.

Personally I agree with level changes around rivers lakes and sea to some extent. However I realise there is a balance in the game that has to be struck between features and simplicity. Many details cannot be depicted in simutrans because of the design of the game - that's not to say this is good or bad, to make a playable game you need to enforce some restrictions! Simutrans (non-experimental at least) tries avoid changes which makes the game significantly less easy to use.

Level sea shores *can* be done, theoretically, either by:
*enforcing restriction that there has to be at least one flat tile between sea and slope - so that tiles never have 4 textures
*ignoring problem and putting up with graphical inconsistencies
*allowing blending routines to use more than 3 textures

I just don't think at current time any of these solutions are worth pursuing - of course if lakes get to point of being incorporated into trunk then can think about looking again - however there's still much coding, and working out exact interface before we get to that stage!

Incidentally with height steps one advantage of the current height steps being so large is that it is obvious at a glance whether tiles are at the same level, with smaller steps this is not always the case (which causes problems in games which use 3d engines).

Offline The Hood

  • Devotee
  • *
  • Posts: 2889
  • pak128.Britain developer
Re: Dry land below/on water level
« Reply #44 on: March 07, 2012, 09:41:50 PM »
I had considered that, but it would be a massive amount of work. If double height slopes is ever supported, I might consider it - because there are other situations where steeper slopes look right too.