generate voxel terrain using perlin smooth noise
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
Makefile
demo.js
index.html
index.js
package.json
player.png
readme.md
test.js

readme.md

voxel-perlin-terrain

generate voxel terrain using perlin noise

this is designed to work out of the box with voxel-engine

install

npm install voxel-perlin-terrain

api

var terrain = require('voxel-perlin-terrain')
var chunkSize = 32

// initialize your noise with a seed, floor height, ceiling height and scale factor
var generateChunk = terrain('foo', 0, 5, 20)

// then hook it up to your game as such:

game.voxels.on('missingChunk', function(p) {
  var voxels = generateChunk(p, chunkSize)
  var chunk = {
    position: p,
    dims: [chunkSize, chunkSize, chunkSize],
    voxels: voxels
  }
  game.showChunk(chunk)
})

// note that your game should have generateChunks: false

chunk data is returned in the format of the voxel module

license

BSD