2
\$\begingroup\$

I am very new to game development but I was able to scour the internet to figure out Perlin noise enough to implement a very simple 2D tile infinite procedural world.

Here's the question and it's more conceptual than code-based in answer, I think. I understand the concept of "I plug in (x, y) and get back from Perlin noise p" (I'll call it p). P will always be the same value for the same (x, y) (as long as the Perlin algorithm parameters haven't changed, like altering number of octaves, et cetera).

What I want to do is be able to zoom into a square and be able to generate smaller squares inside of the already generated overhead tile of terrain.

Let's say I have a jungle tile for overhead terrain but I want to zoom in and maybe see a small river tile that would only be a creek and not large enough to be a full "big tile" of water in the overhead. Of course, I want the same net effect as a Perlin equation inside a Perlin equation if that makes sense? (aka. I want two people playing the game with the same settings to get the same terrain and details every time).

I can conceptually wrap my head around the large tile being based on an "zoomed out" coordinate leaving enough room to drill into but this approach doesn't make sense in my head (maybe I'm wrong). I'm guessing with this approach my overhead terrain would lose all of the cohesiveness delivered by the Perlin. Imagine I calculate (0, 0) as overhead tile 1 and then to the east of that I plug in (50, 0). OK, great, I now have 49 pixels of detail I could then "drill down" into. The issue I have in my head with this approach (without attempting it) is that there's no guarantee from my Perlin noise that (0,0) would be a good neighbor to (50,0) as they could have wildly different "elevations" or p/resultant values returning from the Perlin equation when I generate the overhead map.

I think I can conceive of using the Perlin noise for the overhead tile to then reuse the p value as a seed for the "detail" level of noise once I zoom in. That would ensure my detail Perlin is always the same configuration for (0,0), (1,0), etc. ad nauseam but I'm not sure if there are better approaches out there or if this is a sound approach at all.

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

I believe the process you're talking about is something like a fractal landscape. Fractals allow infinite zoom. Perlin noise, without modification, is not appropriate for a fractal. You also typically want some minimum level of detail when dealing with landscape. Natural landscape doesn't really follow a fractal because the large scale landscape shape is defined by things like tectonic plate movement, glaciers, rivers and such. While the small scale features are defined by weather, erosion and such.

As for ensuring that zoomed out neighbors are good fits for each other. You just need to blend between values. Look into LOD (level of detail) algorithms to see how they work. This is essentially what you would implement for zooming out.

\$\endgroup\$
3
  • \$\begingroup\$ Aha! knew I was searching the wrong thing. OK cool. Thanks for the detail as it may help others as well. I don't think I would need any blending/lerping for my scenario (yet) as I'm using very static 50x50 tiles. So long as the initial view makes sense, mountains bordered by hills, water by coastline or plains, etc. I'm cool (for my uber-basic implementation). But the fractal approach appears to be what I'm after thanks! \$\endgroup\$ Nov 12, 2012 at 16:06
  • \$\begingroup\$ Byte56, is there any reason I couldn't apply the diamond-square algorithm after I have my 4 points of Perlin noise data for each corner? I would have to alter my initial approach as currently I have (x,y) = tile so I only hold 1 value of perlin noise per tile vs. 4. Does that sound like a reasonable first-timer approach? \$\endgroup\$ Nov 12, 2012 at 16:15
  • 1
    \$\begingroup\$ Midpoint displacement (via the diamond-square algorithm) is an excellent way to create detailed landscape. Especially when you want the edges to match up without much work. \$\endgroup\$
    – House
    Nov 12, 2012 at 16:18

You must log in to answer this question.

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