I'm currently writing a little side scroller in C#, to both learn C# and have fun. Right now I have a simple random number generator generating the world but it isn't exactly all that great - so with some research, I've discovered that Perlin Noise generation may help me out quite a bit. Problem is, I want to have an "endless" landscape made up of several chunks.

Basically my questions / concerns are:

  1. Using minecraft as an example (Ignoring the 3rd dimension), how is Notch getting each chunk to connect to each other perfectly? Tunnels, caves, ore veins, mountains, flat lands, biomes, etc. are all connected to each other even though each chunk is generated separately, and sometimes at a much later date. This is key for me, I want the player to be able to walk to the right and as they are walking, generate more landscape that connects to previous landscape, including underground tunnels and cave systems.
  2. Going off of #1, how would this be accomplished under the assumption that each chunk is a square, and the world is 10 squares high, and infinite squares wide? I.e. Each "chunk" is 128x128 tiles and the world is 1,280 tiles tall total. (This is so that I can make an infinitely deep map if I choose to - and also to show that all 4 sides of a chunk / square need to be able to connect and continue on what the previous square/chunk was doing).

2 Answers 2


Find a C# implementation of Simplex Noise, it's like Perlin but better behaved and faster.

The thing about continuous noise functions like Perlin and Simplex is that they are deterministic, noise is not random. What most noise implementations use is a Seed value that offsets into the noise generated which makes Seed=1 different from Seed=2.

Because of the above observation you can keep reusing the Seed and all the new terrain generated as you move through the noise function will match up because it just picks up where you left off.

This part of it is pretty simple and quite nice, what you do with the generated noise is where the magic happens.

To James, that's possible but my personal speed test with a 3D noise showed simplex to be faster at 3, could be any number of factors in my personal test but it matched the general idea in literature. Even if it were slower I would recommend simplex because it doesn't show the "square" artifacts that perlin does.

To Jon, Noise is a math function and it just spits out results from parameters and given the same parameters you will get the same number back. I see where the confusion might come from.

This noise function is sampled like: number=noise(x,y,z); for 3 dimensional noise. As an example, your first map may sample from X=0.0 to X=1.9, the map just to the right of it continues and samples from X=2.0 to 3.9

Part of the art of using noise is finding good ranges to sample, deciding on how many octaves, filtering and processing etc... Take a look at a handy noise library to see a few examples and some source code of Perlin in action.

  • 2
    \$\begingroup\$ I thought Simplex was only faster in higher dimensions than 3 or 4 over perlin noise? That Perlin put together Simplex specifically to compensate for the higher dimension slow down his original algorithm ran into. \$\endgroup\$
    – James
    Commented May 11, 2012 at 23:41
  • \$\begingroup\$ So basically if I generate a random seed on creation of a world and keep feeding that seed in, if I make a new noise map to be placed to the right of the first noise map, it will continue? I.e. if the initial noise map has what will eventually be a vein of iron, that vein of iron will be continued in the new map? How exactly does this work? How does the algorithm know that it needs to "continue" the noise map on the left, right, top, or bottom side? \$\endgroup\$
    – Jon
    Commented May 12, 2012 at 1:57
  • \$\begingroup\$ @Jon I edited my answer to try and better describe what noise functions do, I hope it makes more sense in terms of how noise can be used to build continuous maps a piece at a time. The most important idea is still that noise is not random. \$\endgroup\$ Commented May 12, 2012 at 2:36
  • \$\begingroup\$ @PatrickHughes Wow your edit cleared it up quite a bit, thanks. Now I just need to find a simple C#/XNA class for simplex noise generation to work with. \$\endgroup\$
    – Jon
    Commented May 12, 2012 at 2:45

a noise table is precomputed to seamlessly tile, just like any other seamless texture map. so that's why you can go to point X and it will be the same everytime, very important in animations so textures dont change from frame to frame.

there is a thread about this on answers.unity3d.com (procedural side scroller level generation)

also, the 1994 book "procedural modeling and texturing" discusses noise and multi-fractals (layered noise with different frequencies and rotations).

  • \$\begingroup\$ I may be misunderstanding you, or I didn't explain myself very well - I don't want to seamlessly tile them, I want to generate a bunch of unique 'chunks' (Noise maps) that connect to each other - I don't want any of them to be the same, I just want them to realize that "Hey, the guy next to me has a tunnel at the midway point - I should continue that tunnel"). Exactly like how Minecraft does it, but in 2d. \$\endgroup\$
    – Jon
    Commented May 12, 2012 at 1:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .