### Author Topic: NEW CLIMATES MODEL (was: The Equatorial Wind)  (Read 28870 times)

0 Members and 1 Guest are viewing this topic.

#### VS

• Senior Plumber (Devotee)
• Devotee
• Posts: 4856
• Languages: CS,EN
##### Re: The Equatorial Wind
« Reply #35 on: January 12, 2009, 07:19:20 PM »
Oh... now that's an idea! For some reason I always thought that climates must be fixed with height, but obviously that is a very false assumption. It suddenly seems so easy - all it needs is that all height limits are decreased towards sides of map.

You know, this could really work... Except I still have to find how to get this into Simutrans Yay for coffee... and tea, chocolate, sugar and all the other goodies.

#### IgorEliezer

• Devotee
• Posts: 4091
• Cake recipes are cool... REALLY!
• Languages: PT, EN, AutoLISP, Python
##### Re: The Equatorial Wind
« Reply #36 on: January 12, 2009, 07:39:45 PM »
Little off-topic:

Again, I want to say the maps look great, great, great! *cheer*

Someone here lives at SE part of that map.

#### jamespetts

• Simutrans-Extended project coordinator
• Devotee
• Posts: 19689
• Cake baker
• Languages: EN
##### Re: The Equatorial Wind
« Reply #37 on: January 12, 2009, 08:16:07 PM »
Oh... now that's an idea! For some reason I always thought that climates must be fixed with height, but obviously that is a very false assumption. It suddenly seems so easy - all it needs is that all height limits are decreased towards sides of map.

You know, this could really work... Except I still have to find how to get this into Simutrans Yay for coffee... and tea, chocolate, sugar and all the other goodies.

Ahh, might I make one suggestion? Might it be best not to assume that the equator runs through the middle of the map every time, so that different overall climates could be simulated? All that that would require is an equator offset value, with 0 being the middle of the map, negative numbers being further South, and positive numbers being further North. Furthermore, there could be another "range" value, which would vary with the scale of the map: for example, with the "range" at the highest setting and offset at 0, the middle of the map would be equatorial, and the top and bottom polar, whereas with the offset at 0 and the range setting very low, the whole map would be more or less equatorial. This should enable a wide range of map scales and overall climates to be simulated, hopefully with fairly minimal additional coding effort. After all, not everyone will want a Simutrans map the size of the whole world...

#### kierongreen

• Dev Team, Coder/patcher
• Devotee
• Posts: 2276
##### Re: The Equatorial Wind
« Reply #38 on: January 12, 2009, 08:57:37 PM »
Climates changing independently of height is a little tricky in terms of graphics... Means you need n^4 * 15 graphics tiles to be calculated - that could work out to be 20k tiles or so with 5 climates and snow...

#### jamespetts

• Simutrans-Extended project coordinator
• Devotee
• Posts: 19689
• Cake baker
• Languages: EN
##### Re: The Equatorial Wind
« Reply #39 on: January 12, 2009, 09:12:27 PM »
Kieron - not necessarily, since many of the tile types could be used at different heights, depending on the climate. It would be a bit silly if all low-lying land was desert, even if one is supposed to be simulating, for example, Polish transport...

#### VS

• Senior Plumber (Devotee)
• Devotee
• Posts: 4856
• Languages: CS,EN
##### Re: The Equatorial Wind
« Reply #40 on: January 12, 2009, 10:44:06 PM »
Uff - one by one.

First, there isn't any C++ code yet. I haven't even started to think about it (I definitively want though).

Second, about the equator and "moving" height levels. It could simply work by having three sliders for something like climate height offset. Attached is a sample of the ui part. If that is not enough, a fourth scrollbar in the bottom could move the middle one...

Third, number of transitions. That could be a bad problem... It would be probably better to render transitions on the fly from more images, as multiple layers. Then you need the base tile of climate in 11 versions for all slopes. Transitions are two, since you're going to want transitions only in "one" direction (two orthogonal), not bilateral. Multiply transitions by 3 for all kinds of slopes (no irregular slopes, phew...). So that gives 11+2*3=17 tiles per climate.

Given there are 12 cells but only ten climates (irregularity - good? bad?) and one can be identified with snow, which is special, you need 9 regular climates. 9*17=153.

Next comes water, which is special; only bottom-up transitions, but from all sides. That makes (11-1)*climates=10*9=90; 90+153=243. Water with depths is aside as it can not go upwards or downwards - err, some 7 images? 243+7=250. Still not thousands

Finally snow. Can be next to anything, generally, but the good message is that it can't go from below. This saves one transition. No. of transitions is therefore only 5; 5*9=45; 250+45=295. Still good... maybe.

The one thing I can see is that corners could become uglier. That could require special transitions for them then.

Sorry if the numbers make no sense to you - just draw the situation and see for yourself.

I'll think more about this tomorrow, and try to come up with some estimation as it looks when transitions between height levels

#### Fabio

• Devotee
• Posts: 2898
• The Pak128 Guy
• Languages: EN, IT, RO, FR
##### Re: The Equatorial Wind
« Reply #41 on: January 13, 2009, 09:09:15 AM »
Second, about the equator and "moving" height levels. It could simply work by having three sliders for something like climate height offset. Attached is a sample of the ui part. If that is not enough, a fourth scrollbar in the bottom could move the middle one...

This is a great idea and, besides, much more intuitive than the present system.

Am i asking too much to see a preview of climates in the minimap in create new world? maybe there could be two minimaps: one for heights and one for climate...

• Devotees (Inactive)
• Posts: 645
##### Re: The Equatorial Wind
« Reply #42 on: January 13, 2009, 03:25:37 PM »
This seems to be really coming together now.  I am absolutely delighted that you saw a way of incorporating colder temps as you move farther from the equator.  The idea that the equator can be moved on the map is great too.  It looks like we will have the ability to create a wide range of maps - from those that have every terrain type to really warm and really cold ones.

I guess it remains to be seen how robust the possibilities that this offers is included into the game but it certainly allows including more than a complex transportation system.  It adds the ability to challenge the player to find ways of transporting far-away crops and getting foodstuffs out of difficult and rugged terrain.

#### Fabio

• Devotee
• Posts: 2898
• The Pak128 Guy
• Languages: EN, IT, RO, FR
##### Re: The Equatorial Wind
« Reply #43 on: January 13, 2009, 03:43:28 PM »
An easy way to affect gameplay, would be a multiplier/divider for construction and maintainance according to the climate.

e.g.
0.75 for mediterranean and temperate
1.25 for jungle
1.50 for desert and tundra
1.75 for rocky
2.00 for arctic

1.00 areas below the winter snowline
1.25 areas above the winter snowline

#### prissi

• Developer
• Posts: 9909
• Languages: De,EN,JP
##### Re: The Equatorial Wind
« Reply #44 on: January 13, 2009, 03:44:31 PM »
THere is some rework needed before different climates on the same heightlevel are supported within the game. ALso you would need to beldn between the same climate horizontally, which is also not in yet.

You can forget about multipliers. Each tile must have a single climate, because the search function need to be fast. Doing bitwise and is fast, and real numbers is really slow.

#### Fabio

• Devotee
• Posts: 2898
• The Pak128 Guy
• Languages: EN, IT, RO, FR
##### Re: The Equatorial Wind
« Reply #45 on: January 13, 2009, 04:08:40 PM »
the multipliers would just affect waybuilder and maintainance (which is monthly, IIRC).

and they could be int as well (maintainance: 1x on temperate and mediterranean, 2x on jungle and tundra, 3x on desert or rocky, 6x on arctic... this would even be more realistic than 1.5 )

#### VS

• Senior Plumber (Devotee)
• Devotee
• Posts: 4856
• Languages: CS,EN
##### Re: The Equatorial Wind
« Reply #46 on: January 13, 2009, 04:31:30 PM »
Why keep things simple... and so on.

#### kierongreen

• Dev Team, Coder/patcher
• Devotee
• Posts: 2276
##### Re: The Equatorial Wind
« Reply #47 on: January 13, 2009, 06:49:23 PM »
As prissi says - without rework different climates at the same height is not possible.

As for number of image tiles:
If climates can be at any elevation then for each tile any of the corners can be any climate.
This means that there are 7 x 7 x 7 x 7 (=2401) possible climate combinations for a given tile, and 15 tiles (with slopes). That alone gives 30000 possible tiles without snow. Now restricting it so that climates have to always be in sequence reduces this a bit, but you are still talking about considerably more tiles than are calculated at present (currently at most 7 x 15 x 2 x 2 = 420 tiles give or take) - since transitions between climates could be on any slope.
Of course you could go for just rendering the tiles as you go along, but this would be much slower than the current system.

#### VS

• Senior Plumber (Devotee)
• Devotee
• Posts: 4856
• Languages: CS,EN
##### Re: The Equatorial Wind
« Reply #48 on: January 13, 2009, 08:02:35 PM »
I think I know that it is not possible without rework

Now I see where you got that "15". That's as it is now, but evidently transitions do not to have be in the middle of tile. What I want to do is make every tile have its "base" climate and make the other climates "poke" slightly into it - but not much.

Rendering tiles as they are encountered was that you first draw base, then the overlapping parts as needed (picture worth far less than thousand words):

• Devotees (Inactive)
• Posts: 645
##### Re: The Equatorial Wind
« Reply #49 on: January 14, 2009, 01:10:59 AM »
For the simplest of reasons, I like fabio's idea of terrain based maintenance because it adds another level of decision making into the game.  Would it be better to go for the added expense and distance of building a road around a desert or directly across it?

Also if, and at some point, a way and/or the approval of adding resources into the game is conceived, it could provide a difficulty for obtaining that resource, e.g. salt is found in the desert isn't it?  Oh and please, please, please could we just think about a camel caravan to get that salt out of the desert?  I think in some places they still do that...but I, uh, probably just dropped off the deep end with that one...

#### emaxectranspoorte

• Posts: 241
• GOD BLESS AUSTRALIA
##### Re: The Equatorial Wind
« Reply #50 on: January 14, 2009, 07:30:30 AM »
For the simplest of reasons, I like fabio's idea of terrain based maintenance because it adds another level of decision making into the game.  Would it be better to go for the added expense and distance of building a road around a desert or directly across it?

It depends on the circumstance provided... (in real life, IMHO).

• Devotees (Inactive)
• Posts: 645
##### Re: The Equatorial Wind
« Reply #51 on: January 14, 2009, 04:17:07 PM »
Quote
It depends on the circumstance provided...

emax, I meant this merely as a rhetorical question but you have further illustrated the decision requirement.

#### Fabio

• Devotee
• Posts: 2898
• The Pak128 Guy
• Languages: EN, IT, RO, FR
##### Re: NEW CLIMATES MODEL (was: The Equatorial Wind)
« Reply #52 on: September 17, 2009, 10:43:01 AM »

VS -- how are they going, the efforts to create a new climate system not based on height?

Not going at all. I have a finished, deterministic recipe for one part of that, the humidity, which is (imho) the hardest part wrt. planning and testing. Making this into actual Simutrans code would require some serious number crunching with Fourier transform... I am not really sure how hard that would be. In the concept demo I used plain convolution which is of course easier to do... but infinitely slower.

Even once that is in place... I can't remember outright, but the other parts were also temperature, a GUI to control these parameters, and finally combining these two into new climates, which requires changes to drawing terrain.

well, that's a pity there is no progress, i was really *looking forward* to this feature. it' would be awesome!
is there any chance to simplify the model, at the cost of losing some precision?

When I read the thread regarding this, I already wanted to ask whether (or why) you (plural) want to make ST a climate simulator.
It might be easier to first prepare the actual new implementation of climates, and later introduce additional methods of simulating their natural distribution on the map.

#### Andyh

• Posts: 74
##### Re: NEW CLIMATES MODEL (was: The Equatorial Wind)
« Reply #53 on: February 09, 2010, 05:21:40 AM »
I know that this is old topic, but i wondered whether there had been any developments?  Of all the items on the perennial Simutrans wish list this (i.e. making climates dependent on factors other than just height) is closest to my heart.

I'm impressed by some of the complex and sophisticated ideas presented in this thread, but I've had an idea buzzing around my head for some time which is a lot simpler and cruder (and therefore, I think, easier to implement).

It's based on the old geographers' concept of a relationship between elevation and latitude.  In other words if the elevation increases at a given latitude the climate changes in much the same way as it does as you travel towards the poles. The relationship between elevation and climate is already represented in the game.  The relationship between latitude and climate could be represented by creating a function which would make more northerly tiles (in the northern hemisphere) behave as if they were at higher elevations for the purpose of defining their climate.

Latitude is represented in the game by the y coordinate of a tile.  I would propose a single new variable (call it 'climate_modifier' for example) which would represent the impact of latitude on climate, ON TOP OF any impact of height on climate.  climate_modifier would be calculated for each tile as something like:

climate_modifier = int(y/k)

(actually this probably needs to be modified slightly for Northern hemisphere maps because the Simutrans origin is top-left rather than bottom-left)

where k is a user defined constant that could be defined either in the simuconf.tab file or in the new map climate dialog.  A large value for k would lead to small climate variability due to latitude and a small value of k would lead to a relatively large number of climates across the map from North to South.  For example, take a largish map with a North-South dimension of 1000 tiles, a value for k of 1000 would lead to no climate variability due to latitude (but there could still be climate variability due to height), whereas a value for k of 100 would mean the climate variability due to latitude would be the equivalent of about 10 tile heights.  If each climate zone is defined as being 2-3 heights apart then there would be around 3-5 climate zones across the map from North to South even if the map were completely flat.

The climate_modifier variable would simply be added to the height of a tile for the purpose of defining its climate.  Therefore a tile at the very bottom of a map (assuming Northern hemisphere) would (typically) have a climate_modifier of zero and its climate would only be defined by its height.  As one moves up the map towards the top the climate_modifer would get larger (at a rate defined by k) and the tiles will tend to move into relatively colder climate zones, in addition to any effect that height might have.  For example, a tile at the bottom of the map with a height of 2 might have a tropical climate, whilst a tile at the top of the map with the same height and a climate_modifier value of (say) 9 might have a tundra or alpine climate, and a mountain in the middle of the map with a height of 6 and a climate_modifier of 5 would have the same tundra or alpine climate on the top.

I think the advantage of this approach is ease of computation and, most importantly, it doesn't change the sequence of climates, so i don't believe there would be any need to change the tileset.

Hope this makes sense, would be very interested in anyone's comments/questions.

I would love to try and create a little mod to do this.  Could any of you programmers out there give me some guidance/hints as to how I might get started on doing this?

#### Ashley

• Coder/Patcher
• Devotee
• Posts: 1288
##### Re: NEW CLIMATES MODEL (was: The Equatorial Wind)
« Reply #54 on: February 09, 2010, 10:10:00 PM »
http://simblob.blogspot.com/2010/01/simple-map-generation.html

This blog article is relevant to this discussion

It's something I'm working on for my own game project, using wind/rainfall to model terrain is a very simple and effective idea. You can also take it a step further, and use that rainfall to produce rivers...

On the subject of the many many tiles problem, why not just dynamically generate them and cache the results? In reality there will only be a small subset of the tiles "in play" at any one time. With the amount of RAM available nowadays this is potentially a perfectly good solution... I've got code which demonstrates rendering a tile from scratch, and I'm working on dynamic caching of the results, it's very possible (even with two-steepness terrain, enhanced tileset and multiple terrain type graphics...)

#### prissi

• Developer
• Posts: 9909
• Languages: De,EN,JP
##### Re: NEW CLIMATES MODEL (was: The Equatorial Wind)
« Reply #55 on: February 10, 2010, 10:35:43 AM »
Simutrans currently only uses 65534 different images. Extending that is possible; another solution would be a different image class only for landscape.

For most computers this may not be an issue; but if simutrans should run on small devices, then the tiles might become an issue.

#### kierongreen

• Dev Team, Coder/patcher
• Devotee
• Posts: 2276
##### Re: NEW CLIMATES MODEL (was: The Equatorial Wind)
« Reply #56 on: February 10, 2010, 07:01:55 PM »
When I originally coded the texture tile system initially tiles were generated on the fly, however speed was not quick enough to use in game (it managed about 2 frames a second). That might have changed admittedly, however it would still be a major performance hit, and I'd imagine other things would have a priority in terms of cpu time than changing something which basically works fine...

#### Andyh

• Posts: 74
##### Re: NEW CLIMATES MODEL (was: The Equatorial Wind)
« Reply #57 on: February 10, 2010, 07:19:24 PM »
My original post was focused specifically on the climate model as opposed to the way tiles are rendered in a broader sense.  I think the current rendering method does work fine; you can move around large maps with ease.  The current climate model also works fine on its own terms; but if one is trying to create maps on a continental scale the ability to vary climate according to latitude (as well as height) would be a huge plus.

I would be interested in what people think to my idea above of having climate affected by a simple relationship between latitude (as represented by the y coordinate of a tile) and the climate type.  In essence I'm saying: make the climate of a tile dependent on its y and z coordinates as opposed to just the z coordinate as at present.  I think I'm right in saying that doing this would not require any expansion in the current tile set.

#### jamespetts

• Simutrans-Extended project coordinator
• Devotee
• Posts: 19689
• Cake baker
• Languages: EN
##### Re: NEW CLIMATES MODEL (was: The Equatorial Wind)
« Reply #58 on: February 10, 2010, 08:11:49 PM »
There is some merit in what Andyh is saying - this idea was actually discussed further back in the thread, with the idea of an "equator offset". Unless I am missing something, it would be a simple and effective way to add considerably more realism to the game.

#### prissi

• Developer
• Posts: 9909
• Languages: De,EN,JP
##### Re: NEW CLIMATES MODEL (was: The Equatorial Wind)
« Reply #59 on: February 10, 2010, 08:58:51 PM »
Also the link above shows a very interesting system to generate climates; one that would be easily applicable to simutrans and might generate much nicer maps than now.

#### Andyh

• Posts: 74
##### Re: NEW CLIMATES MODEL (was: The Equatorial Wind)
« Reply #60 on: February 10, 2010, 11:07:37 PM »
The climate generation system shown in the link is based on the concept of moisture being blown across a relief map creating areas of relief rainfall (damp climates), and rain shadow (drier climates).  It does not take latitude into account.  This method would be very good for generating climates on a small-medium sized map; say one where the North-South dimension being modelled is no more than a few hundred kilometers.  However, by itself, it would be less good on the continental scale where climate variation is more heavily influenced by latitude.  To illustrate: differences in climate within Washington State can easily be explained by looking at moisture, wind patterns and topography (i.e. where the mountains are), but the difference in climate between Alberta and Louisiana has more to do with the fact that Alberta is a lot closer to the North Pole.

Ideally, of course we would include all these factors (i.e. latitude, elevation and wind/moisture) in a Simutrans climate model.  I'm very new to the forum, although I've been playing Simutrans for years; how can I get involved so as to move this initiative forward?  I have little to no programming skills, but I think that I could come up with some mathematical models, and perhaps provide some insights on the geographical side of things.

#### jamespetts

• Simutrans-Extended project coordinator
• Devotee
• Posts: 19689
• Cake baker
• Languages: EN
##### Re: NEW CLIMATES MODEL (was: The Equatorial Wind)
« Reply #61 on: February 10, 2010, 11:16:14 PM »
One other thing that would have to be considered is the scale of the map.

#### prissi

• Developer
• Posts: 9909
• Languages: De,EN,JP
##### Re: NEW CLIMATES MODEL (was: The Equatorial Wind)
« Reply #62 on: February 11, 2010, 09:21:28 AM »
@Andyh:
Unfourtunately ideas are not lacking; programming time on the other hand is.

#### Spike

• Posts: 1361
• First Simutrans Developer and Graphics Artist
##### Re: NEW CLIMATES MODEL (was: The Equatorial Wind)
« Reply #63 on: February 11, 2010, 01:18:50 PM »
Ideally, of course we would include all these factors (i.e. latitude, elevation and wind/moisture) in a Simutrans climate model.  I'm very new to the forum, although I've been playing Simutrans for years; how can I get involved so as to move this initiative forward?  I have little to no programming skills, but I think that I could come up with some mathematical models, and perhaps provide some insights on the geographical side of things.

Then you need to find someone who shares your interest in these ideas and who can program them for you. Currently there are about three people actively coding for Simutrans, and they are all busy with other tasks, i think.

As Prissi said, ideas are plenty around Simutrans, but there are only few people who (can) do the work.

#### kierongreen

• Dev Team, Coder/patcher
• Devotee
• Posts: 2276
##### Re: NEW CLIMATES MODEL (was: The Equatorial Wind)
« Reply #64 on: February 12, 2010, 05:21:12 PM »
Any changes to the current model would require more tiles. The computer generated maps in the link do look nice. However I think technically it will be too tricky to implement. If you are going that far you might as well put a simple weather system in so that areas would get snow on and off through the winter, maybe have images for it raining and snowing, variable amounts of snow on the ground. It would all be great eye candy but really not much more than that.

#### Andyh

• Posts: 74
##### Re: NEW CLIMATES MODEL (was: The Equatorial Wind)
« Reply #65 on: February 12, 2010, 06:25:24 PM »
.
Any changes to the current model would require more tiles.

I don't think that this is necessarily the case.  As explained in my original post, unless I'm missing something I don't believe that a simple latitude-based climate modification of the type I describe WOULD require more tiles (because it uses the same climates and the same climate sequence as at present).

Here's what I would suggest: I've downloaded the Simutrans source code.  Would someone mind giving me a few general hints as to how to go about building a little mod?  Specifically: which files/lines contain the code which defines the climate associated with a tile?  I'll then noodle around a bit myself and see whether I can come up with something.

Thanks a lot for everyone's help and advice

#### prissi

• Developer
• Posts: 9909
• Languages: De,EN,JP
##### Re: NEW CLIMATES MODEL (was: The Equatorial Wind)
« Reply #66 on: February 12, 2010, 08:30:49 PM »
THis is simple:

The climate is given by simworld::get_climate, found in simworld.h line 609 or so.
Code: [Select]
` /** * returns the current climate for a given height * uses as private lookup table for speed * @author prissi */ climate get_climate(sint16 height) const { const sint16 h=(height-grundwasser)/Z_TILE_STEP; if(h<0) { return water_climate; } else if(h>=32) { return arctic_climate; } return (climate)height_to_climate[h]; }`
Unfourtunately for non-height dependent climate, you need to change all calls to this function (And probably  make climate instead a property of the ground).

#### kierongreen

• Dev Team, Coder/patcher
• Devotee
• Posts: 2276
##### Re: NEW CLIMATES MODEL (was: The Equatorial Wind)
« Reply #67 on: February 13, 2010, 08:48:31 AM »
Even a latitude based offset to climate would require more tiles. Admittedly not as many as some other systems but still 4 * 7 * 2 potentially taking into account all the climate transitions and snow. Another problem is that the new map configuration window would become more confusing as you would have to set several latitude options.

#### jamespetts

• Simutrans-Extended project coordinator
• Devotee
• Posts: 19689
• Cake baker
• Languages: EN
##### Re: NEW CLIMATES MODEL (was: The Equatorial Wind)
« Reply #68 on: February 13, 2010, 01:03:58 PM »
Another problem is that the new map configuration window would become more confusing as you would have to set several latitude options.

If the UI is made clear, it would not add much in the way of confusion. Additional options in the "climates" window would be a price very much worth paying for this improvement.

#### TurfIt

• Dev Team, Coder/patcher
• Devotee
• Posts: 1341
##### Re: NEW CLIMATES MODEL (was: The Equatorial Wind)
« Reply #69 on: June 13, 2013, 11:06:28 PM »
Mega bump... but the time is close.

Was there any progress beyond rain4.m?

(and note: there's still a long long way to go before such maps are fully usable in Simutrans)