# The Basics of Perlin Noise | Roblox Video Tutorial

For the last 7 weeks, I have been writing and editing a video, which I think will benefit people who do not have a strong understanding on the concept of Perlin Noise, within Roblox.

I would really love some feedback on the video (and/or criticism too), as I want to keep uploading more videos like this, but on shorter topics. Tell me what you think down below, and if you learnt something new from it, feel free to tell me about that too. Any feedback is important to me

Enjoy!

40 Likes

the editing is so good i cant edit as good as that because i use power director the pc version, this kinda reminds me of the typical youtube commentary videos

4 Likes

Funny and informative! Thanks!

3 Likes

Thanks for your comments! The funny thing is, before I made this video, I did make a few YouTube commentary videos last year, so that might be what you see in my editing lol

4 Likes

Please make more things like this! Love these types of tutorials!

2 Likes

Hi! I loveâ€™d that video. However from my personal testing in the past perlin noise isnt exactly -1 to 1. hell, i once had it reach over 1! (over about 62500 samples ) the reality is that they actually converge after -1 to 1 ( meaning it gets exponentially unlikely for it to be outside of those bounds )

tutorial on barycentric coordinates next? >w<

4 Likes

1. [2:53] Here you are using `while wait() do`. It really is a bad practice and you should avoid using it (especially in beginner tutorials, newbies will think that it is a nice shortcut to write a while loop like this and will start to most likely use it).
A proper way of writing a `while wait()` loop is:

``````while true do
wait();
end
``````

However using `wait()` is not effective as well. If you donâ€™t know why, you can read more here. But in short: You should always use different functions that wait for certain events to happen such as `:Wait` (`Heartbeat:Wait()`), `WaitForChild` etcâ€¦

2. [4:28, 4:48] Itâ€™s worth mentioning that `math.random` is not actually random. Itâ€™s a pseudo-random generator, meaning that itâ€™s based on the previous output and as stated here for JavaScript: â€śrandom though they might seem, those numbers will eventually repeat and reveal a non-random pattern.â€ť You can read more about it in this website, since itâ€™s a pretty interesting article overall and even mentions one of the algorithms for generating a pseudo-random number.

3. [13:26] Youâ€™re calling the GetService method each time a new `for x` loop begins. This might hurt the performance, so it would be better if you have defined RunService at the top of your script and then used that variable to access Heartbeat.

4. [17:11] `math.random` does not work with negative and `math.huge` numbers. With the arguments of `-math.huge, math.huge` it will always output `-2147483648`:

To generate a seed more effectively, you could use `math.random() * 1E14` for example.

5. [24:51] `fromRGB` takes integers so this line is incorrect. Instead of multiplying the values by 255 all you want to do is to use `new`: `Color3.new(0.8, 0.8, 0.8)`. Another alternative would be to use HSV although not really preferred: `Color3.fromHSV(0, 0, 0.8)` (third parameter is Value - our brightness). You did use `Color3.new` a few seconds later into the video though so good job.

also please change your script editor font to monospace when making these tutorials, Iâ€™m sure it doesnâ€™t hurt only my eyes and it will just be easier to read the code, thanks

So with that in mind, I think you could be a successful youtuber! As others have pointed out itâ€™s fun to watch your videos, and if you keep uploading good content like this I am sure you will get hundreds of subscribers.

Good luck!

5 Likes

How is this a proper way of making a while wait() loop? Doing

``````while wait() do

end
``````

is the exact same thing as your â€śproper wayâ€ť

2 Likes

I think he was referring to pedantism. If you were to setup the debug profiler theres hardly any difference. It should be noted if you are using wait() to let the GC not kill itself (script timeout) with modulo checks then ofcourse use game:GetService(â€śRunServiceâ€ť).Heartbeat:Wait() otherwise I donâ€™t really see a reason for typing something that is like 10 x longer, just my opinion though from personal experience

2 Likes

Itâ€™s not how a proper `while` construction looks like. There should be a boolean between `while` and `do`, not a function.

1 Like

Itâ€™s called `while-wait-do` idiom. I never said that itâ€™s an error.
Here is a great Google doc resource that explains why you should not use it.

1 Like

Please please guys @RealExoctic @me_isidoit dont turn this into another wait() debate. Take it to dms if needed. Lua doesnt throw a error cause wait() returns true after the yielding is done

3 Likes

You clearly do not understand. You do not have to use the standard way of writing it. Itâ€™s an idiom. There are some benefits such as better readability and maintainability as mentioned in the document (also, if youâ€™re posting some snippets from it then it would be nice if you at least took time to read it)

1 Like

Yes, youâ€™re right about not using wait() as a argument of a while loop.

However, no, thatâ€™s not why.

First of all, there is optimization on Lua and obviously on Luau for `while true do` loops.

It will compile not to â€ścheck this statement and keep repeating as long as this is truthfulâ€ť, instead it will compile to â€śrepeat this foreverâ€ť, basically. There is no checking on a while true do loop.

Another thing is that `wait` is just kind of slow and updates about Â˝ the amount of frames there are actually being rendered. `Heartbeat:Wait()` is better however, since youâ€™re already using Heartbeat, itâ€™s better to use `:Connect` instead.

This should help with GCâ€™ing as any variables with no extra references should get CCâ€™ed once the environment â€śdiesâ€ť, which it wonâ€™t on `Heartbeat:Wait()` loop.

4 Likes

2 Likes

protip: you can layer noise using octaves, frequencies, and lacunarity

2 Likes

Since it was a â€śBasicsâ€ť video, I thought it would be a bit too much, however I may make a follow up video with that in it!

2 Likes

This is funny and is explained well
i hope you can futher your programming skills to the max

2 Likes

This is a wonderful perlin noise tutorial in its own right, and especially useful to us Roblox devs. And I laughed a few times through it. Thank you so much!

1 Like

Amazing video! Very informative, has great editing & just a good video in general. You should definitely make some more!

2 Likes