#### 2

Man I love playing around with landscape generators, it’s the most therapeutic thing ever. I recommend it. It’s the weekend tomorrow, what are you waiting for?

Anyway, in a break from whinging about games and the games industry I thought I’d write a few words about some daft experiments I was doing with landscapes… uhhh… (checks date modified on these files)… blimey, was it 2 years ago? Yeah, apparently mid 2014(ish). I had intended to write this blog post then, but it seems I never got around to it 😉

Here’s an example of one of the landscapes wot I generated:

A couple of things to note: Firstly, it tiles in both directions which is handy. Secondly, it’s not very Perlin Noise-y. That’s because I didn’t use any kind of noise function to generate it – well, I sort of did (I’ll get to that), but not in the conventional way.

Perlin Noise (or more accurately nowadays, Simplex Noise) is probably the world’s handiest algorithm ever for generating textures. We’ve all seen it, we all know what it is, so there’s no reason to go into it beyond this extremely crude example:

Read more here

Yeah? It’s basically that except not using regular sine-waves, but instead adding together interpolated random noise – for every iteration the frequency of the noise goes up and the amount it contributes goes down. When using Perlin Noise to generate your noise values, the result of cumulative additions (each time doubling the frequency and halving the intensity) is that classic *turbulence* look which is so synonymous with Perlin Noise that we often call the texture *itself* Perlin Noise:

(Okay, this is Photoshop’s Cloud Filter. But it’s basically the same and, for all I know, might actually be coded using Perlin Noise)

Anyway, I bring this up not because of any of this specifically, but because the principle it operates on (add together lots of things to build up interesting structured noise) is the principle my landscape generators work on. This principle can generate you really interesting landscapes irrespective of what it is you’re using to add together to produce your final result. So your source could be an unstructured random mess but the act of adding lots of it together – each time the input contributing less than the previous iteration – can produce ordered structure.

So for my landscape, what was my input? Well, I just repeatedly added sine-wave strips (where each strip’s orientation – either horizontal or vertical – and its position, thickness, amplitude, and frequency were random). So the first iteration would look like this, for example:

And iteration two, could look like this:

Keep going, then render it with landscapey colours and you end up with something like my landscape above. It’s dead simple and you can use absolutely anything for your iterative additions – sine-wave strips, filled circles, filled squares, various pictures of cows – anything. Because *anything* added together sufficiently, will eventually produce something which looks like structured noise – which makes playing with your inputs kind of fun 🙂

So – now knowing that my landscape is just lots and lots of sine-strips, looking at it again it’s really really *really* flupping obvious:

Here’s a landscape where I used filled circles (with random positions, radii, and strength – where the strength also diminishes with each iteration), where the circles were filled like a crater such that in cross-section they’d look sorta like this:

Notice the crater in the central island 🙂

So anyway. It’s not rocket science, nor the world’s most amazing way to generate super-realistic landscapes. But it’s fun, so I thought I’d share 🙂

**edit**: This is what I love most about playing with this sort of stuff. *How* something actually works isn’t in the least bit important, all that matters is whether the results are close to what you want. I love it when the underlying nuts and bolts are stupidly simple. While I don’t claim to have invented anything original with this approach, what *lead* me to this style of height generation was thinking about landscapes in terms of plate structure. I considered trying to simulate plate tectonics (crudely) but then decided that it wasn’t really important *how* I got these sorts of structures only that I got them. So the sine-wave wibbles were the first toe-dip into this kind of thing. Instead of using smooth noise, using a pattern with a sharp cut-off (you’re either in the sine-wave ripple (and therefore adding a bit), or you’re not – there’s no interpolation) could yield some interesting features – a curve of a bay where around that curve you may get some little atolls, or dramatic cliff edges. These little features did somewhat end up in the results – close enough, at least, to be fairly satisfying.