
If tails, and we aren't near the top, add some heightĮlse if (nextMove = 1 & lastHeight = 0 y-) Int lastHeight = Random.Range(0, map.GetUpperBound(1)) System.Random rand = new System.Random(seed.GetHashCode()) public static int RandomWalkTop(int map, float seed) The only downside to this algorithm is that it looks very blocky. This creates some height to our level by always moving either up or down. If the result is heads, we move up one block, if the result is tails we instead move down one block. The way this algorithm works is by flipping a coin. If the interval is less than one, we simply use the previous function to do the work for us. Once we have done every position between the last position and the current position, we will move on to the next point.When we do hit 0 on the y-axis, we will add the height change to the current height and repeat the process for the next x position.Now we can start setting the positions.Next, we determine how much we should change the hit by, this is done by dividing the y difference by the interval variable.Get the difference between the two positions, the key information we want is the difference in the y-axis.Get the current position and the last position.

The smoothing happens through the following steps: The corresponding points of the smoothing.

Used to reduced the position of the Perlin point Smooth the noise and store it in the int array public static int PerlinNoiseSmooth(int map, float seed, int interval) This function ends up being slightly more advanced, as we have to take into account Lists of integers for our intervals. Set intervals to record the Perlin height, then smooth between the points. We can also take this function and smooth it out.
