• Welcome! The TrekBBS is the number one place to chat about Star Trek with like-minded fans.
    If you are not already a member then please register an account and join in the discussion!

Statistical analysis question

Are you familiar with Terragen?

It has two features for working with perlin noise, which is to Canyonise and Glaciate. These tend to create better looking topography.


Glaciate is basically a gamma correction map, that provides a simple approximation of the effect of glaciers on the geography.

X --> 255 * (X/255)^exp(pg/100), where pg is the percentage degree of glaciation. eg, pg=50


Canyonise is basically a form of contrast correction map, that creates some degree of plateauing.

If X<=127 then
... X --> 127 * (X/127)^exp(pc/100)
else
... X --> 127 * (2 - (2 - X/127)^exp(pc/100))
endif

where pc is the percentage degree of canyonisation, eg pc=20
 
Yeah, I've used Terragen a lot in the past. Great program. :) I'll consider applying glaciation/canyonization at some point. For now, I think I'll use what I have just so I can move forward. I'm making all this modular enough that I could just drop in a different terrain generation function later on.
 
For climate prediction, there are a few factors to consider:

temperature. This is affected not only by closeness to the equator, but also by elevation of the land.

Within the tropics we tend to get tropical climates, which are much less affected by the seasons. eg, tropical, subtropical, desert, and savannah.

Outside of the tropics, in the temperate latitudes, we tend to get continental climates (warm/cool continental), which are strongly seasonal climates.

Within the polar regions (arctic circle), some portion of the year is without sunlight, and it is here we see the polar climates with permafrost or ice (tundra, glacial).


Precipitation.
The second important factor is rainfall, which depends mostly on closeness to bodies of water, and the degree of evaporation from them (which in turn depends on temperature). It is reasonable to look at what % area of a region is water, and what temperature it is.

(A more advanced model would consider the coriollis force favoring to move that moist air in one direction over another ie, a tendency to bring lots of it over the land to fall as rain, or out to sea in which case it wouldn't contribute as much.)

Water has a high specific heat capacity, which makes it a good buffer against changing air temperatures. Land that is far from bodies of water tends to feel greater swings between warm/cold cross seasons and between day and night because it doesn't have this buffer. This tends to characterise warm/cool continental and the desert climates. The difference between warm/cool continental is the presence of sub zero temperatures for a significant portion of the winter season.

Land that is near to water, such as sheltered coastlines and small islands near to larger continents with continental climates, tend to feel the benefit most, which is where the rare temperate climates tend to form: eg, UK and Japan.


what % of regional area is forest?
An abundance of trees will be an effective buffer of both humidity and air temperatures, so help to keep a damp warm environment stay damp and warm. This tends to characterise tropical climates, but forests will affect the wetness and temperature of other places that they are present too. The effect on temperature is that forests help to soften day/night temperature changes.
 
For climate prediction, there are a few factors to consider:

temperature. This is affected not only by closeness to the equator, but also by elevation of the land.

Within the tropics we tend to get tropical climates, which are much less affected by the seasons. eg, tropical, subtropical, desert, and savannah.

Outside of the tropics, in the temperate latitudes, we tend to get continental climates (warm/cool continental), which are strongly seasonal climates.

Within the polar regions (arctic circle), some portion of the year is without sunlight, and it is here we see the polar climates with permafrost or ice (tundra, glacial).


Precipitation.
The second important factor is rainfall, which depends mostly on closeness to bodies of water, and the degree of evaporation from them (which in turn depends on temperature). It is reasonable to look at what % area of a region is water, and what temperature it is.

(A more advanced model would consider the coriollis force favoring to move that moist air in one direction over another ie, a tendency to bring lots of it over the land to fall as rain, or out to sea in which case it wouldn't contribute as much.)

Water has a high specific heat capacity, which makes it a good buffer against changing air temperatures. Land that is far from bodies of water tends to feel greater swings between warm/cold cross seasons and between day and night because it doesn't have this buffer. This tends to characterise warm/cool continental and the desert climates. The difference between warm/cool continental is the presence of sub zero temperatures for a significant portion of the winter season.

Land that is near to water, such as sheltered coastlines and small islands near to larger continents with continental climates, tend to feel the benefit most, which is where the rare temperate climates tend to form: eg, UK and Japan.


what % of regional area is forest?
An abundance of trees will be an effective buffer of both humidity and air temperatures, so help to keep a damp warm environment stay damp and warm. This tends to characterise tropical climates, but forests will affect the wetness and temperature of other places that they are present too. The effect on temperature is that forests help to soften day/night temperature changes.

My climate distribution model isn't that complicated. It's based mostly on latitude. The intersection of climate and terrain elevation will produce biomes. While I currently don't take proximity to water into account (at least for the climate part), it probably wouldn't be hard to do so. When choosing a climate for a given pixel, I look at adjacent pixels. There is a high probability I will choose one of those pixels as the climate for the current one. This allows variation in climate beyond latitudinal limits. Guess I could put some rules in place to choose specific climates when adjacent pixels are water.

I don't think I'll go crazy and put Coriolis effects into it!
 
I don't think I'll go crazy and put Coriolis effects into it!

It isn't complicated. It just affects where you take your sample region.

Within the tropics, the heat makes air rise, drawing low lying air towards the equator. The coriolis force pulls this westward.

In the polar zone, the air is falling, again pushing low lying air towards the equator. The coriolis force pulls this westward too.

In the temperate zone inbetween the two, there is an eddy current, where air circulates in the reverse direction, ie, low lying air is moved away from the equator, and the coriolis force pulls this eastward.

jetcrosssection.jpg
 
Last edited:
Part of the problem is that I don't want to have a big sample region--ever. The pixel lookup function in pygame is quite slow and if I have even a 10x10 box to look at, it's going to dramatically drag down the performance. So, for climate distribution, I look at the three pixels above my current one: (x-1,y-1), (x,y-1), (x+1,y-1). What I currently do is ignore water pixels for the purpose of choosing a climate, but I think I'll change it so that nearby water pixels result in specific climates.

Oh, and somebody mentioned plate tectonics. :lol: I'm not dealing with geological timescales here. The simulation will run for thousands of simulated years, not millions or billions. The intent behind all this generation stuff is to produce a world that looks like it's been around a while.
 
Part of the problem is that I don't want to have a big sample region--ever. The pixel lookup function in pygame is quite slow and if I have even a 10x10 box to look at, it's going to dramatically drag down the performance.

Can we not have the map data stored in an array, instead of a image?
 
Oh, and somebody mentioned plate tectonics. :lol: I'm not dealing with geological timescales here. The simulation will run for thousands of simulated years, not millions or billions. The intent behind all this generation stuff is to produce a world that looks like it's been around a while.

Sort of like the Civilization games then?

SimEarth from the early 90's had a rudimentary model of plate tectonics built into it, I think I recall. I recall running it a couple of times and getting a snowball earth at about the correct time (600Mya) -- once thawing out due to volcanic activity, and once staying frozen. Only once did robotic life take over the earth after all the humans departed in their space-going arcologies.
 
Part of the problem is that I don't want to have a big sample region--ever. The pixel lookup function in pygame is quite slow and if I have even a 10x10 box to look at, it's going to dramatically drag down the performance.

Can we not have the map data stored in an array, instead of a image?

I don't want to make myself suicidal by having to maintain both an image surface and an array representation of it. :lol: Maybe when I turn this whole thing into a class package and buffer the pixel updates, that would be a good idea. For now, I'm just trying to make it work even if it's not perfect.

Oh, and somebody mentioned plate tectonics. :lol: I'm not dealing with geological timescales here. The simulation will run for thousands of simulated years, not millions or billions. The intent behind all this generation stuff is to produce a world that looks like it's been around a while.

Sort of like the Civilization games then?

SimEarth from the early 90's had a rudimentary model of plate tectonics built into it, I think I recall. I recall running it a couple of times and getting a snowball earth at about the correct time (600Mya) -- once thawing out due to volcanic activity, and once staying frozen. Only once did robotic life take over the earth after all the humans departed in their space-going arcologies.

Yes, it's a good bit like Civ in that regard. Generate a world then populate and simulate it over a few thousand years. I've not dealt with "resource" tiles yet, though. After climate comes rivers and then biomes, and then flora and fauna. At some point I'll distribute metals and such since those will be utilized by the civilizations that emerge. Kind of a low priority at this point, though.
 
Sounds very ambitious. I learned recently that entensive trade routes had to develop in the Bronze Age because tin and copper deposits are never found in close proximity. I guess the Iron Age reduced that driver for trade, there was a bit of a collapse of civilisation, and more warlike states emerged.
 
Yeah, one of the things I'm going to have to simulate is the interaction of civilizations. Trade, war, diplomacy, all that good stuff. I agree that it's ambitious, but I'm trying to do it one piece at a time so I don't get too daunted.
 
You are Hari Seldon, and I claim my two-thousand quatloos.

Will you include individual or even mass psychology in the mix, or will your simulation take more of a Marxist or deterministic view based on economic forces?
 
Individual. I want to build a historical narrative, which means for each generation the system will create some number of people (probably more than 100, less than 1000). I'll give them all MBTI types and have rules for their interaction. Particular historical narratives will emerge using the 36 dramatic situations. I'll also determine what type of government each civilization has, at least at the broad strokes. So if it's a monarchy it will be necessary to track bloodlines for succession, and if a line is broken there will be a succession war. Stuff like that.

Each civilization will have values and taboos, and judge their own kind as well as other civilizations based on those.

At the end of a simulated run, I should have a list of historical events, who was involved, family trees, maps showing the rise and fall of civilizations, etc. It should be pretty cool.
 
I suspect you might need more than 100 actors per generation, but it does sound very interesting. If it was a commercial offering, and I could tweak the scripts, I'd be keen to purchase it. I'm a sucker for this simulation type of stuff.

I would say that broken lines of succession don't always precipitate a major civil war. For example, James VI/I replacing Elizabeth I and George I replacing Anne I, although the Gunpowder Plot and the Stuart rebellions were certainly minor to intermediate reactions. I guess it boils down to the economic power of the challengers and their allies. In addition, monarchies haven't always used primogeniture to determine succession -- for example, a council of the wise might choose the king.
 
I suspect you might need more than 100 actors per generation, but it does sound very interesting. If it was a commercial offering, and I could tweak the scripts, I'd be keen to purchase it. I'm a sucker for this simulation type of stuff.

I would say that broken lines of succession don't always precipitate a major civil war. For example, James VI/I replacing Elizabeth I and George I replacing Anne I, although the Gunpowder Plot and the Stuart rebellions were certainly minor to intermediate reactions. I guess it boils down to the economic power of the challengers and their allies. In addition, monarchies haven't always used primogeniture to determine succession -- for example, a council of the wise might choose the king.

There wouldn't always be a succession war. It would depend on the personality types of those involved. If the rightful heir is not combative or is a born peacemaker, they might just abdicate and let a more power-hungry relative take the throne. I have a lot of factors to weigh and I'm sure the resulting system will be quite complex.

The number of actors is flexible. I want to simulate the "important" people in a given civilization. So while I may only be simulating a few hundred, the actual population will be much larger.

I'm writing all this in Python and I intend to just put it out there. I currently have a Bazaar repository set up here: http://gorzek.com/sagasim/

I'll warn you that the current code is insanely sloppy and I'm just on the world generation part at the moment. But I'll keep that repository updated as I advance.
 
It'd be even greater if you could use the scripts to drive a Sims-type engine. You could have invented an entirely new form of dramatic art.
 
There's no reason the program couldn't be used that way. It will generate massive amounts of data and hopefully do so quickly enough to allow real-time simulation.
 
Update: I've got rivers "working," to some extent. You can see an example of a river map here. The associated terrain map (over which it would be placed) is here.

Climate generation was also improved somewhat. On to biomes now....
 
If you are not already a member then please register an account and join in the discussion!

Sign up / Register


Back
Top