How to Create Terrain and Heightmaps using the Diamond-Square Algorithm in JavaScript?

The diamond-square algorithm is a procedural terrain generation algorithm. It makes it easy to generate Heightmaps and Terrain for games. In this article we will implement the diamond-square algorithm in JavaScript, plot our terrain on a canvas and see how …