Thursday, December 27, 2012

Monday, August 20, 2012

Mountain? Climate!

I had put together a crappy climate model before I had really read anything about meteorology: basically, vary insolation based on season, have prevailing winds pick up moisture from the sea and rain it down according to elevation, and then use the results to classify the climate.

So no meandering jet streams or mid-latitude cyclones or anything, but I've had enough trouble even figuring out where to start on a more legitimate climate and weather simulation that I decided to just bring the old broken one into the tectonics simulation as a placeholder.

Here's my fake climate simulation at work:
World map with Koeppen categorizations that are all wrong.
Note the great Saudi Arabian jungle, the desert in the Southeast US (but not the Southwest), the frozen British Isles, &c.

So despite the brokenness, I wanted to get some sort of climate system in so it could contribute to the erosion algorithm, modulating the erosion amount from each tile by its annual precipitation and "polar" status (on the theory that glaciers cause a lot of erosion regardless of precipitation).

Compare erosion under the old algorithm (reddishness represents height lost to erosion, greenishness height gained by deposited eroded sediment):
World map showing erosion rates based solely on relative elevation;
versus the new erosion modulated by precipitation:
World map showing erosion rates based on relative elevation and climate.

I had to tweak a magic number that had been picked to keep mountain building and erosion somewhat in balance. But after that, a newly created world came out looking pretty good:
A generated world map;
and its "climate":
Crappy climate map of the previous generated world.

In any case, it doesn't really change the current simulation very much, but it does lay the groundwork for some more interesting recording of geological history. Source.

Friday, August 3, 2012

Fixing a Hole

My previous "plates on a sphere" simulation tended make continents that were too round. This was because of how I tried to resolve an issue stemming from my whole approach to the spherical geometry.

The sphere is divided into "tiles" of approximately equal size, each with a fixed location (a vector on the unit sphere). So at any point in time, a continent is defined as a set of those tiles.

When a continent moves, the vectors of all of its tiles are moved (that is, rotated around an axis) by a given amount; then the closest tile to each of those resulting vectors gets the value of its source tile.

Because of how the tiles are distributed (near the equator, almost a grid; at the poles, not anything like a grid), there is never a neat 1-to-1 mapping of source to destination tiles (unless the continent is centered on the equator, moving due West or East).

Which means there are lots of instances of more than one source tile mapping to the same destination tile, and tiles that are visibly part of the continent in its final position but that weren't mapped to by any source tile, and thus appear as holes.

My previous solution to this problem had been, at each step, to map each source tile to the nearest two destination tiles; to prevent the continent from growing out of control, I then trimmed off a bunch of tiles, starting with those most distant from the middle of the continent. This caused the progressive roundening, which sort of makes intuitive sense (sharp edges ground down over time) but doesn't look very realistic (Earth has lots of pointy continents).

My new strategy is to identify potential holes (tiles adjacent to those identified as belonging to the continent in its new position but that aren't themselves part of the continent's set of tiles), and rotate their positions backwards to see if the nearest tile to that location was part of the old set. If so, then add it to the new set, then check the tiles adjacent to that one, and so forth.

The resulting continents are much more satisfyingly pointy:


Tuesday, June 19, 2012

Thursday, May 24, 2012

Tectonic Youth

I've been working on a somewhat reasonable-looking plate tectonics simulation.

Looking for something along these lines, I had found an open-sourced VB app called World Builder, which uses David Allen's cdrift (around halfway down) algorithms for simulating something like continental drift on a toroidal topology; I believe that was influenced by Mark Isaak's plates.c (same as last link) program.

From my very rudimentary understanding of geology, it seems like the major disparity between how these simulations played out and what an Earthlike planet should look is purely geometrical: continents that split up and move around a torus are going to run into each other in different ways than on a sphere, and continents tend to break up along 120-degree angles.

So I basically implemented cdrift's general approach (build up continents' leading edges, erode to neighboring tiles, and split and merge plates at random), but on a sphere broken up into approximately evenly-sized tiles (latitudes spaced evenly, and as many squarish tiles as fit in each latitude). The results aren't terrible (same simulation state in three different projections):

 

It's slow as hell (maybe ~2s a step on my computer), because math is hard, though there are surely opportunities for optimization.