News:

SimuTranslator
Make Simutrans speak your language.

NEW CLIMATES MODEL (was: The Equatorial Wind)

Started by Roads, December 14, 2008, 12:15:30 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

VS

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.

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

IgorEliezer

Little off-topic:

Quote from: Roads on January 11, 2009, 03:58:44 PM
Again, I want to say the maps look great, great, great! *cheer*

Someone here lives at SE part of that map. ;)

jamespetts

Quote from: VS 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.

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...
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

kierongreen

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

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...
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

VS

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

[attachment deleted by admin]

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

Fabio

Quote from: VS on January 12, 2009, 10:44:06 PM
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...

Roads

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

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

an additional multiplier would be
1.00 areas below the winter snowline
1.25 areas above the winter snowline

prissi

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

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 :D)

VS

Why keep things simple... and so on.

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

kierongreen

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

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

[attachment deleted by admin]

My projects... Tools for messing with Simutrans graphics. Graphic archive - templates and some other stuff for painters. Development logs for most recent information on what is going on. And of course pak128!

Roads

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

Quote from: Roads 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?

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

Roads

QuoteIt depends on the circumstance provided...

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

Fabio

updates:

Quote from: fabio on September 14, 2009, 03:22:36 PM
VS -- how are they going, the efforts to create a new climate system not based on height? :::)

Quote from: VS on September 15, 2009, 01:32:10 PM
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.

Quote from: fabio on September 15, 2009, 01:47:25 PM
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?

Quote from: whoami on September 16, 2009, 07:12:49 PM
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

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

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

prissi

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

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

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

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.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

prissi

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

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

One other thing that would have to be considered is the scale of the map.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

prissi

@Andyh:
Unfourtunately ideas are not lacking; programming time on the other hand is.

Spike

Quote from: Andyh on February 10, 2010, 11:07:37 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

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

.
Quote from: kierongreen on February 12, 2010, 05:21:12 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

THis is simple:

The climate is given by simworld::get_climate, found in simworld.h line 609 or so.

/**
* 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

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

Quote from: kierongreen on February 13, 2010, 08:48:31 AM
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.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

TurfIt

Mega bump... but the time is close.  ;D


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)