The International Simutrans Forum

Development => Extension Requests => Topic started by: isidoro on February 21, 2009, 06:45:50 PM

Title: Dry land below/on water level
Post by: isidoro 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:

There would be a new button in the artificial slope window for this new tile with this behavior:

What do you think?
Title: Re: Lakes
Post by: sojo 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.
Title: Re: Lakes
Post by: whoami 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.
Title: Re: Lakes
Post by: isidoro on March 05, 2009, 01:18:01 AM
Being a special artificial slope tile has some advantages too:
Title: Dry land below/on water level
Post by: Václav 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.
Title: Re: Dry land below/on water level
Post by: isidoro 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...
 
Title: Re: Dry land below/on water level
Post by: Václav 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.
Title: Re: Dry land below/on water level
Post by: Dwachs 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.
Title: Re: Dry land below/on water level
Post by: Václav 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.
Title: Re: Dry land below/on water level
Post by: AP 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 (http://en.wikipedia.org/wiki/Drainage_basin), which will mostly be exorheic (drain to a common ocean) but some of which will be endorheic (http://en.wikipedia.org/wiki/Endorheic_basin) (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.
Title: Re: Dry land below/on water level
Post by: kierongreen 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...
Title: Re: Dry land below/on water level
Post by: Fabio 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.
Title: Re: Dry land below/on water level
Post by: kierongreen 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.
Title: Re: Dry land below/on water level
Post by: prissi 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 ... )
Title: Re: Dry land below/on water level
Post by: kierongreen 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).

Title: Re: Dry land below/on water level
Post by: Fabio on March 01, 2012, 08:00:14 PM
Amazing! Thank you for working on this.
Title: Re: Dry land below/on water level
Post by: AP on March 01, 2012, 08:06:18 PM
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!
Title: Re: Dry land below/on water level
Post by: kierongreen on March 01, 2012, 08:24:16 PM
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.
Title: Re: Dry land below/on water level
Post by: isidoro on March 01, 2012, 11:16:59 PM
Really beautiful!
Title: Re: Dry land below/on water level
Post by: An_dz on March 01, 2012, 11:46:45 PM
Really awesome!

Ctrl+C isidoro post
Title: Re: Dry land below/on water level
Post by: Isaac Eiland-Hall 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. :)
Title: Re: Dry land below/on water level
Post by: kierongreen 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).
Title: Re: Dry land below/on water level
Post by: Ashley 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.
Title: Re: Dry land below/on water level
Post by: kierongreen 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.
Title: Re: Dry land below/on water level
Post by: prissi 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 ...
Title: Re: Dry land below/on water level
Post by: kierongreen 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!
Title: Re: Dry land below/on water level
Post by: prissi on March 06, 2012, 12:41:55 PM
One could require either a river or a trench ...
Title: Re: Dry land below/on water level
Post by: kierongreen 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...
Title: Re: Dry land below/on water level
Post by: prissi on March 06, 2012, 03:18:40 PM
The breaching could be easily forbidden ...
Title: Re: Dry land below/on water level
Post by: kierongreen 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....
Title: Re: Dry land below/on water level
Post by: omikron 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
Title: Re: Dry land below/on water level
Post by: Isaac Eiland-Hall 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
Title: Re: Dry land below/on water level
Post by: kierongreen 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)...
Title: Re: Dry land below/on water level
Post by: prissi 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?
Title: Re: Dry land below/on water level
Post by: kierongreen 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.
Title: Re: Dry land below/on water level
Post by: prissi on March 06, 2012, 09:27:16 PM
Why the widening of existing gaps from rivers?
Title: Re: Dry land below/on water level
Post by: kierongreen 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.
Title: Re: Dry land below/on water level
Post by: Isaac Eiland-Hall 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
Title: Re: Dry land below/on water level
Post by: prissi 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.
Title: Re: Dry land below/on water level
Post by: el_slapper 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?
Title: Re: Dry land below/on water level
Post by: kierongreen 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.
Title: Re: Dry land below/on water level
Post by: The Hood 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.
Title: Re: Dry land below/on water level
Post by: prissi 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.
Title: Re: Dry land below/on water level
Post by: kierongreen 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).
Title: Re: Dry land below/on water level
Post by: The Hood 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.