
2D Terrain generation using midpoint displacement - galloafro
https://bitesofcode.wordpress.com/2016/12/23/landscape-generation-using-midpoint-displacement/
======
WhitneyLand
This is fantastic for kids or new coders. Its good coding practice, makes
apparent the power of a simple, elegant algorithm, and has a big visual/fun
payoff. You could spend weeks extending the concept.

And for a 3d example:
[https://goo.gl/images/JpSXTW](https://goo.gl/images/JpSXTW)

edit: a friend of mine wrote a game called dragon strike with terrain gen and
I can't remember any real interactive 3d being done on a PC before that:
[https://extralives.files.wordpress.com/2013/09/dragonstrike_...](https://extralives.files.wordpress.com/2013/09/dragonstrike_1a.jpg)

I'm sure there was prior art in some other pc game, maybe someone remembers...

~~~
buzzybee
There are tons of early examples of interactive 3D depending on what
techniques and technologies you want to consider.

DragonStrike is most like a flight sim, of which the Microsoft Flight
Simulator series dates back to 1976-77(for 8080 and Altair!), with FS 3 and 4,
from 1988-1989 being most like DragonStrike in terms of tech. Contemporary
examples within other genres include: Arctic Fox. M1 Tank Platoon, F-15 Strike
Eagle II, Midwinter, Carrier Command, Stunts, and Test Drive III. "Flight sim"
style 3D, with wireframes, flat polys and some sprites, was considered the
main way to do interactive 3D for a long time, with each renderer having to
pick and choose which details to focus on - the most common compromise being
to impose heavy distance fog in order to convey detail in screenshots.

In the arcade, flat-shaded, color 3D was done in Atari's I, Robot in 1983! One
year later, a simplified raytrace model was used to prerender terrain lighting
for Marble Madness - a subtle solution to a problem that otherwise would
consume a lot of artist time. Most of the 80's in arcades was dominated by
sprite-scaling games with pseudo-3D road engine hardware like Outrun and Space
Harrier, though. Wolfenstein 3D and Doom are in many ways more in the
pseudo-3D genre than the flight sims, since they exploit a very specific hack
with raycasting that gives decent quality and flexibility.

Edit: Wolf3D style raycasting was purportedly used in Alternate Reality: The
Dungeon in 1986. You wouldn't know it at a glance, though, since it's a slow-
paced RPG where your view is glued to 90-degree angles and snapped to the
horizontal center of the grid cells.

~~~
WhitneyLand
great recap!

iRobot was awesome, but to be fair it would have never been possible with only
a general purpose cpu.

so many of those games showed great skills in optimization and design.

------
radarsat1
Now add missiles! Scorched Earth ftw.

------
sulam
If this is new to you, you should also investigate Perlin noise used to
generate terrain. There are many examples online. It uses many of the same
concepts although it's not quite as intuitive. I suspect it is more efficient,
though, although that strongly depends on how good the PRNG you're using is.

------
rsiqueira
It seems like the old Moon Patrol (game) mountains, but better.

------
Animats
Did he just re-invent fractals? That's roughly how most terrain generators
work.

~~~
DougBTX
Yes, I think you could call it a fractal. The Wikipedia page linked to from
the article says that this technique is also called a "random midpoint
displacement fractal".

~~~
DanBC
Midpoint displacement is mentioned in The Science of Fractal Images (and the
Beauty of Fractal Images), and also in Mandelbrot's book Fractal Geometry of
Nature.

From a phone, sorry about upside down:
[http://m.imgur.com/JGCpnIu](http://m.imgur.com/JGCpnIu)

A snippet from "Science of Fractal Images"

------
crabstraggler
The author fails to realize Diamond-Square is called such because a diamond
inscribed in a square touch all the midpoints with each corner....very
intuitive.

------
hiker79
Whoever finds that these skylines look "realistic" spends to much time in
front of a machine and too little time out in the mountains. This is
ridiculous.

~~~
Negitivefrags
You put a word in quotes that appears nowhere on the page.

It's a useful technique in the procedural generation toolbox. Hardly
ridiculous at all.

~~~
TillE
As one of the more popular terrain generation algorithms, it's a tool that
gets used far too often.

Though to be fair, it's not only procedurally generated terrain that's wildly
unrealistic in most 3D games. For the vast majority of games (except for,
like, Arma), you'd think that the designers had never been outdoors.

