This began as an exercise in generative art. With the goal of having a randomly generated, pseudo-accurate island rendered, I combined a variety of techniques to achieve the result. Every run generates a completely unique island.
The app itself was written in Coffeescript and rendered using the HTLM5 canvas element.
Drawing an Island
- Generate a Voronoi grid, and derive a node graph of cell centers, edges, verticies. Assign each cell an array of it’s neighbours.
- Use a modified, center-weighted Perlin noise generator to determine elevations, and normalize around a midway point which creates land and sea division.
- Run a recursive function to determine the downslopes (each vertex has a neighbour which is lower in elevation, which eventually leads to the coast).
- Randomly seed n rivers in the highlands, and trace their path to the coast. Allow pooling in flat areas, with a drain at the lowest point.
- Using coastal and river-generated moisture, alongside elevation, assign biomes to the cells. I used 16 unique biomes.
- Render the cells in 2.5D, using colors to differentiate biomes, draw rivers (width = flow), and draw vegetation sprites for some biomes.