The International Simutrans Forum

Development => Bug Reports => Topic started by: uci on February 15, 2018, 09:44:40 AM

Title: Inconsisted climate range
Post by: uci on February 15, 2018, 09:44:40 AM
In "Lanscape Settings" dialog the minimum range for water level is -20 and the minimum range for climates is -5.
I think these values should be equal (-20), otherwise I cannot create proper climates for certain maps derived from heightmaps with many levels of altitude.

A related extension request was reported here
https://forum.simutrans.com/index.php?topic=17745.0 (https://forum.simutrans.com/index.php?topic=17745.0)

and an analysis of climates and snowlines here
https://forum.simutrans.com/index.php?topic=17894.0 (https://forum.simutrans.com/index.php?topic=17894.0)
Title: Re: Inconsisted climate range
Post by: Leartin on February 15, 2018, 10:54:42 AM
Quote from: uci on February 15, 2018, 09:44:40 AM
otherwise I cannot create proper climates for certain maps derived from heightmaps with many levels of altitude.

You can, although it's tricky. Instead of the landscape settings dialog, open the normal settings dialog, change to the landscape tab and change your water level to -20. Then close these settings, open them again, and you are able to use -20 for climate settings.

The normal landscape settings dialog is restricted to -5, while the landscape tab in the settings is restricted to the water level that was set when it was opened (unless already fixed)


Of course, it's still a bug. Just noting how you can circumvent it until it gets fixed.
Title: Re: Inconsisted climate range
Post by: uci on February 15, 2018, 12:14:37 PM
Quote from: Leartin on February 15, 2018, 10:54:42 AM
...open the normal settings dialog, change to the landscape tab and change your water level to -20

In the landscape tab water level cannot be set below -10.
Title: Re: Inconsisted climate range
Post by: prissi on February 16, 2018, 03:31:30 AM
Then you are using a set with single ground heights. Check next nightly please.
Title: Re: Inconsisted climate range
Post by: Leartin on February 16, 2018, 05:30:17 AM
Quote from: prissi on February 16, 2018, 03:31:30 AM
Then you are using a set with single ground heights. Check next nightly please.

It's actually true for half-height sets as well. You can set it to -20 in the landscape settings, but there you can only set -5 in the climates. If you open the landscape tab in the settings, it reverts to -10. However, since it was -20 when the tab was opened, you can now set the climates to -20 to have them only in the netherlands. So both climates at -20 and waterlevel -20 are possible, just not together.
It would probably be much easier to maintain if the landscape settings dialog was removed, and the button  for it would lead straight to the landscape settings tab. There, you'd only have to fix the range to allow for -20 in everything, and remove the weird "no lower than water level" restriction.
Title: Re: Inconsisted climate range
Post by: prissi on February 16, 2018, 12:27:19 PM
Why this is weird? Any land below the water level is turned to water on map creation. Also in order to prevent drawing errors, the highest climates should not be more than 32 levels above the lowest (the water line).
Title: Re: Inconsisted climate range
Post by: Leartin on February 16, 2018, 06:58:48 PM
It's weird because that's not how it currently works.
The lower limit for climates is fixed once you open the window. If you change the water level after you opened the window, this is not taken into account anymore. This causes two things:Removing the limit would at least fix the first situation, while the second stays the same - so over all, it would be an improvement.

Of course, if there is an intended range of waterlevel to waterlevel+32, it might be best to restrict those boxes to a range from 0 to 32 and just add the waterlevel before generation - pretty much the way it used to be.


Title: Re: Inconsisted climate range
Post by: prissi on February 17, 2018, 01:08:42 PM
It works after changing water level, then it is updated on the climate dialoge. The initial updating was missing, will be fixed soon.
Title: Re: Inconsisted climate range
Post by: uci on February 23, 2018, 08:44:53 PM
Original bug fixed in r8385. But another one surfaced (related).

Alpine climate range should be 0..32, regardless of water level settings. This is because alpine climate range is already displayed relative to water level (as intended probably).

Now, as a result of this new bug, on maps with low water level I get arctic climate (summer snow) almost everywhere (even on max serttings). For example, a water level -20 enforces arctic climate (summer snow) from level (-20+12)+1=-7 on max settings, which is just 13 levels above water.

(https://i.imgur.com/FSdIXSN.png)

Also, water level goes now up to -40! A feature?
Title: Re: Inconsisted climate range
Post by: IgorEliezer on February 23, 2018, 11:59:30 PM
Quote from: uci on February 23, 2018, 08:44:53 PM
Also, water level goes now up to -40! A feature?
Tss.. someone's been watching too much Pacific Rim, yo! :D
Title: Re: Inconsisted climate range
Post by: prissi on February 27, 2018, 06:12:17 AM
There was also a bug that the water level was reverted to -2 whenever a relief was loaded. Now the set water level should be used. (r8387)
Title: Re: Inconsisted climate range
Post by: uci on February 27, 2018, 01:51:41 PM
The (new) bug still not fixed in r8387. ::'(

Let me summarize:
- the bug did not appear in r8374
- the bug is related with how climate ranges are computed (alpine & arctic, in particular)
- the range for highest climates (alpine & arctic) seems to be wrongly computed (except for water_level=0)

As I mentioned previously, in climate dialog the range for alpine (and implicit arctic) climate is relative to water level, but the range for lower climates are in absolute tiles height. I think this is the source of the bug. An example is given 3 posts above.
Title: Re: Inconsisted climate range
Post by: prissi on February 28, 2018, 06:51:10 AM
In the code the artic climate is absolute, not relative, so the same limits should apply for everything. Sorry, I was misled by the initial posting. (For some strange reason, in the climate calculation always +1 is added.)
Title: Re: Inconsisted climate range
Post by: uci on March 02, 2018, 06:14:57 AM
Quote from: prissi on February 28, 2018, 06:51:10 AM
In the code the artic climate is absolute, not relative, so the same limits should apply for everything.

OK, but snow coverage appears too low on map then. See below.

water_level = -10
summer_snowline = 20
-----------------
I get snow on mid-summer at height = 11

(https://i.imgur.com/z1YJp3M.png)

water_level = -10
winter_snowline = 0
-----------------
I get snow on mid-winter at height = -9

(https://i.imgur.com/891BWK3.png)

Both snow levels should be 10 tiles higher. I think that snow coverage is displayed on map relative to water level. So, we still have a bug here (r8388).
Title: Re: Inconsisted climate range
Post by: Dwachs on March 02, 2018, 02:34:20 PM
In climates.cc lines 241--252 there are two nested for loops, both working on the variable i. I do not know what the code is intended to do.
Title: Re: Inconsisted climate range
Post by: prissi on March 03, 2018, 02:03:23 PM
The inner loop was useless (after being copied from the top) but it did not do any harm too.

The error is in simworld, where to the summer line (despite being absolute) the groundwater is added again. Not sure how to fix this, because it will affect the snow in all old games. The best that can be done is to correct the summer snowline upon loading, and live with the now correct (but likely higher) winter snowline.
Title: Re: Inconsisted climate range
Post by: uci on March 09, 2018, 06:28:43 AM
Having snow at lower elevations than expected is missleading for the player. I thought that arctic climate is relative to water level just because of that.

I hope some sort of fix is implemented, at least for summer snowlines. Currently maps with low water levels are "compromised" with too much snow.
Title: Re: Inconsisted climate range
Post by: prissi on March 20, 2018, 12:18:17 AM
In r8408 the artic climate is now converted upon loading/saving in older games to give the correct value without adding the groundwater.
Title: Re: Inconsisted climate range
Post by: uci on March 20, 2018, 08:19:17 PM
I confirm snowlines are now at absolute levels (r8410).  :)

But, there is a small remnant bug when pushing summer snowline to maximum (32 levels above water).

In spite of changing summer snowline from level 16 to 17 nothing changes on map, i.e. arctic climate begins at level 17 in both cases. Water level set to -15.

I think the later is wrong.

(https://i.imgur.com/iZV6CoU.png)
Title: Re: Inconsisted climate range
Post by: prissi on March 23, 2018, 12:49:17 PM
The value is internally clipped on closing, but the intermediate display is wrong. Anyway, border should range up to 127, not 32. That is rather an artificial resprition, based on the possible number of height levels with the random map generator. See r8411
Title: Re: Inconsisted climate range
Post by: uci on March 24, 2018, 04:45:02 PM
Summer snowline is clipped at 32 levels above water, no matter how high I set alpine climate (r8411). Is this the intended behaviour?
Title: Re: Inconsisted climate range
Post by: prissi on March 25, 2018, 01:56:41 PM
The internal array to convert climates to height had only 32 entries. Thus any entry heigher was stuck at snow. (Was not so obvious error, and likely there since the introduction of climates.)

There are other errors at heights larger than 33 (like no cursor) but at least the climates will be generated as desired.

Title: Re: Inconsisted climate range
Post by: uci on March 26, 2018, 07:41:04 PM
This is fantastic! Now we have a very flexible and more robust climate system. Thank you.  8)

Quote from: prissi on March 25, 2018, 01:56:41 PM
There are other errors at heights larger than 33 (like no cursor).

This is not a big problem for heightmaps, since I can set black color (0,0,0) in the image to be the lowest ground level on the map (water_level = -34 for this), and I have 64 usable height levels. Pretty impresive.

On another hand, before fixing these bugs it was possible to have snowy shores around water by setting winter snowline below water level. A very nice effect!

(https://i.imgur.com/0TSXDQ0.png)

After recent bug fixes this trick does not work anymore, because winter snowline cannot be set below water level.

May I suggest to allow the minimum range of winter snowline to be one level below water level? This will do the trick again.
Title: Re: Inconsisted climate range
Post by: prissi on March 27, 2018, 06:43:04 AM
That is certainly possible. In in r8415
Title: Re: Inconsisted climate range
Post by: Dwachs on April 10, 2018, 09:20:22 PM
I somehow managed to get alpine climate on beaches without changing the climate borders to extreme values. Could not reproduce.
Title: Re: Inconsisted climate range
Post by: uci on April 11, 2018, 05:05:05 AM
Quote from: Dwachs on April 10, 2018, 09:20:22 PMI somehow managed to get alpine climate on beaches without changing the climate borders to extreme values. Could not reproduce.
I played quite a lot with the new climate system in pak128, but I didn't notice anything weird.