Skip to content

Repository files navigation

⛯ Divine Voxel Engine ⛯

A multi-threaded, renderer-independent voxel engine in TypeScript.
Build Minecraft-style voxel worlds and games that run in the browser.

npm version npm version npm version npm version

license stars Discord


DVE 1

Try the live demo  ·  Browse the Vlox demos  ·  Getting Started guide

Quick Start

Install the core, the Babylon renderer, and the Amodx suite:

npm install @babylonjs/core
npm install @amodx/suite @divinevoxel/vlox @divinevoxel/vlox-babylon

Then follow GETTING_STARTED.md to go from an empty project to generating and rendering a world.

Features

  • Renderer-independent core. The voxel engine lives in @divinevoxel/vlox and knows nothing about a specific renderer. Official renderers exist for Babylon.js (Classic and PBR shaders), with Three.js and WebGPU renderers in development.
  • Multi-threaded by design. Meshing, world generation, and world updates all run in parallel across web workers. Shared memory (SharedArrayBuffer) is on by default and can be turned off.
  • Fast meshing via precomputed rules. Voxel models are exploded into faces, and every culling and ambient-occlusion relationship is computed once at registration into flat lookup tables. At mesh time the hot loop is cheap array lookups against those tables.
  • JSON-driven model & geometry system. Describe voxel shapes as reusable geometry (boxes, quads, triangles) and wire them into models with JSON. AO, lighting, and culling are handled automatically. Reuse one model across many voxels, and expose many looks through the state (geometry) and mod (inputs) layers.
  • Rich voxel behavior. Sunlight and light propagation, liquid flow, level states, light-emitting voxels, transparency, and secondary voxels in a single cell (water-logged blocks and the like).
  • Effectively infinite worlds. A world simulation keeps sectors loaded around one or more moving generators, running each new sector through a fixed pipeline (generation → decoration → sunlight → propagation → build). Supports multiple generators and multiple dimensions.
  • Two-pass world generation. A simple brush API paints terrain in a generate pass and features (grass, trees, ores) in a decorate pass that can read back what was already placed.
  • Saving & archiving. Pluggable world storage (with an IndexedDB example) streams sectors in and out as the player moves, and an archiving API exports whole regions and templates to compact binary or human-readable JSON.
  • Runtime building. VoxelBuildSpace places and erases voxels in a live world, with raycast picking, oriented placement, bounded edit regions, and update hooks. Work with many voxels at once through templates and selections.
  • Flexible textures. Atlases with named tiles, per-id variations, animated textures, and an option to pre-compact everything into a single atlas + JSON.

Packages

Core

  • @divinevoxel/vlox — the renderer-independent voxel engine: data handling, meshing, lighting and flow, the JSON model system, the world simulation, and the archiving API.
  • @divinevoxel/vlox-babylon — the Babylon.js renderer for Vlox, with Classic and PBR shaders.

Game development

  • @dvegames/vlox — components for building games with Babylon.js and @divinevoxel/vlox.
  • @dvegames/vlox-tools — a library for creating tool panels for any @divinevoxel/vlox project.
Shared Memory Originally the engine was built to use SharedArrayBuffers but that caused some issues. You can now turn off shared memory usage like this:
import { StartRenderer } from "@divinevoxel/vlox/Init/StartRenderer";
//...
  const DVER = await StartRenderer({
    renderer,
    worldWorker,
    mesherWorkers,
    generatorWorkers,
    voxels: DVEVoxelData,
    memoryAndCPU: {
      useSharedMemory: false,
    },
  });

With useSharedMemory set to false you will only have access to world data in the World thread.

In Dev Packages These packages have not been worked on in a while and may be worked on in future if there is demand for them.
  • @divinevoxel/vlox-three

    • Renderer for DVE Vlox using Three.js, including Classic and PBR shaders
  • @divinevoxel/vlox-quantum

    • Custom renderer for DVE Vlox using WebGPU

Games & Demos

Crystalline Bliss

A 3D puzzle game with environments built using the engine.

Play on itch.io  ·  Buy on Steam

Crystalline Bliss 1 Crystalline Bliss 2

Divine Craft

A demo showing off biome-based infinite world generation.

Play in browser  ·  GitHub repo

Divine Craft 1 Divine Craft 2

Screenshots

Vlox Babylon

PBR

DVE PBR 1 DVE PBR 2 DVE PBR 3 DVE PBR 4 DVE PBR 5 DVE PBR 6

Classic

DVE Classic 1 DVE Classic 2 DVE Classic 3 DVE Classic 4 DVE Classic 5

Developing DVE (Monorepo Setup)

You only need the Quick Start above to build with DVE. The steps below are for working on the engine itself.

This project is a monorepo that holds all the Divine Voxel Engine packages and required libraries from Amodx. To initialize the project, run the following commands:

git clone https://github.com/Divine-Star-Software/DivineVoxelEngine.git
cd ./DivineVoxelEngine
git lfs pull
git submodule update --init --recursive
git submodule foreach git checkout main
git submodule foreach git pull
npm run init:all
npm install --workspaces=false
cd ./demos/Vlox
npm run start

Community

Join the Divine Star community to get updates: Discord.

See development videos on the Divine Star Software YouTube channel.

About

A multi-threaded, renderer-independent voxel engine in TypeScript. Build Minecraft-style voxel worlds and games that run in the browser.

Topics

Resources

Stars

264 stars

Watchers

10 watching

Forks

Releases

Used by

Contributors

Languages