Skip to main content

Deterministic procedural world generation: biomes, noise, roads, and smooth multi-biome composition.

Project description

pyworldgen

A unified, deterministic procedural biome-generation library. A seed plus parameters is the world — voxel grids, meshes, point clouds and saved chunks are all regenerable views of that compact source.

What's in it

  • Biomes — implicit caves, Voronoi forests, river landscapes, and a neutral flat terrain.
  • Composition — blend several biomes into one coherent world with smooth transitions.
  • Roads — weighted anisotropic least-cost paths (Galin et al. 2010) over any terrain, with bridges and terrain grading.
  • Chunked voxel world — block storage, generation-pass scheduler, streaming, deferred edits, sunlight.
  • Geometry views — voxel meshers, surface point-cloud sampling with farthest-point downsampling, OBJ / MagicaVoxel .vox / PLY / XYZ export.
  • Rendering — pure-numpy pinhole camera and software renderer, plus PyVista and matplotlib backends, with PNG / GIF / MP4 output.
  • Spatial toolkit — spatial hash grid, BVH, KD-tree, R-tree, quad/octree, voxel DDA, graph + Dijkstra, farthest point sampling.

Everything shares one cross-language deterministic hash, so the same seed reproduces the same world bit-for-bit across Python, JavaScript and GLSL.

Quick start

import pyworldgen as bf

bf.list_generators()
# ['composite', 'flat', 'forest', 'implicit_cave', 'landscape', 'roads']

forest = bf.generate("forest",        seed="grenoble",   target_tree_count=60)
cave   = bf.generate("implicit_cave", seed="luxembourg", length=90.0)
land   = bf.generate("landscape",     seed="rhine")
world  = bf.generate("composite",     seed="atlas")

Export a biome as voxels, mesh, and a downsampled point cloud:

from pyworldgen.mesh import volume_to_mesh
from pyworldgen.pointcloud import sample_mesh_surface
from pyworldgen.io import volume_to_vox, mesh_to_obj, write_ply

volume_to_vox("cave.vox", cave)
mesh = volume_to_mesh(cave)
mesh_to_obj("cave.obj", mesh)

cloud = sample_mesh_surface(mesh, 40_000, seed=1)
write_ply("cave_points.ply", cloud.farthest_point_downsample(4_096))

Render a turntable fly-through:

import pyworldgen.rendering as rr

frames = rr.render_turntable(cloud, n_frames=48, elevation=18)
rr.save_gif(frames, "cave_orbit.gif", fps=20)

Installation

pip install -e .          # runtime
pip install -e ".[dev]"   # + pytest

Runtime dependencies: numpy, scipy, fpsample, matplotlib, pillow, imageio, pyvista. Optional extras: [viz] (scikit-image) and [geometry] (shapely, trimesh, mapbox-earcut).

Visualization scripts

python scripts/visualize_all.py --quick --out sample_visualizations
python scripts/render_biome.py composite --seed atlas --quick

Where to look next

  • algo_specs/ — per-biome algorithm specs (cave, landscape, tree, flat).
  • CITATIONS.md — paper-level references per source file.
  • Module docstrings (pyworldgen.biomes.*, pyworldgen.roads, pyworldgen.compose, pyworldgen.noise, …) — the authoritative description of each layer, including scope and honest gaps versus the cited papers.
  • tests/ — invariants and reproducibility checks worth reading as usage examples.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyworldgen-0.1.8.tar.gz (116.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyworldgen-0.1.8-py3-none-any.whl (130.3 kB view details)

Uploaded Python 3

File details

Details for the file pyworldgen-0.1.8.tar.gz.

File metadata

  • Download URL: pyworldgen-0.1.8.tar.gz
  • Upload date:
  • Size: 116.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pyworldgen-0.1.8.tar.gz
Algorithm Hash digest
SHA256 d80592baf4a610966e51c00037952abfb06b32b14ca56c8f7098558271a0d95d
MD5 2bf6a85889c6e1d6cd8dd9a6a88e5759
BLAKE2b-256 80c8dac833f8c14262e81a555889fb484111ac7713ebf141a73b6220481c8405

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyworldgen-0.1.8.tar.gz:

Publisher: publish.yml on mmkuznecov/pyworldgen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyworldgen-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: pyworldgen-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 130.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for pyworldgen-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 5e6f4be8d3c026692be05f6ae1d37079ef00285864fbb6cf61c29b661498480d
MD5 a829b38e8f7acc77c0bcdb019427c2e8
BLAKE2b-256 72853cc190e339a4f7536ed0b072bd61726c633e27be963d8fd4a6d9edd8186e

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyworldgen-0.1.8-py3-none-any.whl:

Publisher: publish.yml on mmkuznecov/pyworldgen

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page