Ye Trewe Historie of FLG
A long, long time ago (1998) in a land near here, I sat down and thought: "Why don't I write a fractal landscape generator?" I didn't have a clue as to how to go about doing such a thing, apart from the basic idea of recursive subdivision. I started off with a grid of equilateral triangles, and a rather inefficient algorithm for dividing them at the midpoints of their edges. After much hacking around, I managed to produce a fractal landscape that was an equilateral triangle of side 400 units. This pathetically small map took my (admittedly rather inefficient) program 2 hours to generate - and produced some rather uninteresting terrain. Due to the remarkably disheartening lack of success of this first try, I decided to abandon the whole idea. Below: one of my early tries.
It was perhaps about a year later that, for no good reason, I was thinking about fractal landscapes again, and I realised that if one were to generate a landscape on a uniform square grid, it would be vastly more efficient and also easier to code. I was really happy with myself, until I found out that just about no-one has EVER tried to generate a landscape any other way. Well, at least I had got my foot on the first rung of the right ladder this time. I sketched out a brief design and wrote the corresponding program in the space of about a day, and I found that it produced horrible landscapes. Below: a landscape generated by this program, with clouds added in Photoshop.
This brings us up to the Autumn of 1999. At this point in time I met a guy who was interested (like I was) in writing a real-time strategy game. We decided that a fully 3D game was the only way to go, and that landscapes for existing RTS games were very poor. This prompted the third re-write of the fractal landscape generator. This time it took 5 days (in the middle of term-time), but it supported many more advanced features, including cubic interpolation and gaussian random numbers. I also cobbled together a program to do top-down renders of the landscapes. Below: A landscape from this generator, drawn by the top-down renderer and wrapped around a planet (yet another dinky program did the raytrace of the planet).
I also did a real-time voxel engine during this period. Screenshots are shown below.
Unfortunately, the 3rd generation FLG was coded very quickly, and was largely experimental. The number of bugs in it was very significant indeed, and there was no interface - any change in parameters required tinkering with the code and recompiling. In the summer of 2000 I spent a week writing a fourth version of the generator, that humans could use (albeit with difficulty). I spent nearly the whole summer working on the game, and ended up with 80,000 lines of code, most of which worked. At that point, everyone else in the project decided to quit, so I spent 3 weeks pruning down some of the code written for the game into a 3D tank simulation (which was nearly finished when term started again, and I had to halt work on it).
By this time I had become interested in raytracing. I had already written a recursive raytracer that spring (see above), and I then turned my hand to writing one capable of handling terrain. Needless to say, after about 3 days it was interfering with work too much, and I had to stop again. Nevertheless, I was able to get a couple of pretty pictures out of it, using landscapes from the 4th generation FLG (See below)
I spent the rest of my 3rd year doing university work and other projects, principally a chess program and a tree generator. In the summer of 2001, I finally decided that I ought to acquire some skills that had real-world application. I therefore spent a while improving my C++, and then learning MFC (Microsoft Foundation Classes - used for windows programming). After working through a very thick book on MFC, I felt that unless I did something to apply my newfound knowledge, it would all dribble out of my nose.
I decided that a new, more powerful and user-friendly FLG would be a good idea. Over the previous six months, I had been writing down lots of ideas to do with landscapes. I came up with a number of improvements on all the previous versions. While I won't bore you with technicalities, I found a way to generate fold mountains (which is traditionally very hard to do), and also two ways to generate multi-fractal terrains. I also stole an idea or two from Terragen. This final landscape generator can do just about anything that it is possible to do - you can modify the crossover scale of a landscape (using another fractal map as the source), the fractal dimension, the interpolation method, the profile of the random numbers, the size and number of fractal tiles, as well as being able to use a variety of post-processing and combination options. Best yet, with all the most complex options turned on, it takes 10 seconds to generate a 1024x1024 landscape. Below: The FLG user interface.
A marathon 10 day session of coding left me with 11000 lines of interface code, providing a user friendly wrapper for a fractal class, itself 3500 lines long. Debugging took another week - writing the tutorials for the program and running through them myself enabled me to find all the bugs quite easily. Unlike all the versions before, this FLG is totally scalable, so that I will never need to write a new one, no matter what new ideas I come up with. Tatum!