Seed value and use in other projects.
Closed this issue · 1 comments
saolsen commented
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.
-
Is this published as a racket package anywhere that I can include in a project?
-
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?
jpverkamp commented
- 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
- 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.