Expand description
Procedural cave generation for the roxlap voxel engine.
Builds voxlap-format Vxl worlds from a Worley-noise + Perlin-
overlay classification scheme. The crate ships two presets
(BlueCaveGenerator, MagCaveGenerator) tuned to match
Ken Silverman + Tom Dobrowolski’s 2003 “Justfly” reference
screenshots (caveblue2m.jpg, cavemag3m.jpg).
§Pipeline
Generator::generateconsumesCaveParams(seed + shape knobs) and produces aVxl.- Internally, generators sample a dense
(VSID × VSID × MAXZDIM)voxel mask + colour grid via Worley distance classification + Perlin overlay. pack_dense_grid_to_vxlfolds the dense grid into voxlap’s slab-RLE column format — much faster than feeding voxels through theset_spansedit pipeline for whole-world creation.
Structs§
- Blue
Cave Generator - Blue-cave preset matching Ken’s
caveblue2m.jpg. - Cave
Params - Parameters for the procedural cave generators.
- MagCave
Generator - Magenta-cave preset matching Ken’s
cavemag3m.jpg. - Perlin
Noise3D - 3D Perlin noise sampler with a deterministic permutation table.
- Seed
- One Worley seed point.
- Vxl
- Parsed
.vxlmap. Round-trips byte-equally viaparse+serialize.
Constants§
- MAXZDIM
- Voxlap’s
MAXZDIM(voxlap5.h:10) — world height, one byte per z value → 256 voxels.
Traits§
- Generator
- Procedural world generator. Implementors produce a
VxlfromCaveParams(or their own typed parameter struct).
Functions§
- classify_
voxel - Classify a single voxel as solid (
true) or air (false) against the seed set. The voxel position(x, y, z)is in integer voxel coordinates. - classify_
voxel_ with_ perlin - Like
classify_voxelbut adds a Perlin-noise overlay to the distance-to-air-seed term. Voxel is air iffd_air + overlay < d_solid, whereoverlay = perlin_amplitude × fbm(x, y, z, octaves) × PERLIN_VOXEL_SCALE. - pack_
dense_ grid_ to_ vxl - Build a
Vxlfrom a dense voxel-mask + colour grid. - place_
seeds - Place
params.seed_countdeterministic random seeds across thevsid × vsid × MAXZDIMvolume. The firstparams.air_ratio × params.seed_count(rounded) are tagged air; the rest solid. - worley_
classify_ grid - Build the dense
(VSID × VSID × MAXZDIM)solidness grid by classifying every voxel against the seed set. Output: 1 byte per voxel; non-zero = solid.