jpverkamp/noise

Seed value and use in other projects.

Closed this issue · 1 comments

Hey I've been playing around with this for generating terrain or a game I'm prototyping and it's working really well. I have a couple questions.

  1. Is this published as a racket package anywhere that I can include in a project?

  2. Is there any way you can add the ability to pass in or set a seed value to generate different variations of the perlin and simplex noise?

  1. Yes, as of a few minutes ago. I finally figured out how to deploy and download a project via Planet 2. You should be able to do this:
$ raco pkg install github://github.com/jpverkamp/noise/master
...
$ racket
> (require noise)
> (perlin 0.0)
0.0
  1. More or less. Since both Perlin and Simplex are 3D functions, if you're generating 1D/2D noise you can use the extra dimension to pass the seed. For example:
> (perlin x y seed)

That's what I did in [https://github.com/jpverkamp/racket-roguelike/blob/master/src/levels.rkt](Racket Roguelike's level code) (~ line 180). Alternatively, you can offset by the seed:

> (perlin (+ x seed) (+ y seed))

Either of these work better if the seed is an integer, since within a range of ±1 the values are going to be relatively samey.