Skip to content

terrain (mewo2)

terrain is Martin O’Leary’s procedural fantasy-map generator — a small browser tool that generates believable-looking river-and-mountain maps from a Voronoi-tessellated seed grid, using priority-queue-driven erosion, climate simulation, and a final labeling pass that places region names in legible positions. The accompanying blog post (linked from the README) is the canonical contemporary article on procedural fantasy cartography and has been cited by every subsequent terrain-generation project for the better part of a decade.

For KN-86 this is technique reference for any cart that needs to render generated maps or terrain (a faction-territory cart, a dispatch-route generator, a hypothetical wilderness-exploration cart). Not v0.1, but worth knowing about because the algorithms are small, the math is approachable, and the source is permissively licensed.

  • Procedural-generation algorithm reference. When KN-86 carts need to generate map-like content, terrain’s pipeline (Voronoi → relaxation → height noise → priority-queue erosion → coastline → rivers → political regions → label placement) is the right starting point. Each stage is small and intelligible.
  • Priority-queue-driven erosion specifically is the technique most worth lifting if KN-86 ever needs realistic-feeling generated maps. The algorithm is O(n log n) and produces results that look “drawn by hand” rather than “noise-textured.”
  • Label-placement pass. A frequently-overlooked detail of procedural-map rendering: where to put text labels. terrain solves it as a small optimization pass (find readable positions, avoid overlap, prefer flat regions). For KN-86 the same problem applies on the 80×25 grid — placing place-name labels on a generated map without overlapping terrain glyphs is its own small optimization problem; terrain is the reference.
  • MIT-licensed source. Genuinely usable. If KN-86 cart authoring wants a seed → map primitive in NoshAPI, terrain’s algorithms are the starting point.
  • The blog post is the better read than the code. Martin O’Leary’s notes (linked from the README) explain the why of each step, not just the what. Highly recommended reading for any cart author whose cart involves generated content.

MIT. Author explicitly says the project is unmaintained — code is freely usable, but no support upstream. For KN-86 that’s fine: the value is reference-grade, not actively-evolving-dependency-grade.

No image downloaded.

  • Not v0.1 KN-86. But worth a parking-lot citation when the first cart with generated map content gets scoped.
  • Cross-link game-programming-patterns.md — procedural generation is one of the natural homes for the patterns covered there (Object Pool for terrain tiles, Spatial Partition for region lookup).
  • Cross-link civilization-1991.md for the historical precedent of “DOS-era procedurally-generated map rendered on a text-mode grid.” Civ-1’s map gen is much simpler than terrain’s; terrain’s algorithm + Civ-1’s display discipline is a strong combination for a hypothetical KN-86 strategy / exploration cart.
  • Cross-link loopy.md for the single-author interactive-visualization sibling.