Giter Site home page Giter Site logo

polyworld's Introduction

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.