Besides dungeons and mazes, landscapes are the next big thing regarding procedural content. They're the de facto solution for open worlds. There are several algorithms for generating landscapes, and we will learn how to implement the Square-Diamond algorithm for generating landscapes. As a matter of fact, it is a popular algorithm for creating heightmap textures.
Generating landscapes
Getting ready
In this recipe, we will keep using a grid-based graph. However, this time we won't be using it for defining walls, but for terrain height. The interesting thing about this technique is that it can be applied seamlessly for both 2D and 3D worlds.