Procedural generation of terrains and maps in a hand-drawn style, in Unity using Burst compiled jobs.

Map Generation: Introduction

I always loved procedural generation, and was really impressed by mewo2’s fantasy maps. I decided to give it a try using Unity and the Burst Compiler, an amazing piece of tech developed at Unity. It was also the opportunity to dig into SVG and implement a few algorithms and white papers: Delaunay’s triangulation, a depression filling algorithm, a cartographic labeling algorithm based on simulated annealing, water network computation and a few others. I’ll write a (probably long) series of articles detailing the interesting parts and algorithms of the project and my general process to approach this kind of topic.

[Read More]

Random 2D Points

We’ll start by generating the random points we’ll triangulate later and benchmark that, but first, we need a bit of boilerplate :

  • a Monobehaviour holding the generation parameters
  • a matching inspector to add a few debug facilities
  • a DrawGizmos function to visualize the generated points
[Read More]

Delaunay Triangulation and Triangle Storage

In the last part, we ended up with a collection of random 2D points. Now it’s time to triangulate them. After an overview of what a Delaunay triangulation is, we’ll describe the Bowyer-Watson algorithm and write a custom data structure to store the triangles, then we’ll generate a mesh from it.

[Read More]