Skip to content

BaSaBu1/Map-Generation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Procedural Terrain Generator

Voronoi-based terrain generator with biome coloring, river networks, and texture export for 3D rendering.

Built for MATH 437 - Computational Geometry (Batsambuu Batbold, December 2025).

The blog post: https://basabu1.github.io/Map-Generation/

The 2D demo: https://basabu1-map-generation-app-fut9qy.streamlit.app/

Features

  • Geometry - random points → Lloyd relaxation → Delaunay triangulation → Voronoi regions
  • Elevation - multi-octave Perlin noise with land-anchor distance falloff; supports random or custom anchor placement
  • Biomes - 10 biomes (altitude x moisture lookup) with Gaussian-blended transitions
  • Rivers - priority-flood drainage routing, two-pass selection (main rivers + tributaries)
  • Export - 16-bit heightmap, colormap, and river mask

Quick start

pip install -r requirements.txt

Python 3.10+ required.

Usage

Desktop viewer

python main.py

Sliders for seed, noise scale, water level, and land centers - instant preview.

Web app

streamlit run app.py

Same controls in a browser UI with random/reset buttons, custom anchor presets, and caching.

CLI export

python export.py

Reproducible export example:

python export.py --seed 123 --points 50000 --resolution 4096 --water-level 0.35 --noise-scale 4.0 --land-centers 5

Export outputs

Written to outputs/ by default:

File Description
heightmap.png 16-bit grayscale elevation
colormap.png RGB biome texture with rivers
rivermap.png Grayscale river mask for shaders

Project layout

Path Purpose
map.py Terrain model - geometry, biomes, hydrology, texture export
main.py Desktop Matplotlib viewer with parameter sliders
app.py Streamlit web UI
export.py CLI texture exporter
lloyd/ Vendored Lloyd relaxation library
Delaunator-Python/ Vendored Delaunay triangulation library
report/ Quarto report source and figures

References

About

Capstone Project, MATH 437, Fall 2025, Macalester College

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors