1
00:00:00,160 --> 00:00:03,360
A simple mathematical function from the 1980s quietly

2
00:00:03,360 --> 00:00:06,880
shaped some of the most iconic games of the past few decades.

3
00:00:06,880 --> 00:00:12,160
Today, I want to tell you the story behind it, why it was invented, why it works so well,

4
00:00:12,160 --> 00:00:15,520
and why I believe it may be the most important algorithm in the history of video games

5
00:00:15,520 --> 00:00:19,440
.  Hopefully, I can provide you with enough evidence to see if you agree.

6
00:00:19,440 --> 00:00:24,640
It all started in 1982 with a movie that changed the history of computer graphics.

7
00:00:24,640 --> 00:00:29,120
Ken Perlin was part of the visual effects team for Tron, the first

8
00:00:29,120 --> 00:00:35,120
Hollywood film to be made almost entirely of computer-generated images.  This is groundbreaking.  But for him,

9
00:00:35,120 --> 00:00:39,440
it wasn't good enough: "Everything looked like a machine," he later said.

10
00:00:39,440 --> 00:00:44,000
The problem lies in the texture.  When they tried to simulate things like fire or smoke, the

11
00:00:44,000 --> 00:00:47,071
results looked flat and unnatural.

12
00:00:47,071 --> 00:00:50,520
Tools that generate details rely on white noise, and the

13
00:00:50,520 --> 00:00:54,194
results produced feel more static than natural.

14
00:00:54,194 --> 00:00:56,037
Palin wanted something better.

15
00:00:56,037 --> 00:00:59,720
It feels smooth and organic, yet it can be generated quickly

16
00:00:59,720 --> 00:01:02,160
without manual work or extensive calculations.

17
00:01:02,160 --> 00:01:08,400
His solution became Perlin Noise, which won the Academy Award for Technical Achievement in 1997.

18
00:01:08,400 --> 00:01:10,800
This award was presented alongside the Oscars, and

19
00:01:10,800 --> 00:01:15,200
later the awards ceremony also celebrated the creator of Photoshop.

20
00:01:15,200 --> 00:01:18,417
So... what exactly is Berlin noise?

21
00:01:18,417 --> 00:01:20,880
Essentially, it is just a function.

22
00:01:20,880 --> 00:01:25,200
You give it one or more numbers as input (positions in space), and it returns

23
00:01:25,200 --> 00:01:31,360
another number.  Technically, the output range is from -1 to 1, but in most visual applications,

24
00:01:31,360 --> 00:01:37,920
it scales to a range between 0 and 1: black to white with gray shades in between.

25
00:01:37,920 --> 00:01:43,600
But here's a trick: nearby inputs will produce similar outputs.  As we'll see later, this is precisely

26
00:01:43,600 --> 00:01:48,880
why it's so useful in video games: the patterns it creates

27
00:01:48,880 --> 00:01:55,680
strike the perfect balance between order and chaos.  Unpredictable, but going smoothly.  Random, but structured.

28
00:01:55,680 --> 00:02:00,720
Let's see how it works.  And don't worry, it's actually very simple.

29
00:02:00,720 --> 00:02:05,600
To generate the Berlin noise, we first divide the space into a regular grid.

30
00:02:05,600 --> 00:02:11,328
At each corner of the grid, we assign a unit vector pointing in a random direction.

31
00:02:11,328 --> 00:02:15,600
These are called gradients, and they shape the behavior of noise.

32
00:02:15,600 --> 00:02:21,200
For each pixel in the image, we look at its four surrounding corners and calculate

33
00:02:21,200 --> 00:02:26,320
how much that pixel is affected by each gradient.  We achieve this from each corner by calculating

34
00:02:26,320 --> 00:02:32,745
the displacement (a vector from the pixel to the corner) and taking its dot product with the gradient.

35
00:02:32,745 --> 00:02:37,760
This is a simple operation that tells us how well two vectors are aligned.  If they point in

36
00:02:37,760 --> 00:02:44,400
similar directions, the result is closer to 1.  If they are far apart from each other, the result is closer to 0.

37
00:02:44,400 --> 00:02:49,760
This gives us four numbers, one for each corner.  We

38
00:02:49,760 --> 00:02:55,280
repeat this process for each pixel in the image, calculating four parts of the result.

39
00:02:55,280 --> 00:03:02,080
Then, we combine these numbers using linear interpolation: a mathematical operation for smooth transitions.  First horizontally,

40
00:03:02,080 --> 00:03:06,240
then vertically, eliminating visible seams and creating a

41
00:03:06,240 --> 00:03:10,813
continuous pattern with organic variations that is smoother at higher resolutions.

42
00:03:10,813 --> 00:03:13,016
If the initial gradient points in a different direction,

43
00:03:13,016 --> 00:03:17,040
the pattern will look completely different.

44
00:03:17,040 --> 00:03:20,729
But we are not limited to one of these models.

45
00:03:20,729 --> 00:03:24,285
We can generate multiple variations and

46
00:03:24,285 --> 00:03:27,456
combine them using a technique commonly known as fractal noise

47
00:03:27,456 --> 00:03:32,781
.  For each new layer (or octave), we increase the frequency and decrease the intensity.

48
00:03:32,781 --> 00:03:36,160
We then simply add their values ​​pixel by pixel,

49
00:03:36,160 --> 00:03:40,960
layering the details without overshadowing the structure.  The first layer captures

50
00:03:40,960 --> 00:03:47,440
broad lines and large shapes.  Next, add smaller waves.  Then there are even finer bumps and grooves.

51
00:03:47,440 --> 00:03:49,280
This is why mountains are eroded

52
00:03:49,280 --> 00:03:54,960
or clouds are affected by turbulence.  Although it was still just noise, it felt like nature.

53
00:03:54,960 --> 00:04:01,120
What's the best part?  It is highly efficient.  You can calculate it on the fly, without needing to store

54
00:04:01,120 --> 00:04:09,680
large textures or prefab assets.  It's just math.  Simple, elegant, fast... and infinitely useful.

55
00:04:09,680 --> 00:04:13,680
Let's take a look at some of its most common use cases in games.

56
00:04:13,680 --> 00:04:15,708
First: Topography.

57
00:04:15,708 --> 00:04:20,444
In the world of programming, you often want to generate landscapes through algorithms.

58
00:04:20,444 --> 00:04:25,600
Hills, mountains, valleys... all of these can come from a Perlin noise map,

59
00:04:25,600 --> 00:04:29,760
where each value defines the elevation of a point in space.

60
00:04:29,760 --> 00:04:34,880
Berlin noise can also define the structure of the world, not only the height of the land,

61
00:04:34,880 --> 00:04:40,874
but also the layout of the entire region.  The place where one region ends and another begins.

62
00:04:40,874 --> 00:04:42,497
The cave is twisted.

63
00:04:42,497 --> 00:04:47,840
Instead of building these structures by hand, you let noise sculpt the space for you.

64
00:04:47,840 --> 00:04:54,800
Next step: allocation.  You can use Berlin noise as a density map instead of randomly placing things.

65
00:04:54,800 --> 00:05:00,800
Think of trees, loot, or enemies: areas with high value will receive more content, while other areas

66
00:05:00,800 --> 00:05:06,640
will remain sparse.  The result is clusters that look very natural, feeling like a real ecosystem: a

67
00:05:06,640 --> 00:05:11,920
dense forest, scattered resources, or a dangerous area crawling with enemies.

68
00:05:11,920 --> 00:05:17,200
Then there's the texture.  Perlin Noise is a preferred tool for visual variety,

69
00:05:17,200 --> 00:05:22,240
often used to generate effects such as smoke, magical energy, or fire.

70
00:05:22,240 --> 00:05:28,160
For example, it can adjust color and transparency to make things feel more organic.

71
00:05:28,160 --> 00:05:35,120
It can also drive animations in textures and larger scenes, such as grass swaying in the wind or

72
00:05:35,120 --> 00:05:41,680
gently rolling waves.  The result is that the sensation of motion does not cycle, but is always changing.  The

73
00:05:41,680 --> 00:05:47,520
same idea can also be applied to sound.  Perlin Noise can subtly change the tone

74
00:05:47,520 --> 00:05:54,960
or volume, among other things.  This is especially useful for frequently repeated environmental elements, such as footsteps or wind.

75
00:05:54,960 --> 00:05:58,519
Perlin Noise can be used for anything that needs to be energetic.

76
00:05:58,519 --> 00:06:04,400
This is a building block.  A seed.  One rhythm.  Whatever you need it to be.

77
00:06:04,400 --> 00:06:08,849
This is most evident in Minecraft.  Everything in the game uses Perlin Noise

78
00:06:08,849 --> 00:06:14,000
, but the way it generates biomes is particularly clever.  Instead of

79
00:06:14,000 --> 00:06:17,680
assigning them randomly, it first

80
00:06:17,680 --> 00:06:25,680
creates a set of environmental properties using separate noise maps.  Temperature, humidity, erosion, altitude... and others.

81
00:06:25,680 --> 00:06:32,005
It then uses a set of rules to combine these attributes to determine which biomes are meaningful at each location.

82
00:06:32,005 --> 00:06:35,967
High temperature and low humidity?  Perhaps this is a desert.

83
00:06:35,967 --> 00:06:40,460
High altitude, humid, and hot?  It might be a jungle in the mountains.

84
00:06:40,460 --> 00:06:44,184
Low altitude, high erosion?  This is a beach.

85
00:06:44,184 --> 00:06:47,920
That way, you won't see snow-capped peaks next to a volcano.

86
00:06:47,920 --> 00:06:52,091
You will get a transition, a gradual change, just like in the real world.

87
00:06:52,091 --> 00:06:57,760
This is not just about aesthetics.  Biomes influence gameplay: what creatures spawn,

88
00:06:57,760 --> 00:07:02,720
what resources appear, and what the weather is like.  This was generated by a program,

89
00:07:02,720 --> 00:07:08,720
but it makes sense.  A meaningful world, even though no one designed it by hand.

90
00:07:08,720 --> 00:07:14,174
So... is Perlin Noise really the most important algorithm in the history of video games?

91
00:07:14,174 --> 00:07:19,280
This is a very important proposition.  But starting in the mid-1990s, and especially throughout the 2000s,

92
00:07:19,280 --> 00:07:23,760
it gained attention and quietly became a standard tool across the industry.

93
00:07:23,760 --> 00:07:26,880
To better understand the extent of its influence,

94
00:07:26,880 --> 00:07:32,720
I analyzed three broad categories of games based on cross-referenced critical rankings: the 50 best-selling games of all time,

95
00:07:32,720 --> 00:07:36,947
Game of the Year winners, and games most often considered the greatest of all time

96
00:07:36,947 --> 00:07:42,960
.  There are nearly 400 titles in total.  For each game, I analyzed whether it

97
00:07:42,960 --> 00:07:47,680
used Perlin Noise or closely related technologies in its most common applications

98
00:07:47,680 --> 00:07:53,360
.  Each case was scored using three levels of certainty:

99
00:07:53,360 --> 00:07:59,280
no use, possible or indirect use, and explicit or documented use.

100
00:07:59,280 --> 00:08:04,880
The results were astonishing.  Of the 50 best-selling books, 84% explicitly

101
00:08:04,880 --> 00:08:11,520
or very likely used the Berlin noise or its derivatives.  The remaining 16% are mostly older games, some of which were

102
00:08:11,520 --> 00:08:16,800
even released before the algorithm was invented.  In the list of games of the year, every game

103
00:08:16,800 --> 00:08:20,960
uses it in at least one common form, most commonly in visuals and effects,

104
00:08:20,960 --> 00:08:26,560
but also in animation and procedural content.  In the list of the greatest games of all time, spanning decades,

105
00:08:26,560 --> 00:08:32,080
the further back in time, the more algorithms emerge.

106
00:08:32,080 --> 00:08:37,120
Finally, many best-selling games not only use it,

107
00:08:37,120 --> 00:08:42,240
but often use it in more sophisticated ways.  It spans multiple domains and is layered with other systems.

108
00:08:42,240 --> 00:08:47,360
Perlin Noise has quietly become one of the most widely used algorithms in game development.

109
00:08:47,360 --> 00:08:53,360
It determines the game's appearance, sound, and feel.  It is the backbone of procedural generation,

110
00:08:53,360 --> 00:08:56,320
a technology that defines modern game design.

111
00:08:56,320 --> 00:09:00,320
If you want to prove its influence, just look at the

112
00:09:00,320 --> 00:09:03,296
best-selling and arguably most influential games of the past few decades.

113
00:09:03,296 --> 00:09:06,302
Would Minecraft still exist without Perlin Noise?

114
00:09:06,302 --> 00:09:07,652
perhaps.

115
00:09:07,652 --> 00:09:10,256
But you will never feel the same way.

116
00:09:10,256 --> 00:09:14,074
Some of the most powerful tools in the game are ones you've never seen before.  The

117
00:09:14,074 --> 00:09:19,215
noise in Berlin itself goes unnoticed.  But it always exists, beneath the surface.

118
00:09:19,215 --> 00:09:23,635
This is not just mathematics.  This is a method of building complexity from simplicity.

119
00:09:23,635 --> 00:09:27,681
Create infinite illusions in a world on a hard drive.  The

120
00:09:27,681 --> 00:09:30,459
Berlin noise isn't the reason we play games.

121
00:09:30,459 --> 00:09:34,102
But maybe that's why they feel like a game.

122
00:09:35,662 --> 00:09:36,671
See you next time.

