An adaption based on Polygonal Map Generation for Games based on http://www-cs-students.stanford.edu/~amitp/game-programming/
Install this library polymap
locally with pip
pip install -e .
The function polymap/new_map.py
creates a new map, it can be run from the command line with options like this:
python polymap/new_map.py --n_cells=1000 --seed=$rep --fname test_map --export='all'
The options for export
are:
json
export all polygons as a json file with name{fname}.json
image
export map as an image with name{fname}.png
all
export json and imageNone
(or anything else) return the graph and the list of terrains (for notebooks, inside algorithms, etc.)
The new_map has several different generation parameters exposed that can be accessed when calling the function from the within python or the command line:
n_cell
how many polygons to generaten_rivers
maximum number of rivers to generateocean_to_total_ratio
the amount of oceanlake_to_total_ratio
the amount of lake
Though has it is procedural all of these values (except the n_cell) are guidelines not hard constraints.
The script batch_map_gen.sh
generates a set of maps, you can set the parameters in this file or edit the defaults in new_map.py
. I created several different sets and uploaded them here.
I didn't do anything fancy to produce them in parallel, just runnning processes in the background -- for optimal performance only run as many at a time as you have cores.
Each polygon has a biome type assigned to it defined by the combination of moisture and elevation. As many of these as you want can be defind, I kept it simple. You can see how these are defined in polymap/custom_map.py
where I defined the graph.
-- Possible Terrains, lowest to highest --
* Dry
- Plains
- Hills
- Mountain
* Wet
- Forest
- Wooded Hills
- Mountain
* Ocean
- Deep Ocean
- Ocean
* Coast
- Coast
* Lake
- Lake
"""
- Python - version 3.7.3
- numpy
- scipy
- shapely
- matplotlib
- plotly
Project: finished