Friday, May 16, 2014

Randomly Generated Maps

Realistic Terrain in 130 Lines is an interesting tutorial explaining how to use fractals to randomly generate an oblique view of a mountainous terrain. The results are very impressive.

The code uses the diamond square model to create the terrain in only 130 lines of code. The terrain is stored as a simple height map which is a 2-dimensional array of values representing the height of the terrain at any given x, y coordinate.

Theoretically it should be possible to extract the elevation data for a given location (for example using the Google Elevation API) and create a terrain view of a real location. That particular task is beyond my coding skills but I'd love to see someone give that go.

Second World uses the Google Maps API, Perlin noise and Thomas Wang's hash function to create a procedurally generated world.

The code for Second World could provide a great basis for creating random game worlds. If you have ever wanted to create a Google Maps based adventure game then you should definitely check out the source code for Second World on GitHub

No comments: