Procedurally generate pirate treasure maps.
Procedurally generated pirate treasure maps. X marks the spot!
I used several excellent third party libraries...
cairofor rendering
colourfor color interpolation
noisefor simplex noise
Pillowfor saving debug images of noise layers
pyhullfor delaunay triangulation
Shapelyfor all kinds of 2D geometry operations
The script will generate several random maps and save them as PNG files.
git clone https://github.com/fogleman/PirateMap.git cd PirateMap pip install -r requirements.txt python main.py
It took me a while to decide on an approach for generating the land masses. I didn't want to just generate some simplex noise, threshold it and render it. I wanted to actually compute a polygonal shape that I could do further operations on. So here's how that works...
Shapely's
bufferfunction is used heavily for padding or cleaning up shapes.
I also wrote an
xkcdifyfunction to add some perturbations to some of the polygons, namely the different water color gradations.