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.6.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.6-py3-none-any.whl (130.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyworldgen-0.1.6.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.6.tar.gz
Algorithm Hash digest
SHA256 25aba02f84179aa04d0eb3576b04120e4ab4da7bcb0e36d38eca174f1855f244
MD5 58bba5afa7f3a24148e5a81e807a2920
BLAKE2b-256 144ff767242cf643c466384906ea5d9036a87c7bef6211ddaad54a4a8deadf4b

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyworldgen-0.1.6.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.6-py3-none-any.whl.

File metadata

  • Download URL: pyworldgen-0.1.6-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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3dfd1032764241560d35f191b05fd667038c8f412cbbd85c4c011ab89984dc39
MD5 d4a4c3b2f6c6383fb0f4d3939fb49055
BLAKE2b-256 8a2858be41d2814c81eddc84060424f74ca12311a13cb6449639e7995d812ef0

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyworldgen-0.1.6-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