Skip to content

max-mapper/voxel-perlin-terrain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

generate voxel terrain using perlin smooth noise

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published