Maps of fantasy lands in movies and books, as well as a similar project that I ran across

What it does

Randomly distributes seed points across a plane and builds a voronoi diagram from these points. Each pixel in a cell is closest to the seed of that cell than any other seed points. Finds centroid of each cell and makes that the new seed for the next iteration of the diagram. This relaxation allows for a more uniform shape of cells. Then it finds the most central cell and makes that the top of the mountain (white) and cells further from the center are populated with forests (green)

How I built it

Using python, pygame, and a lot of trial and error

Challenges I ran into

Manipulating the pixels using their coordinates and associating the large amount of pixels with each cell object

Accomplishments that I'm proud of

Writing my own algorithm for the Voronoi diagram.

What I learned

How to use pygame, the importance of good algorithms, importance of abstraction, manipulation of large data sets

What's next for Voronoi Map

Make the island more randomly shaped, increase efficiency of the algorithm, allow for water on the island

Built With

Share this project: