Contact

Type to explore Drawk studio productions

Discover cross-platform games, mobile apps, architecture articles, and interactive GLSL labs.

← Back to Posts

Building a Custom Voxel Engine & Dusk Synth: 26-Iteration Dev Log and Roadmap

TL;DR: Over 26 focused build iterations since late October, we built a standalone C++17 voxel engine behind a plain C ABI, wrapped it in pure C# runtimes and a thin Unity adapter, styled six distinct worlds purely from JSON data, and shipped the first story-driven gameplay loop in our game Dusk Synth. Here is the honest dev log of what works today, the measured numbers, and the iteration roadmap ahead.

Dusk Synth - Dev Milestone (Iter 26) World 1 of 6: dusk-synth
A voxel city avenue at sunset with a striped sun at the end of the street, neon windows in pink, cyan and amber, and glowing road lines
Dusk Synth: a vaporwave avenue locked in eternal golden hour, driven by one JSON style document running on top of our C++17 voxel core.

The Premise: Build the Core Once, Data-Drive the Worlds

Voxel games spend almost all of their budget in tight loops over 32 x 32 x 32 chunks: greedy meshing, chunk streaming, raycasts, terrain generation, and colored light flood-fills. Writing two separate copies in C++ and C# doubles maintenance and creates subtle drift. Keeping those loops locked inside one game engine makes portability painful later.

Our rule from iteration 1 followed the same boundary we use in multi-engine architecture: put the hot math and world state in one dependency-free C++17 library behind a flat C99 ABI, then put pure C# bindings, deterministic gameplay state, and thin engine adapters on top. We pair that with zero-allocation C# patterns on the Unity side so per-frame updates never stall the render loop.

flowchart TD subgraph DATA["Data Contract (Versioned JSON + Binary Regions)"] J["Styles, blocks, terrain, prefabs, POIs, items (JSON) + VXR1 LZ4 chunks"] end subgraph CORE["C++17 Voxel Core + C99 ABI"] C["32^3 palette chunks, greedy AO mesher, RGB block light, DDA raycast, streamer"] end subgraph LOGIC["Pure C# Bindings & Gameplay Runtime"] L["IDisposable ABI wrappers, PoiWorld sequences, items & inventory (fixed timestep)"] end subgraph ADAPTER["Unity Engine Layer"] U["Advanced Mesh API renderer, shaders, visor flashlight, avatar controller, reactive synthwave audio"] end DATA --> CORE CORE --> LOGIC LOGIC --> ADAPTER

Everything visual and interactive lives in versioned documents (voxel-blocks.v1, voxel-volume.v1, voxel-terrain.v1, voxel-style.v1, voxel-pois.v1, voxel-items.v1), so creating a whole new biome or encounter means authoring JSON rather than branching engine code. Every change in C++ is checked against golden test vectors and a standalone Python oracle so bit-exact bugs show up as failing numbers before anyone opens an editor.

Six Worlds From One Generator

The strongest payoff of keeping styles out of engine code showed up in iterations 20 through 22. Swapping a single JSON style document transforms the same generator and prop placement rules (roof, lot, facade, sidewalk, scatter, lift, footing, submerge) across six completely different moods:

Data-Driven Biome World 2 of 6: rural-canyons
Voxel desert canyon with red, orange and cream rock strata, a river at the bottom, and trees and rock formations on the mesa
Rural Canyons: ridged-noise canyon carving (52 voxels deep), warped rock strata, saguaros, mesas, windmills, and dusty golden light.
Data-Driven Biome World 3 of 6: sky-islands
Grassy voxel peak above a sea of cloud with marble ruins, trees, and floating islands in a pink sky
Sky Islands: translucent cloud seas, suspended islands using lift rules, waterfalls, rope bridges, and marble ruins.
Data-Driven Biome World 4 of 6: sunken-coast
Half-drowned weathered voxel towers standing in shallow turquoise water at a peach and coral sunset
Sunken Coast: weathered towers and seabed props placed with footing and submerge: "only" rules under a low coral sun.
Data-Driven Biome World 5 of 6: frozen-arcology
A stepped voxel arcology with lit windows over a snowfield at night under a green aurora sky
Frozen Arcology: carved ice valleys, underground caves, warm lit megastructures, falling cube snow, and a green-violet aurora night cycle.
Data-Driven Biome World 6 of 6: jungle-ruins
A mossy stepped voxel temple covered in vines, surrounded by jungle trees and ferns in green haze
Jungle Ruins: vine-draped step pyramids, river channels, dense green height fog, strangler figs, glowing fireflies, and floating embers.

The 26-Iteration Dev Log

We run development in focused, short-context iterations backed by structured handoffs (the same discipline covered in Thread Cost and Context Window Compression). Here is how the project moved from an empty chunk grid to playable objectives:

Iterations Dates What Shipped
Iters 1-4 Oct 27 - Oct 30 Standalone C++17 core (32^3 palette chunks, AO-safe binary greedy mesher, DDA raycast, deterministic terrain, golden vectors + Python oracle), C99 ABI, C# bindings, LZ4 VXR1 region persistence, Unity Mesh.SetVertexBufferData adapter.
Iters 5-7 Oct 30 - Oct 31 Multi-platform native plugins (build_plugins.py for macOS, iOS, Android with 16 KB page alignment, Windows, Linux, WebAssembly), worker-thread streaming, and full 16-bit sky + RGB block light with per-channel color mixing.
Iters 8-13 Oct 31 - Nov 09 Swept AABB movement and flight, seamless passthrough voxel clouds and weather, vaporwave dusk atmosphere, animated neon pulses + URP post stack, hash-placed voxel-volume.v1 prefabs, Blockbench-style sub-voxel detail boxes (boxes), pulsing visor flashlight, Chrome WebGPU + WebGL 2 builds at 60 fps, reactive synthwave music.
Iters 14-19 Nov 10 - Nov 16 Per-box collision and raycasting, frame-time benchmarking tools, outrun/vaporwave menus, and runtime streaming optimizations eliminating main-thread hitches.
Iters 20-22 Nov 18 - Nov 20 iOS + Android mobile validation (tested on Pixel 9a), floating virtual touch controls, day/night keyframes, camera mood presets, stylized surface grain/bevel shader pass, offline style_preview.py renderer, and all six playable worlds + WORLD picker.
Iters 23-26 Nov 22 - Nov 24 Pure C# PoiWorld state/interaction/wave engine, voxel-items.v1 inventory + weapons + loot drops, The Static enemy invasion loop where reclaiming POIs restores neon and music stems, and X1 authored encounter sequences (first_signal, vars, conditions, zones, save/resume, poi_lint.py). Verified by 50 POI + 43 Item dotnet tests, 104 EditMode tests, and 48 PlayMode tests.

Turning Scenery Into Gameplay: The First Signal Slice

In iterations 23 through 26, Dusk Synth got its first playable game loop built around restoring lost signal towers against The Static (noise entities like Saw Stalkers, Sine Wisps, and Feedback Sappers). Taking back a tower lights up the block neon, boosts mood, and unlocks the next layer of the synthwave track, applying the feedback loop ideas from Game Design Principles for Happy Players.

In-Engine Gameplay Capture (Iter 26) POI: Radio DJ
A voxel avatar in a neon alley in front of a glowing DJ booth with an E Talk prompt and a hotbar showing the Zapper
Step 1 - Meet the Radio DJ: interactive NPC booth gated on holding 5 Light, with dynamic prompts and the player's hotbar driven by voxel-pois.v1 and voxel-items.v1.
In-Engine Gameplay Capture (Iter 26) POI: Signal Tower Hold
A voxel archway with a green and cyan beam, a hold E to Activate prompt with a progress bar, and a Build Pad nearby
Step 2 - Hold the Signal Tower: holding activate starts a 45-second defense wave against Sine Wisps and a Feedback Sapper, next to a Build Pad that spawns an automated Bass Cannon turret for 10 Light.

The entire 7-step opening sequence (first_signal: shard pickup -> gated Radio DJ talk -> avenue ambush trigger zone -> Power Node repair -> 45s Signal Tower hold -> Bass Cannon build) runs in a pure C# fixed-timestep simulation with Save and Load persistence, so unit and integration tests can walk the full quest arc deterministically.

Measured C++ Core Numbers

From the core benchmark on an Intel i9-9900K desktop (macOS, chunk radius 8, 1,024 chunks loaded / 512 stored, caves enabled):

Stage Measured Result
Chunk memory footprint 4.6 MB palette-packed vs. 32 MB raw (6.9x smaller)
Region disk compression (VXR1 + LZ4) 0.9 MB vs. 6.0 MB uncompressed (60 ms save, 80 ms load)
Terrain generation ~0.55 ms per chunk (~0.27 ms with coarse caves.grid)
Greedy meshing ~0.15 ms per chunk single-threaded; 512 chunks in ~15 ms on thread pool
Greedy quad reduction 520k merged quads vs. 1.28M unmerged (2.5x reduction)
Raycasts & edits ~2 us per ray; 10,000 random edits touched 382 chunks and remeshed in ~30 ms
Flight streaming (60 Hz, 4 ms budget) Game-thread update p50 1.4-1.7 ms, p95 4.2-4.8 ms (measured under machine load 12-20)

Note on full-game frame timings: while WebGPU and WebGL 2 builds hit 60 fps in Chrome and mobile profiling started on Pixel 9a, we are waiting for clean, isolated release-profile captures before publishing final end-to-end game frame-time tables.

Iteration Roadmap: What Comes Next

Every upcoming iteration stays broken into testable vertical slices:

Milestone Status Scope & Target Slice
X1: Experience Sequences Core Shipped (Iter 25-26) Variables, conditions, invisible trigger zones, objective sequences with HUD compass/arrow, tagged spawns, Save/Load, poi_lint.py, and the 7-step First Signal arc.
X2: World-Changing Set Pieces Up Next (Iter 26+) Volume anchors, layer-by-layer animated prefab reveals (placePrefab, swapPrefab, clearBox), world pickups and collectible sets. Target slices: The Neon Bridge crossing the canal and the 5-part Lost Tape Hunt.
I3 & X3: Gear + Presentation Beats Planned New gear (Arp Repeater, Tuning Fork, B-Side Key), camera focus/shake, dialogue cards, slowmo, music-beat-aligned enemy rounds, victory fireworks, and Blackout Drop / Bitcrusher boss health phases.
P3 & X4: Authoring Tools & Side Encounters Planned In-game prefab and POI sequence editors, -sequence / -step test jump flags, debug variable overlay, and rule-scattered Busker Camp side encounter templates.
vxnet: Multiplayer Over WebRTC + RUDP Designed (Sandbox Live) Sans-IO RUDP transport in C++ (1200-byte MTU, ~10-byte edits, LZ4 chunk snapshots) over a single unordered zero-retransmit WebRTC DataChannel with listen-host then dedicated-server authority. Explore the packet protocol live in our Voxel-Net RUDP Sandbox.
Cross-Engine Adapters Planned Expose the existing WebAssembly build through a three.js viewer, followed by a Godot GDExtension and Unreal spike.

← Back to All Posts