fractal-terrain-generator

0.0.2 • Public • Published

Random fractal terrain generator

online demo: http://qiao.github.com/fractal-terrain-generator/demo/

This program is based on the Diamond-Square algorithm.
You may check out http://gameprogrammer.com/fractal.html for a detailed description.

Usage

Browser

download http://qiao.github.com/fractal-terrain-generator/lib/terrain.js and include it in your html.

Node.js

npm install 
var terrain = generateTerrain(32, 32, 1.0);

generateTerrain receives three parameters:

  • width: Segments of the width of the terrain.
  • height: Segments of the height of the terrain.
  • smoothness: Smoothness of the terrain. Higher this value, smoother the terrain will be. Recommended value is 1.

The result terrain will be a (width + 1) x (height + 1) 2-dimensional array containing the elevation of each vertex.

/fractal-terrain-generator/

    Package Sidebar

    Install

    npm i fractal-terrain-generator

    Weekly Downloads

    3

    Version

    0.0.2

    License

    none

    Last publish

    Collaborators

    • qiao