Saturday, October 15, 2016

Getting continents into shape

I've got a reliable, effective algorithm for finding the nearest plate boundary.  Alas, it is slow as molasses.  It works, but about 70% of the time the program spends generating the world is spent on nothing but finding the nearest boundary for each cell on the map.  I'll have to revisit it later and develop a more optimal algorithm.

Still, it works.  That's enough to move forwards on getting the first real elevation onto the map.  In the the first try, it was simply supposed to slope from the plate boundaries to the center of the plate, with the high (white) part being near the plate boundaries and the lower (black) part being away from the boundaries.  It was definitely not supposed to result in land masses that resemble zebras.

My continents look like zebras!


A bit of of investigation and some trial and error led to a slightly different algorithm.  It was better, but not complete.  The continents are almost right for how the initial code was supposed to work, but all oceanic plate boundaries were turned into trenches, again with a (narrower) striping pattern.

Correct, but incomplete
That got fixed soon enough, but there was still something missing.  What was missing?  Tectonics! As I explained back on October 5, simulated collisions at the borders need to be calculated based upon pseudo-motion vectors.I was generating mountains at the edges of continental plates and trenches between oceanic plates, but I needed to take those collisions into account.

With collisions calculated at each border (boundary) cell

This turned out to be not as effective as desired.  The effects were utterly discontinuous, with gaps everywhere.  So I replaced precise calculates with a plate vs. plate decision upon what the effect would be via a couple calls to the pseudo-random number generator (PRNG) for each plate combination.  That proved much better, but was too uniform, and the "colliding" oceanic plates generated long islands that look like worms.


Worms!



To deal with the uniformity I added some Perlin noise.  You can see the impact of that below.

Plates with noise


Islands, not worms!
This left me with island chains rather than island chains rather than long, worm-like islands (mostly). However, the noise was a little too blurry when it came to the mountains, so switched from simple Perlin noise to fractal Brownian motion (fBm) with Perlin noise as basis.  I'm still experimenting with that.  I'll likely post more on that tomorrow.

Until then, good night.








No comments:

Post a Comment