The International Simutrans Forum

 

Author Topic: More climates on the same height level  (Read 851 times)

0 Members and 1 Guest are viewing this topic.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9992
  • Languages: De,EN,JP
More climates on the same height level
« on: June 15, 2020, 03:43:01 AM »
Here is a patch that defines overlapping climates on the same height level. Thus at the same level you can have more than one climate. The climates will start ellipsoidal, but due to overlapping etc. the real appearance is quite patchy, as intended. Thus also climate display was added to the minimap.

What is still missing is the conversion of the climate changes after raining or levelling mountains, which still use the height mapping. But the information is there, so this is relatively easy to fix.

Moreover, having a map file with climates and applying those to newly loaded maps is rather easy to add.
« Last Edit: June 15, 2020, 07:41:41 AM by prissi »

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4702
  • Languages: EN, DE, AT
Re: More climates on the same height level
« Reply #1 on: June 15, 2020, 05:56:11 AM »
This is a nice idea!

Offline makie

  • Devotee
  • *
  • Posts: 192
    • Homepage PAK128-German
  • Languages: DE
Re: More climates on the same height level
« Reply #2 on: June 15, 2020, 08:36:04 AM »
I have already experimented with height map files, in which only the green color channel defines the height, red shows cities and blue shows rivers, lakes and the sea.

Blue
255 = sea
200 = lake
150 = great river
50 = small river.

The climatic region could be coded in the red channel.

red
255 = city
200 = road

0 = desert
30 =tropic
60 =mediterran
90 = temperate
120 = tundra
130 = rocky
150 = arctic
That would be quite useful for pak128german.

Offline Vladki

  • Devotee
  • *
  • Posts: 3328
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS
Re: More climates on the same height level
« Reply #3 on: June 15, 2020, 06:03:17 PM »
That would be great for making real world maps

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9992
  • Languages: De,EN,JP
Re: More climates on the same height level
« Reply #4 on: June 16, 2020, 12:11:05 AM »
You could have same climate on the same height since ages. Map generated with this patch can be loaded and displayed in older Simutrans versions as well.

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2303
Re: More climates on the same height level
« Reply #5 on: June 16, 2020, 04:51:19 PM »
Interesting proof of concept. I can see there being scope for various modules to be part of landscape generation - building on current relatively simple options with this as part of it.

Had to alter it slightly to compile on my linux system with gcc - I did observe one segmentation fault that I wasn't able to repeat.

Offline Andyh

  • *
  • Posts: 81
Re: More climates on the same height level
« Reply #6 on: June 18, 2020, 08:28:43 PM »
This would be amazing!  Does it mean that one could load a "climate map" in the same way that one can load a height map currently?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9992
  • Languages: De,EN,JP
Re: More climates on the same height level
« Reply #7 on: June 18, 2020, 11:59:04 PM »
Not yet, but that is the idea. Actually one would best load them together.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9992
  • Languages: De,EN,JP
Re: More climates on the same height level
« Reply #8 on: June 19, 2020, 01:28:25 PM »
Submitted in r9148

Offline makie

  • Devotee
  • *
  • Posts: 192
    • Homepage PAK128-German
  • Languages: DE
Re: More climates on the same height level
« Reply #9 on: June 19, 2020, 07:19:32 PM »
If this is intended  ::-\

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9992
  • Languages: De,EN,JP
Re: More climates on the same height level
« Reply #10 on: June 20, 2020, 01:27:56 AM »
Apparently I did not caught all cases of unassigned tiles yet. I will try with your settings.

Offline ceeac

  • Devotee
  • *
  • Posts: 135
Re: More climates on the same height level
« Reply #11 on: June 20, 2020, 05:35:55 AM »
Missing parentheses here:
Code: [Select]
gui/map_frame.cc:235:30: warning: & has lower precedence than !=; != will be evaluated first [-Wparentheses]
                if( env_t::default_mapmode & minimap_t::MAP_CLIMATES != 0 ) {
                                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
and also 3 lines below.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9992
  • Languages: De,EN,JP
Re: More climates on the same height level
« Reply #12 on: June 20, 2020, 12:50:16 PM »
Thank you, I had the other way round in memory. But I find it really stupid, that + is above == but & is below. Well, even Ritchie said that this was an unfortunate design decision, so who am I to complain ...

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5642
  • Languages: EN, NO
Re: More climates on the same height level
« Reply #13 on: June 20, 2020, 07:11:17 PM »
No wonder I've never figured out operator precedence, beyond pluss/minus and multiplication from basic math. And I guess most other programming languages follow C, because it would be even more confusing if the didn't. I'll just stick with trowing parenthesis around everything just to be sure, and let the IDE correct me when I go to far.

Offline Vladki

  • Devotee
  • *
  • Posts: 3328
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS
Re: More climates on the same height level
« Reply #14 on: June 20, 2020, 08:20:31 PM »
Just an idea for further improvement.

Could it be optionally made so that the upper limit for a climate will apply to southern edge of the map, while lower limit to the northern edge (and a gradual lowering across the map? Thus we could get lower snowline (and no desert and tropical) in the north, and higher or none snowline in the south.

Offline Andyh

  • *
  • Posts: 81
Re: More climates on the same height level
« Reply #15 on: June 20, 2020, 08:28:47 PM »
ust an idea for further improvement.

Could it be optionally made so that the upper limit for a climate will apply to southern edge of the map, while lower limit to the northern edge (and a gradual lowering across the map? Thus we could get lower snowline (and no desert and tropical) in the north, and higher or none snowline in the south.

I had proposed something similar to this several years ago.  Maybe it's time has come; although I like the idea of being able to upload a "climate map" even more.



Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9992
  • Languages: De,EN,JP
Re: More climates on the same height level
« Reply #16 on: June 21, 2020, 11:58:15 AM »
The snowline height is a global variable. Only the arctic climate is something that can be defined locally. And the guys down under will complain about snow in the north ...

Offline Vladki

  • Devotee
  • *
  • Posts: 3328
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS
Re: More climates on the same height level
« Reply #17 on: June 21, 2020, 12:05:14 PM »
And the guys down under will complain about snow in the north ...
Then we would need a switch like "drive on left" that will swap the behavior to move climates down in south and up in north.

Offline Isaac Eiland-Hall

  • Benevolent Dictator
  • Administrator
  • *
  • Posts: 3792
  • Providing hosting for Simutrans projects
    • pc2.io
  • Languages: EN
Re: More climates on the same height level
« Reply #18 on: June 22, 2020, 01:09:44 AM »
Well, theoretically, there might be something like three options for that: cold-top/warm-bottom, warm-top/cold-bottom, cold-top+bottom/warm-middle. And a fourth option of "none of the above" lol.

Offline kierongreen

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 2303
Re: More climates on the same height level
« Reply #19 on: June 23, 2020, 12:48:07 AM »
To keep both sides of the equator happy an alternative would be to define northern and southern latitude of the map. From that you could calculate which direction the snowline should increase to, and also prevailing wind direction (0-35 degrees north/south = east, 35-65 degrees north/south = west, 65-90 degrees north/south = east). With that a moisture map can be calculated which could be used to simulate various affects on climate (and vegetation).

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9992
  • Languages: De,EN,JP
Re: More climates on the same height level
« Reply #20 on: June 23, 2020, 06:00:07 AM »
I think adding climate maps would be a more flexible option, which is now quite easy to do. Only the loading is missing, the rest of functionality is more or less there.

Even a latitude can have very different climates, from tundra to desert and the lot in between ... Also in Germany, the snowy mountains are in the south, despite being hotter there.

Simutrans always claimed to be about ecofreindliness (with those giant airports ... ) but trying to simulate real climate for a map creation is quite a challenge. Because most simutrans maps are not on earth, with the shape of the ladscape.

Offline Andyh

  • *
  • Posts: 81
Re: More climates on the same height level
« Reply #21 on: June 23, 2020, 04:17:21 PM »
I used to be a proponent of a mixed latitude and height-based climate system, but I now tend to agree with Prissi that climate maps would be a better approach for Simutrans.  Such a system has the potential to be flexible and intuitive, and leaves it up to the map creator as to how simple or complex he/she wants the climate picture to be.

In an effort to emulate a climate-mapping system, I recently built a crude "external" script that used the Simutrans climate painting feature to adjust the standard height-based climates.  It is better than nothing, but is very slow (can take 2 hours to paint a large map) and creates harsh non-organic boundaries between climate zones.  The ability to upload a climate-map would be far superior.

@Prissi - when you say the snowline is a global variable, are you referring to the winter snowline?  Does that mean it's not possible to have the winter snowline vary across the map.  I guess I had been hoping that one might be able to map the winter snowline too, so that snow would start at different heights in different parts of the map.   
« Last Edit: June 24, 2020, 05:17:10 PM by Isaac.Eiland-Hall »

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9992
  • Languages: De,EN,JP
Re: More climates on the same height level
« Reply #22 on: June 24, 2020, 06:21:03 AM »
The current snowline is calculated from the difference between winter snowline and the highest level of arctic climates (former summer snowline). Having a winter snowline at different parts of the map is not so quite straight forward. This will probably require a flag for the planquadrat (or even the map) to remember the current season. Because also autumn and spring depend on the snowline difference on high climates (i.e. which saw winter while everywhere else was spring).

Offline Andyh

  • *
  • Posts: 81
Re: More climates on the same height level
« Reply #23 on: June 24, 2020, 07:32:26 PM »
Got it.  Hadn't thought about that.  Essentially, whereas currently there is a single global interpolation between the winter and summer snowlines there would now need to be an interpolation for each tile.

So if climate-mapping is introduced, the encroachment/recession of snowlines would need to remain a global process?

Online Leartin

  • Heir-Benevolent-Dictator-Apparent
  • Devotee
  • *
  • Posts: 1445
  • PAK-DEV P192C
  • Languages: DE, EN
Re: More climates on the same height level
« Reply #24 on: June 24, 2020, 07:54:34 PM »
Snowline on a flat ground would cause multi-tile buildings to be partly snowy, partly unsnowy. But they are not designed/cut in a way to support it - you'd generally get straight vertical/horizontal borders between snowy and nonsnowy (you can easily try that out by manually using the arctic climate tool on a multitile building) Same probably for all other seasons if they were to change differently.

I think for that to happen, multi-tile buildings require to have the same season in all parts.