- Home /
How would one approach tile-by-tile terrain generation with Perlin Noise?
Recently a number of friends and I have been working on a top-down, 2D military company management game (think Rimworld, Prison Architect), and we've gotten to the point where we need to start on terrain generation and we're completely stumped.
After a bit of research I've decided that the most standard way to generate said terrain would be through Perlin Noise, which works well for us, however we can't seem to grasp how Mathf.PerlinNoise works, nor do we think the noise it generates looks very smooth, so instead we're looking more at the LibNoise.Unity library.
Almost all of the examples for this library are for heightmap generation and the like (with one exception, which was an unanswered topic of someone having this exact same question), nor have we been able to find any clear documentation on how we would implement the following basic terrain generation system:
(I know the term 'pixels' for a set of Perlin Noise values isn't strictly correct, bear with me)
Generate a*a pixels of a random(!) sample of Perlin Noise, one for each tile in the game.
If a value of a pixel is >0.75, for example, that tile becomes rubble/destroyed vehicles/impassable barriers.
Repeat step 1 for a new set of Perlin Noise, then for each value that is >0.75, that tile becomes water.
Repeat step 1 for a new set of Perlin Noise, for each value that is >0.75, that tile becomes solid rock.
Repeat these steps for however many different things you need to have.
Anything else becomes grass.
In the end, it would look something like this (rough drawing, technically the rocks and water and such should be uniformly offset but I didn't take the time to line them up with the grass)
Could anyone point us to any examples that cover this sort of thing, or if not, any reasonably comprehensible documentation for someone new to terrain generation? Any snippets that might help us are highly appreciated, as are any tips on how we could improve this system.
Cheers!
To make perlin noise change at a slower rate, take samples from a smaller area. For instance, for location x,y try using $$anonymous$$athf.PerlinNoise(x/16, y/16) ins$$anonymous$$d of $$anonymous$$athf.PerlinNoise(x, y)
Your answer
![](https://koobas.hobune.stream/wayback/20220613184206im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
2D Efficient Realtime Terrain Generation 0 Answers
How exactly is Perlin Noise implemented? 4 Answers
Terrain and PerlinNoise Glitch 0 Answers
How can I generate terrain as integers using perlin noise? 1 Answer
Procedural Island Terrain Generation 2 Answers