Builtin Library
readme.md
Voxel Engine Demos
Runnable scenes that exercise every feature of the voxelEngine. Each demo is a .scene/ with scene.json + entrypoint.luau. Load from a running engine:
layers.load("@builtin::~voxelEngine.demo.<name>")
Demos
| Scene | Features demonstrated |
|---|---|
showcase | Hillside village — chunked VoxelWorld terrain with stone/dirt/grass layers + lake + sand beach + two grassy hills. Hero props (windmill, 3 houses, trees, rocks) loaded from pre-baked voxbins. Windmill blades rotate each frame around the hub via pivot="center". |
sedan | High-resolution 16-piece car composite with articulated doors, steering wheel, spoiler. Door opens via runtime child-transform override + :commit(). Demonstrates pivot presets for hinge rotation. |
office | Office workspace (15 prop templates). Demonstrates large-scene authoring, template live-link, and the linked_workstation composite manifest. |
world_terrain | 64×20×64 chunked VoxelWorld with multi-octave procedural heightmap, water level, sand/grass/snow biomes, and a runtime setBlock path carved across the middle. Exercises chunked rebuild and :flush(). |
destruction | Physics-enabled voxel blocks stacked into a tower, plus an exploded car with dynamic children. A heavy projectile is launched at the tower on load. Exercises Compound colliders on VoxelShape children + impulse forces. |
Templates ship with the demos
templates/showcase/— hillside village hero props:windmill_base.voxbin,blade.voxbin,house.voxbin,tree.voxbin,rock.voxbin. Authored interactively viaV.createShape+saveAsTemplatein a running engine.templates/vehicles/— sedan body + wheels + accessories (cabin, chassis, door, spoiler, steering_wheel, windshield, etc.)templates/office/— desk, chair, monitor, keyboard, mug, plant, bookshelf, printer, whiteboard, cabinet, lamp, clock, trash, bot_seated, bot_standingtemplates/office/linked_workstation.voxcomp— composite manifest referencing desk + monitor + keyboard + mug
How the demos find the templates
Each demo's entrypoint.luau re-points paths.templates to the demo's own template folder during onLoad(), and restores the default during onUnload():
local V = require("@builtin::~voxelEngine.voxelEngine")
local PREV_PATH = nil
function onLoad()
PREV_PATH = V.configGet("paths.templates")
V.configSet("paths.templates", "/source/libs/@builtin/systems/voxelEngine.package/demo/templates/vehicles")
-- ... spawn entities that reference templates by name
end
function onUnload()
if PREV_PATH then V.configSet("paths.templates", PREV_PATH) end
end
What each demo proves
| Feature | Covered by |
|---|---|
V.createShape + paint | showcase |
V.createWorld + chunks + setBlock | showcase |
V.fromTemplate | sedan, office, showcase |
V.stamp mode="instance" + rotation | showcase |
V.stamp mode="merge" + 90° rotation | showcase |
V.composite.new + :explode | sedan |
Articulated child override + :commit() | sedan (door opens, survives scene round-trip) |
Pivot presets ("bottom", "left", "center") | sedan (wheel/door hinges) |
| Live-link template edit propagation | office (edit a prop voxbin, all instances update) |
Saved .voxcomp manifest (linked) | office (linked_workstation) |
Saved .voxbin from composite (baked) | office (linked_workstation_baked) |
| Large chunked VoxelWorld (64×20×64) | world_terrain |
| Procedural heightmap + biomes | world_terrain |
Runtime setBlock + :flush() | world_terrain |
| Dynamic physics on VoxelShape | destruction (tower + exploded car) |
| Compound collider children under impulse | destruction (projectile knocks tower) |
| Physics-enabled composite children | destruction (car doors / wheels pop off) |
Features not yet in these demos
- Custom per-voxel attributes — the voxbin format currently stores only palette indices per cell. User-level attributes (HP, material tag, damage state) would need a parallel attribute stream; tracked in the roadmap, not yet implemented.