Skip to main content

TerraForge v1.6.2 🗺️

Procedural Biome/Island, Town & Dungeon Map Generator using Simplex Noise

TerraForge is a versatile Python toolset for procedural map generation.

It includes tools for creating noise-based biome maps, procedural town layouts, and multi-level dungeon layouts...


🚀 Features

🌍 Biome Generator (TerraForge)

  • Elevation, Moisture, and Temperature map generation
  • Supports single and clustered multi-island generation
  • Falloff support: Radial, Edge, or None
  • Parameters for island spread, spacing, scale, and strength
  • Biome mapping based on environmental conditions (supports both visual colors and logic-driven biome data)
  • Outputs high-resolution PNG images
  • JSON preset import/export for reuse in games

🏰 Dungeon Generator (DungeonForge)

  • Multi-level dungeon generation (3D stack of floors)
  • Procedural room placement and corridor carving
  • Up/down stairs for vertical navigation
  • Console-based movement demo included
  • Optional PNG export per dungeon level
  • Tile color customization for export
  • JSON preset import/export

🏘️ Town Generator (TownForge)

  • Procedural town generation
  • Configurable building types and quantities
  • Randomized building sizes and placement
  • Overlap prevention with configurable spacing
  • Configurable edge padding
  • Randomized door placement
  • Configurable door sides and inset spacing
  • Building metadata access helpers
  • Optional building label rendering
  • PNG export support
  • Deterministic generation using seeds

📦 Requirements


📦 Installation

You can install TerraForge using pip.

pip install terraforge-core

🧪 Demos

Biome Map Generator

Run the included demo script:

python demo.py

The generated maps will be saved as biome_map, elevation_map, moisture_map, temperature_map, (noise_type)_map.

Dungeon Map Generator

Run either the included dungeon_demo script or dungeon_demo1 script.

python dungeon_demo.py

Console based demo with movement.

python dungeon_demo1.py

Generates .pngs for each dungeon level.

Town Map Generator

from townforge import TownForge

generator = TownForge(
	map_size=300,
	image_size=None,
	seed=None,
	building_padding=4,
	map_edge_padding=5,
	door_inset=1,
	door_sides=("north", "south", "east", "west"),
)

town_map = generator.generate()

generator.export_town_map_image(
	output_dir=".",
	show_building_names=False,
)

This generates a procedural town map and exports it as a PNG image.


🚀 Usage - TerraForge (Biome Maps)

from terraforge import TerraForge

generator = TerraForge(map_size=300, image_size=(600, 600))

generator.generate(output_dir="maps")

🔁 Preset Workflow

generator.export_preset("world_preset.json")

generator.import_preset("world_preset.json")
generator.generate("maps")

🧩 Biome Schema (Presets)

Biomes are stored as a list of objects. Each biome requires:

  • color (hex string)
  • rules (dict of noise_type -> [min, max])

Optional (recommended for tools like TerraForge Studio):

  • id (unique string per biome)
  • name (display name)

Example biome:

{
  "id": "forest",
  "name": "Forest",
  "color": "#3E7C3C",
  "rules": {
    "elevation": [0.4, 0.6],
    "moisture": [0.5, 1.0]
  }
}

Notes:

  • id is optional, but if provided it must be unique within the preset.
  • Rule ranges must satisfy min <= max.

🧠 Accessing Biome Data

Each tile now stores full biome data instead of just a color.

biome = generator.get_biome(x, y)

print(biome["id"]) # logic (e.g., "forest", "ocean")
print(biome["name"]) # display name

To get the visual color of a tile:

color = generator.tile_color(x, y)

⚠️ Update (v1.4.0)

  • biome_map now stores full biome dictionaries instead of hex color strings
  • Use tile_color(x, y) to retrieve the visual color
  • Use get_biome(x, y) for biome data and game logic
  • PNG export behavior remains unchanged

🚀 Usage - DungeonForge (Dungeons)

from dungeonforge import DungeonForge

generator = DungeonForge()

dungeon_map = generator.generate()

🔁 Preset Workflow

generator.export_preset("dungeon_preset.json")

generator.import_preset("dungeon_preset.json")
generator.generate()

🚀 Usage - TownForge (Towns)

from townforge import TownForge

generator = TownForge()

town_map = generator.generate()

generator.export_town_map_image()

🧠 Accessing Building Data

building = generator.get_building_at(x, y)

print(building["name"])
print(building["type"])

You can also retrieve buildings by their door tile:

building = generator.get_building_by_door(x, y)

⚙️ Customization Options

Biome Generator

Edit the values in terraforge.py or the demo to control:

  • map_size and image_size

  • falloff type: "radial", "edge", or None

  • num_islands, island_spread, min_island_spacing

  • noise types (elevation, moisture, temperature)

  • biome_thresholds for noise types (elevation, moisture, and temperature)

Dungeon Generator

  • Map size (width, height)
  • Number of levels (z_levels)
  • Maximum rooms and room size constraints
  • Tile symbols and export colors
  • Specify which levels to export (levels=[0, 2])

Town Generator

  • Map size
  • Image size
  • Building spacing/padding
  • Map edge padding
  • Door placement rules
  • Door inset spacing
  • Building types
  • Building quantities
  • Building sizes
  • Building colors
  • Ground color
  • Door color
  • Outline color
  • Building label rendering
  • Random seeds

TerraForge Studio

Screenshot (583)

A GUI tool built on top of the TerraForge library that allows you to quickly generate multi-level dungeons for games, prototypes, and tabletop use.


  • CQCalendar: A lightweight, tick-based time/calendar/lunar cycle system for Python games and simulations.
  • MoonTex: A procedural moon texture generator for Python that creates stylized, noise-based moon phase images.

Metadata

Release files for terraforge-core 1.6.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for terraforge-core 1.6.2
File Size Uploaded Provenance Actions
terraforge_core-1.6.2.tar.gz 17.5 kB Without provenance Details for terraforge_core-1.6.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for terraforge-core 1.6.2
File Interpreter ABI Platform Actions
terraforge_core-1.6.2-py3-none-any.whl Python 3 none any Details for terraforge_core-1.6.2-py3-none-any.whl

Total release size: 34.4 kB

Release files / terraforge_core-1.6.2.tar.gz

Download URL terraforge_core-1.6.2.tar.gz
Size 17.5 kB
Tags Source
SHA-256 checksum
How to use checksums
b13f8679a263f04547ddb7285644016490ec7b1e905e49b65addeb9aff01b2b6
BLAKE2b-256 checksum
How to use checksums
fe8bb8a96c6f2070805d997e8c988ad3fc0cde8eede738f20099f3542fb34417
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release files / terraforge_core-1.6.2-py3-none-any.whl

Download URL terraforge_core-1.6.2-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2379b146ccfee097d93ec37d8bb6027e3ef024039ac2830466778ad837a8ec4d
BLAKE2b-256 checksum
How to use checksums
da1681c5d3656877614434077e89b1f8a979bcded295b77edf2095f007b80fdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Security for terraforge-core 1.6.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page