1
\$\begingroup\$

I've been doing a bunch of research regarding procedural 2d terrain generation and have come to the conclusion that the use of perlin/simplex noise seems to be the way to go for most things.

I've copied the code from opensimplex noise and generated some noise, but I'm not really sure what to do with that? How can I take this noise and use it to create terrain similar to games like Diablo2 or Path of Exile? Things placing trees and rivers, etc.

Also, would it be possible to use this to create simple tiles for my game? Say I wanted to create a bunch of different grass tiles(Isometric), would I be able to do this?

EDIT: So I've tried the following code to try and generate some natural looking rock placements and I'm not quite sure I understand how it's working. I've used the condition value < .1 for placing a rock, but the world seems to be full of rocks. Am I doing something wrong, or am I just not understanding how it's supposed to work?

    private void populateObjects(TileLoader tileLoader)
    {
        OpenSimplexNoise noise = new OpenSimplexNoise();

        for (int i = 0; i < layers[1].layerData.GetLength(0); i++)
        {
            for (int j = 0; j < layers[1].layerData.GetLength(1); j++)
            {
                double value = noise.Evaluate(j, i);
                if(value < .1)
                    layers[1].layerData[i, j] = tileLoader.getTileByName("grassrock");
            }
        }
    }

Here's a screenshot of something this produced: enter image description here

\$\endgroup\$
  • \$\begingroup\$ This question is incredibly broad and falls in the category of "How to get started". Going from noise data, to diablo2 is quite a leap. Anyways, you will need to narrow the focus of this question in order to get a valid answer. \$\endgroup\$ – jgallant Nov 1 '16 at 10:08
  • \$\begingroup\$ Try breaking this down one element at a time. For instance, you describe placing rivers. What should rivers look like in your game? Are they 1 tile wide, or bigger? Can they meander or are they straight? Do you want one cutting your level in half as an obstacle, or a network of tributaries following the elevation/erosion of the tile terrain? Do they have a flow direction? Are they paths the player/AI need to be able to navigate by swimming/boat? These types of questions lead to what kind of generation to use — there's no single "river generator" that's best for all games. \$\endgroup\$ – DMGregory Nov 1 '16 at 13:04
  • \$\begingroup\$ Noise is the most common ingredient but there are lots of different ways to use it, and not all systems use noise. The Path of Exile developers have a video describing how they generate terrain and rivers. Trees are often placed with “blue noise” instead of perlin/simplex noise. \$\endgroup\$ – amitp Nov 1 '16 at 17:24
  • \$\begingroup\$ Jesse, I found this link which may help you. It briefly explains how to go from noise to terrain. \$\endgroup\$ – Roflo Nov 1 '16 at 18:54
  • \$\begingroup\$ Sorry for the extremely broad question, I wasn't sure exactly what I was wanting to ask and was mostly looking for a nudge in the right direction. For now I'll look at placing rocks/trees in a plains type of biome. I'll give that a shot using the links provided by amitp and roflo. I've seen that Path of Exile video before, but it may be time to revisit it and see what I can take from it now. Thanks for the suggestions guys. \$\endgroup\$ – Jesse Nov 1 '16 at 22:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.