Skip to content

Latest commit

 

History

History
49 lines (26 loc) · 2.43 KB

README.md

File metadata and controls

49 lines (26 loc) · 2.43 KB

PolyWorld

This is a polygon-based world generating module. It is based on the map generating algorithm by Amit Patel of Red Blob Games.

image1

The basic idea is to tesselate the terrain (using Fortune's algorithm) into a set of polygons. Currently, only island worlds are supported. An island world is created as follows:

Step 1: Since the terrain is infinite, it needs to be partitioned into finite areas first:

step1

Step 2: The area is tesselated into polygons. The algorithms behind this are approximate Poisson disc sampling to generate a well-behaved set of sampling points, Fortune's algorithm to compute the initial Voronoi diagram and Lloyd's relaxation to regularize the polygon shapes.

step2

Step 3: Based on a random noise function such as Perlin noise, water and land vertices are defined. Starting at the border of the rectangle, the height of the island increases towards the center. Lake areas are flattened afterwards.

step3

Step 4: Since the elevation gradient is monotonously increasing, rivers can start at any corner of the map, flow downhill and always reach either a lake or the ocean.

step4

Step 5: Based on height and the distance to rivers, a map of moisture is generated.

step5

Step 6: Each of the regions is assigned to exactly one biome as defined by Whittaker.

step6

Step 7: Each of the biomes has its unique distribution of flowers, mushrooms and other small plants.

step6

Step 8: Same goes for different tree types.

step8

Acknowledgements

This module is loosely based on the Java implementation by Connor Clark.

License

This module is licensed under the Apache 2.0 License.