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.