FastNoise - Native Extension for noise generation

It’s time to leave Perlin Noise in the past. Come use FastNoise for Defold, based on FastNoiseLite. Here’s a quick list of why you might want to use it:

More Choices:

You can make 2D and 3D noise of the following types:

  • Perlin
  • OpenSimplex2
  • OpenSimplex2S
  • Cellular (Worley/Voronoi)
  • Value
  • Cubic Value.
  • It also includes fractal noise generation,
  • And domain warping.

If you want to see the kinds of noise you can make, refer to the upstream demo:
https://auburn.github.io/FastNoiseLite/
Or the purely functional(*) Defold HTML5 version: https://defold-fastnoise-4e628e.gitlab.io/
*the “functionality” of it is up for debate. You’ll want the reference handy: Defold Fastnoise / Defold Fastnoise · GitLab

More Faster:

It’s faster than that ole’ perlin.lua that hangs around the forum. My benchmarks say it’s between 2x -3x faster in a direct comparison of points generated/second. And dramatically more if you’re only generating noise (up to ~17million points per second). The plan for the next release is multi-threading, so it will be even faster.

More Easy to Use

There’s a super simple example project to show how to use it as a drop-in replacement for perlin.lua. Three(3) lines of code had to be changed and the dependency added: Defold Fastnoise / Infinite Map · GitLab

local state = fastnoise.new_state({}) -- make a default state
local domain_state = fastnoise.new_state({domain_warp_type =  "opensimplex2"}) -- make a configured state
local noise = fastnoise.get_noise(state, x, y,) -- make 2D noise
noise = fastnoise.get_noise(state, x, y, z) -- make 3D noise

x, y, z = fastnoise.domain_warp(domain_state, x, y, z) -- warp x,y,z according to the domain_warp state.

noise = fastnoise.get_noise(fastnoise.new_state({seed = 80085})) -- one liner

--I'm not advocating you do it this way, just saying that you could
noise = fastnoise.get_noise(fastnoise.new_state({seed = 614412}), fastnoise.domain_warp(fastnoise.new_state({domain_warp_type = "opensimplex2"}), 1, 1, 1))
15 Likes