Terrain Generation Tutorial: Introduction
While working on a project recently, I found myself needing a nice hilly island terrain to use as a playing field. It needed to be fairly smooth, but with some tall interesting hills and fairly broad valleys. I looked up some algorithms, but most of what I found looked too sharp and craggy. Playing around with variations of another method, I came up with the algorithm I explain below. I think it produces some very nice terrain with smooth slopes and interesting features, as well as being very easy to modify to automatically generate islands. It also has the nice feature of using no square roots or trig functions, so it is fairly fast.
This tutorial explains how generate terrains using heightmaps and the hills algorithm I came up with to create these heightmaps. It does not explain how to draw a terrain in 3d; there are other far better tutorials out there for that. At the end of the tutorial, I have included a complete C++ class that will generate terrains of any given size using this algorithm. Feel free to use it, modify it, or whatever, but if you do use the algorithm, please let me know.
To get started, click here. If you want to skip to a specific section, they are:
Copyright © 1999-2002 Bob Nystrom.