![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWZrVsomhQRXph1HlTdxhFEA4YTOTkHxtwyOIX-8vQuDJ-EK8-ArV9MsdyTyOyvlvRod5vigOW9dT8umOreD_HuIEUxBv-mz_dNRgpNPG9Lo_feu9wLwxfAuMGpMpKNTNVErBJcg/s523/mapsmania.gif)
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.
![](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi_U26nDaL0o6qtpnMExpD3U9recTh6CzzEXSJXdfEH4VEXmv2e69meeF9KPpWnNL-CIunIn5p04hS73Do4orhsJy_Nj5qQ5Xjh0oA57qskmWA59smCskFrL_bCbFBWLghLmXbBIg/s523/mapsmania.gif)
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:
Post a Comment