In a few of my demos I’ve used 2d terrain. I love the effect and its really easy to do especially in 2d. The algorithm I use most is Diamond Square also known as Midpoint Displacement. What’s great about the algorithm besides its easy of use is that it can be used for simple 2d terrain as well as with 3d terrain. For now I will just be talking about generating 2d terrain, in a future article I will discuss how to use the same algorithm to make create height maps that can be used in turn to create 3d terrain.
Below is what I ended up settling on for an entry for the JS1k. My ideas ranged for a rainbow road (similar to the Mario Kart level), to a 3d tombstone that said dysentary, a terrain generator, then a wave generator. I ended up just combining the last two ideas and came up with below. Read More