# GMLscripts.com

Discuss and collaborate on GML scripts

You are not logged in.

## #1 2013-07-13 19:30:39

Marchal_Mig12
Member
Registered: 2009-05-21
Posts: 72

### Generating Random Fractal Terrain

When surfing the gmc, I fell onto a topic with someone asking help to procedural create a fractal kind 1D array that relies on midpoint displacement.

More on that topic can be found here :

http://www.gameprogrammer.com/fractal.html#midpoint

I found it really interested and yet not too complex. Here's an example demonstrating a part of it :

http://www.2shared.com/file/GQ-iSHqA/Fractal.html

The goal is to be able to create randomly generated terrain either in 3d or 2d.

Offline

## #2 2013-07-13 19:56:54

xot
Registered: 2007-08-18
Posts: 1,201

### Re: Generating Random Fractal Terrain

Midpoint displacement is the classic example for random fractal terrain. It has some disadvantages in the form of obvious lattice artifacts, but it's a good technique to learn since it requires some implementation thought.

These days people prefer to use Perlin noise for this. It doesn't exhibit as many artifacts and any point can be evaluated without needed to calculate the neighbors. It's also easy to pass the noise function through other functions to get greater variety.

Back in the 80s there was a game put out by Lucasfilm Games called Rescue on Fractalus. It used 3D fractal terrain generated on-the-fly long before anything else. It's technically amazing. Loren Carpenter built the technology, which would later be used in the games Koronis Rift and Eidolon. Loren is most famous for creating the "genesis effect" sequence in Star Trek II: The Wrath of Khan and is now chief scientist at Pixar. In the game he was able to get around some of the normal midpoint displacement dependence problems using some sort hashing trick or something. I read the paper on it but I couldn't get my head around it. I've been wanting to adapt it to GM for a long time.

Last edited by xot (2013-07-13 20:14:32)

Abusing forum power since 1986.

Offline