Check out my replies to this thread.
Could you add parameters for frequency and lacunarity?
EDIT: Some other feedback:
The interface doesn’t make a lot of sense. The ModuleScript returns a table with a method called “new”, which suggests that there’s some OOP stuff going on and that PerlinNoiseAPI.new
is a constructor that would return some kind of object. But actually calling the function just samples the noise function at the given coordinates and other parameters. It would make more sense to not call it an “API” and just return a function from the ModuleScript.
E.g.:
Instead of this:
local PerlinNoiseAPI = {}
function PerlinNoiseAPI.new(coords,amplitude,octaves,persistence)
end
return PerlinNoiseAPI
Just do
local PerlinNoise = function(coords,amplitude,octaves,persistence)
end
return PerlinNoiseAPI
The amplitude
parameter should be a multiplier on the output of the Perlin noise function, but the way you’re using it makes it behave more like a period
or (the inverse of) frequency
parameter should.
E.g.:
local perlinvalue = math.noise(X/amplitude,Y/amplitude,Z/amplitude)
should actually be
local perlinvalue = math.noise(X/period,Y/period, Z/period) * amplitude
and again in the loop where you sample each of the octaves.
When checking if the arguments are valid, you can do
assert(condition, error_message)
--rest of the code
instead of
if not condition then
error(error_message)
else
--rest of the code
end
Having fewer if statements, and especially fewer deeply nested if statements, just makes your code more readable and easy to understand. It also lets you have the main part of your code be at the lowest level of indentation possible, which can sometimes be helpful if it allows you to scroll sideways to see everything.
Hope this is helpful
Thanks for the feedback! I’m actually working on a revamp of this module to fix the 4D and the amplitude/frequency misconception of mine, and I’ll definitely change what you said. I had no idea something as assert() existed, so again, thanks!
Any progress on this? I’ve been waiting for this for a while now.
any update on this? doing some terrain things and am needing this. Also how can i get the seperate X, Y, Z values?
EDIT: Sorry for the bump.
Sorry for the bump, but I’m looking into something like this for my game. Is it still being worked on?
Hi man, I just want to say thanks a ton for this, I’ve been tinkering with your module for about 4 weeks now, and devouring resources about procedural generation. Still I’m by no means an expert, but if it wasn’t for your module, it would have been extremely hard for me to get started.
Using your module I just spawned a tile map, and passed a radia filter on top of it, the results have been short of amazing, I just wish making ridges and valleys was easier.as it is right now is completely usable, you can go a long way w/o ever having to touch the internals of the module, but the lack of lacunarity and frequency can bother advance users, and you will have a hard time attempting to add FBM to this, which I attempted for the last 3 days and failed miserably. other than that it’s an amazing module as it is.
Hey, I’m not advanced at all in building, terrain heightmaps etc, do you have any sort of tutorials on “making parts” with this module?
Hi! Sadly there is no tutorial that uses this module, but thanksfully it’s not that hard to use, you see this is just an enhanced noise function, basically math.noise in roids. now into my implementation, I had to sweat for 3 weeks looking at papers and tutorials from other engines to understand basically how this worked because although there are tutorials in roblox about procedural generation, w/o offense to those content creators, they are not useable in an scalable project. now if you want to see my implementation, here is the project file so you can play with it
BOP.rbxl (81.3 KB)
it has an easy to use panel in replicated storage/Configuration, and most of the meat of the module is in the server storage, I just leverage dieg module to make my procedural map implementation.
If you have any questions you can find me on discord as CluelessDev(Quique)#5459
EDIT: btw, I believe for what I’ve been told from other devs that the code in the project is clean and well organized, so I don’t think you will have a very hard time understanding what is happening there.
This looks amazing. The way you used the perlin noise is jusy amazing!
Oh, and it improved a lot after that
The 4d perlin makes it like true Minecraft generation
Thanks for contributing us a useful module!
This is good. Good, good, good.