/stepped-landscape

Procedural landscape generator that looks like godus. Kind of.

Primary LanguageC#

Stepped landscape generator

A procedural generated stepped landscape based on irregular polygons tiling. This approach gives us pleasant shapes that avoid the ugly squareness nature of using a distorted rectangular grid solution.

SS1

Algorithm

  1. A voronoi diagram is generated though a random set of points.
  2. The cells of the diagram are given a height set by Perlin noise. If the cliffs bool is set on the MapGenerator class then we switch from two Perlin noise maps through the value of a third noise map.
  3. The diagram cells are turned into a mesh through triangulation. It really helps that these cells are always convex
  4. Walls are added from the voronoi cell sides. The walls go down to the bottom of the scene.
  5. Trees are added on the positions of the set of points of Step 1 (at random + not under water + not on the snowy parts). Trees are set through the forests bool on MapGenerator

Dependencies you will need

Sorry for not adding everything needed to make this work :(

  • SharpVoronoiLib library: You will need to add to your project the SharpVoronoiLib repo to make the project work.

  • Missing tree asset: To show trees you will need to add a tree prefab to your unity project. The ref to that asset should be given to the Forest class. Because I am using one that's not free I cannot add it to this repository. For the screenshots I am using Tree6.006 from here.

Acknowledgements

Some of the stuff in this repo comes from other devs: