News:

Use the "Forum Search"
It may help you to find anything in the forum ;).

Dry land below/on water level

Started by isidoro, February 21, 2009, 06:45:50 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

isidoro

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?

sojo

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.
"English is a easy language. But not for me." ;) sojo

follow simutrans_de on Twitter
- A home for Simutrans (in german)

whoami

#2
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.

isidoro

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

Václav

#4
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.

Chybami se člověk učí - ale někteří lidé jsou nepoučitelní

isidoro

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...
 

Václav

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.

Chybami se člověk učí - ale někteří lidé jsou nepoučitelní

Dwachs

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.
Parsley, sage, rosemary, and maggikraut.

Václav

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.

Chybami se člověk učí - ale někteří lidé jsou nepoučitelní

AP

#9
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).
QuoteThe 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.

kierongreen

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...

Fabio

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.

kierongreen

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.

prissi

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 ... )

kierongreen

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).


Fabio

Amazing! Thank you for working on this.

AP

Quote from: kierongreen on March 01, 2012, 07:51:42 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!

kierongreen

QuoteCan 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.

isidoro


An_dz

Really awesome!

Ctrl+C isidoro post

Isaac Eiland-Hall

Really awesome!

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

But seriously, really awesome. :)

kierongreen

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).

Ashley

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.
Use Firefox? Interested in IPv6? Try SixOrNot the IPv6 status indicator for Firefox.
Why not try playing Simutrans online? See the Game Servers board for details.

kierongreen

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.

prissi

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 ...

kierongreen

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!

prissi

One could require either a river or a trench ...

kierongreen

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...

prissi

The breaching could be easily forbidden ...

kierongreen

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....

omikron

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

Isaac Eiland-Hall

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

kierongreen

#32
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)...

prissi

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?

kierongreen

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.