The first part of this project starts with the arguably simplest part - draw a
This morning I decided to embark on a project at the intersection of my interests: Maps, Fantasy, Algorithms, C++. This project is gonna have it all! I expect a generally slow pace as my primary commitment is my job. Like all good projects, this one will start with a desired outcome. This said outcome will then hopefully inform the high level components of my plan.
A program that can deterministically produce a fantasy map.
Since I want this to be somewhat interesting, I think the first version of a good fantasy map will be one that follows the following rules:
- The map must have water and land, the ratio of water to land must be a tuneable parameter.
- The map must have elevation, the variety of which must be a tuneable parameter.
- We must be able to visualize the finished map.
- Water must follows basic rules, such as always flowing downhill.
- Water can either be fresh or salt, or even simpler, lakes, rivers, and sea.
- Land must come in certain varieties that follows suit from the amount of water available, as well as the kind of water. To specify, lakes and rivers adjacent to land make it grassland or forest. Anything adjacent to the sea is beach. Lack of water access to land makes the land desert.
- Get OpenGL working on my Mac, see a window, draw some lines, a tiny proof of concept for visualization of simple geometry.
- Implement Fortune's Algorithm, this will be the basis for the underlying geometry of the world - a Voronoi Diagram.
- A few passes of LLoyd's Algorithm to relax the Voronoi Diagram.
- Randomly select a few places as elevation.
- Randomly place some water, having it "flow" towards areas of lower elevation.
- Change the labeling of the land and water depending on their adjacent terrain, as specified in the rules above.