Difference between revisions of "Perlin noise in 2 dimensions expression"

From Castle Wiki
m
(Add motivation for perlin noise)
 
Line 1: Line 1:
''See [[wikipedia:Perlin_noise|the Wikipedia page on Perlin noise]] for more information.''
''See [[wikipedia:Perlin_noise|the Wikipedia page on Perlin noise]] for more information.''


Perlin noise is an [[Expression]] that takes in two values, an X and Y position, and returns a single value between 0 and 1. The value returned by Perlin noise is a psuedo-random value and can form pleasingly random yet uniformly distributed patterns when viewed alongside neighboring values. Perlin noise can be used to create natural movement patterns or for generating realistic terrain.
Perlin noise is an [[Expression]] that takes in two values, an X and Y position, and returns a single value between 0 and 1. The value returned by Perlin noise is a psuedo-random value and can form pleasingly random yet uniformly distributed patterns when viewed alongside neighboring values.
 
== What do I use this for? ==
This is useful when you want something to feel random, but to change smoothly through space. For example, you could generate random terrain by using the X and Y of the card space as inputs, and assigning the Perlin output to the height of the hills at that location.
 
[https://s.castle.xyz/WfCb3q9Dhg Here] is an example of a deck that uses Perlin noise. To see how it works, [[View Source|view the source]] of the deck in Castle, then [[Inspector|inspect]] the blue square actor.

Latest revision as of 22:17, 16 May 2022

See the Wikipedia page on Perlin noise for more information.

Perlin noise is an Expression that takes in two values, an X and Y position, and returns a single value between 0 and 1. The value returned by Perlin noise is a psuedo-random value and can form pleasingly random yet uniformly distributed patterns when viewed alongside neighboring values.

What do I use this for?

This is useful when you want something to feel random, but to change smoothly through space. For example, you could generate random terrain by using the X and Y of the card space as inputs, and assigning the Perlin output to the height of the hills at that location.

Here is an example of a deck that uses Perlin noise. To see how it works, view the source of the deck in Castle, then inspect the blue square actor.