Sunday, December 31, 2017

Gridding the Sphere

While trying to dig up an awesome tectonics simulation I had found before (it was Tectonics.js, and it is even awesomer now than it had been when I saw it before, with a plausible ocean crust simulation that drives the tectonics), I came across Andy Gainey's planet generator, and he took a really cool approach to the problem of tiling a sphere in hexagons.

Basically, he found the bunch-of-hexagons-with-twelve-regularly-positioned-pentagons grid aesthetically offensive, and solved it by introducing a bunch more random irregularities, replacing a number of clusters of four hexagons with pairs of pentagons and heptagons. Basically, the twelve extra pentagons are still in there, but they disappear among all the other new irregularities, and it ends up looking really cool:

Anyway, a neat idea.

Thursday, June 8, 2017

The Humanity

I recently picked up my old planet simulation code, which a couple years ago I had modified to run on a mostly-hex grid. I think I just got busy at that time and stopped working on it, but also was frustrated because, after the hex change, it was running too slow to make the evolving world much fun to watch.

My initial thought recently was to port the simulation to C++ so it would be real fast and hence fun again, but I quickly realized that the main source of slowness was just rendering, so I fixed that enough to make it fun and now I'm still just hacking away in Python.

I added a human population simulation: once a world has life, there is a probability that humans will pop up on some savanna, and then they spread out from there, initially sticking to amenable climates along the coast and then becoming more dense and spreading out when they develop agriculture. All of this takes place on a much shorter timescale, so tectonic plates have stopped moving and glaciers are advancing and retreating.

Here is some early humanity (light yellow-gray in the lower-right) in the midst of a glacial period:


here is how they spread out to other continents as glaciers retreat:


and here is how the population explodes when agriculture pops up (the brighter yellow) as glaciation hits a minimum:


This is the new slow point (~10s per simulation step), which gets frustrating, but maybe that can be improved.

The code is now officially GPL.