A little over two years ago, I first saw Amit Patel's article on Polygonal Map Generation, and thought it was incredibly cool. The use of Voronoi regions created a very nice, slightly irregular look, compared to grid-based terrains. At the time, I had just finished up working on my DX11 random terrain code, and it looked like a fun project to try to tackle.
I then proceeded to spend several months messing around with different implementations of Fortune's Algorithm in C# to get started and generate the Voronoi polygons used to generate a terrain along the lines of Amit's example. At this point, I've lost track of all of the different versions that I've sort of melded together to produce the code that I've ended up with in the end, but some of the more influential are:
- The original implementation of the algorithm by Steve Fortune
- This JS version by Nicolas Garcia Belmonte
- This C++ version, which is a port of the ActionScript version used in the original Amit Patel map generator.
Voronoi regions, with the edges drawn in white, and the sites as the blue points.
Delauney triangulation, with triangle edges in green.
Showing both the Voronoi regions and the Delauney triangles.
I won't pretend that this code is fantastic, but it's kind of interesting, and I worked at it for quite a while, so better to have it out here than moldering on a hard drive somewhere. If you'd like to see the source, it is available on GitHub. You can also download the executable below if you like - I make no promises that it will work everywhere, but it is a pretty standard .Net 4.5 Windows Forms application. I've also got some videos below the fold, if you'd like to see this in action.
Very cool and thank you for sharing the code with everyone.