How it works...

After initializing the corners with some values, we go from the outer corners, working inwards and propagating those values with some randomness.

The key thing is that by working in steps, subdividing the grid into squares and diamonds, we get a randomness similar (to some extent) to the randomness we find in landscapes in nature.

It's important to fine-tune the initial values to get better results according to our specific needs for our game.

Get Unity 2018 Artificial Intelligence Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.