Generating 3D height maps
Sometimes it makes sense to stop trying to handcraft each and every portion of a game and get a computer onto the job. For some games, such as SimCity, it can be a core gameplay mechanic, and for others, such as a number of the modern open world RPGs, it's a handy way to fill out those bits of the world that lie between more action-packed parts of the story.
In this recipe, we'll be exploring the basis for a lot of these world generation schemes with an approach to landscape generation that borrows heavily from the same family of algorithms used to produce plasma textures. This can be extended to any occasion where a map of random but natural looking values are needed.
Getting ready
This example is focused purely on the generation of height map data, and as such does not cover any display-related code. It is also written with the HeightMap
class described in the Importing and displaying 3D isometric maps recipe of this chapter, but should work equally well with any...