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 and Dusk Synth: Iterations and What Comes Next

Updated November 25, 2026 · Previous versions & history ↓

TL;DR: Across 26 short iterations since late October, we built a C++17 voxel core behind a plain C ABI, added C# bindings and a thin Unity layer on top, styled six different worlds in JSON, and got the first quest loop running in Dusk Synth. Here is what works right now, the numbers we measured, and what we plan to build next.

Dusk Synth (Iteration 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 neon avenue always set at sunset, loaded from one JSON style file on top of our C++17 voxel core.

The Setup: Keep the Core Shared and Styles in JSON

Voxel games spend most of their time inside tight loops over 32 x 32 x 32 chunks: greedy meshing, chunk streaming, raycasts, terrain generation, and colored light fills. Writing two copies in C++ and C# doubles the work and causes subtle differences. Putting those loops inside one specific game engine also makes it harder to move elsewhere later.

From iteration 1, we followed the boundary we use in multi-engine architecture: put the hot math and chunk state in one standalone C++17 library with a flat C99 ABI, then put plain C# bindings, gameplay rules, and thin engine adapters on top. On the Unity side we pair that with zero-allocation C# patterns so frame updates do not pause 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["C# Bindings & Gameplay Runtime"] L["IDisposable ABI wrappers, PoiWorld sequences, items & inventory (fixed step)"] end subgraph ADAPTER["Unity Engine Layer"] U["Mesh API renderer, shaders, visor flashlight, avatar controller, synthwave music"] end DATA --> CORE CORE --> LOGIC LOGIC --> ADAPTER

Blocks, props, terrain, points of interest, and items live in versioned JSON formats (voxel-blocks.v1, voxel-volume.v1, voxel-terrain.v1, voxel-style.v1, voxel-pois.v1, voxel-items.v1), so adding a biome or encounter means writing data rather than branching engine code. Every C++ change runs against test vectors and a small Python reference script so math bugs show up as failed checks right away.

Six Worlds From One Generator

The biggest win from moving styles into JSON landed in iterations 20 through 22. Swapping a single style file turns the same generator and prop rules (roof, lot, facade, sidewalk, scatter, lift, footing, submerge) into six very different worlds:

JSON World Style 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: carved canyons 52 voxels deep, layered rock bands, saguaros, mesas, windmills, and warm desert light.
JSON World Style 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, floating islands using lift rules, waterfalls, rope bridges, and marble ruins.
JSON World Style 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.
JSON World Style 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 and violet aurora night cycle.
JSON World Style 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: mossy step pyramids covered in vines, river channels, thick green valley fog, fireflies, and drifting embers.

Dev Log Across 26 Iterations

We split work into short iterations backed by clear handoff notes, following the habits in Thread Cost and Context Window Compression. Here is how the project progressed from a blank grid to playable quests:

Iterations Dates What Shipped
Iters 1-4 Oct 27 - Oct 30 Standalone C++17 core (32^3 palette chunks, AO greedy mesher, DDA raycast, terrain, golden vectors + Python reference script), C99 ABI, C# bindings, LZ4 VXR1 region files, Unity Mesh.SetVertexBufferData adapter.
Iters 5-7 Oct 30 - Oct 31 Native plugin builds (build_plugins.py for macOS, iOS, Android with 16 KB alignment, Windows, Linux, WebAssembly), background chunk streaming, and 16-bit sky + RGB block light with color mixing.
Iters 8-13 Oct 31 - Nov 09 Swept box movement and flight, passthrough clouds and weather, dusk haze, animated neon + URP post effects, voxel-volume.v1 prefabs, small sub-voxel detail boxes (boxes), pulsing visor flashlight, Chrome WebGPU + WebGL 2 at 60 fps, reactive synthwave music.
Iters 14-19 Nov 10 - Nov 16 Collision and raycasts per sub-voxel box, frame timing tools, outrun menus, and streaming fixes to stop main-thread hitches.
Iters 20-22 Nov 18 - Nov 20 iOS and Android checks (tested on Pixel 9a), virtual touch controls, day/night keyframes, camera mood presets, surface grain and bevel shader pass, style_preview.py renderer, and all six worlds + WORLD menu.
Iters 23-26 Nov 22 - Nov 24 Plain C# PoiWorld runtime, voxel-items.v1 inventory + weapons + loot drops, The Static invasion loop where restoring towers brings back neon and music layers, and X1 sequences (first_signal, variables, conditions, zones, save/resume, poi_lint.py). Covered by 50 POI + 43 Item dotnet tests, 104 EditMode tests, and 48 PlayMode tests.

Moving Into Gameplay: The First Signal Loop

In iterations 23 through 26, Dusk Synth gained its first full playable loop around taking back signal towers from The Static (Saw Stalkers, Sine Wisps, and Feedback Sappers). Bringing a tower online turns the neighborhood neon back on and adds another stem to the synthwave track, tying into our notes on player feedback in Game Design Tips for Happy Players.

In-Engine Capture (Iteration 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: NPC booth gated on holding 5 Light, with dynamic prompts and a weapon hotbar read straight from voxel-pois.v1 and voxel-items.v1.
In-Engine Capture (Iteration 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 triggers a 45 second wave of Sine Wisps and a Feedback Sapper, next to a Build Pad that spawns a Bass Cannon turret for 10 Light.

The whole 7 step opening sequence (first_signal: shard pickup -> DJ talk -> alley ambush zone -> Power Node repair -> Signal Tower hold -> Bass Cannon build) runs in a plain C# simulation with a fixed time step and Save/Load persistence, so automated tests can replay the entire quest arc without opening the Unity editor.

Numbers Measured in the C++ Core

These numbers come from our core benchmark on an Intel i9-9900K macOS desktop (chunk radius 8, 1,024 loaded chunks / 512 stored chunks, caves on):

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 on one thread; 512 chunks in ~15 ms on thread pool
Greedy quad reduction 520k merged quads vs. 1.28M unmerged (2.5x fewer)
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 (under load average 12-20)

WebGPU and WebGL 2 builds run at 60 fps in Chrome and Pixel 9a device tests are underway, though we are holding off on publishing final full-game frame time tables until we run clean release captures.

Roadmap: What Comes Next

Every upcoming iteration is split into small playable pieces:

Milestone Status Scope & Target Slice
X1: Sequence Core Shipped (Iters 25-26) Variables, conditions, trigger zones, HUD objective compass/arrow, tagged spawns, Save/Load, poi_lint.py, and the 7 step First Signal arc.
X2: World Set Pieces Up Next (Iter 26+) Placement anchors, block by block animated prefab reveals (placePrefab, swapPrefab, clearBox), world pickups and collectible sets. Target slices: The Neon Bridge across the canal and the 5 part Lost Tape Hunt.
I3 & X3: Gear + Beat Cues Planned New gear (Arp Repeater, Tuning Fork, B-Side Key), camera focus and shake, dialogue cards, slow motion, waves timed to the music beat, victory fireworks, and Blackout Drop / Bitcrusher boss health phases.
P3 & X4: Editors + Side Encounters Planned Prefab and POI editors inside the app, -sequence / -step jump flags for testing, debug variable overlay, and Busker Camp side encounters placed by rule.
vxnet: Multiplayer Over WebRTC + RUDP Designed (Sandbox Live) Sans-IO RUDP transport in C++ (1200 byte MTU, ~10 byte edits, LZ4 chunk snapshots) carried over a single unordered WebRTC DataChannel with listen-host then dedicated server authority. Try the packet inspector in our Voxel-Net RUDP Sandbox.
More Engine Adapters Planned Hook the existing WebAssembly build up to a three.js viewer, followed by a Godot GDExtension and Unreal test.

Revision History

  • 2026-11-25 (c3746b0 -> current) | View v2 | Diff v2 vs current
    • Modified sections: Title, Revision History.
    • Summary: Dropped the iteration count from the title ("26 Iterations" -> "Iterations") while keeping iteration rounds in the post body, and archived v2.
  • 2026-11-25 (9de55b3 -> c3746b0) | View v1 | Diff v1 vs current
    • Modified sections: Title, TL;DR, card headers, body copy, and roadmap labels.
    • Summary: Simplified phrasing to be plainer and more direct, reduced lofty adjectives and unnecessary hyphenated compounds across sections, and archived v1.

Previous Versions & Diffs

Archived Revisions: v2 (November 25, 2026) Diff vs Latest v1 (November 25, 2026) Diff vs Latest

← Back to All Posts