Contact

Type to explore Drawk studio productions

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

← Back to Posts

Voxel Engine & Dusk Synth Update: Godot Parity, C ABI 12 Optimizations, and X2 World Changes

Updated November 29, 2026 · Previous versions & history ↓

TL;DR: Our standalone C++17 voxel engine (game-lib-voxel) now ships with a full Godot 4.5+ GDExtension layer matching the Unity look across all six worlds, six opt-in C ABI 12 core optimizations (terrain occlusion, an 8 km far field, mesh on reach, streaming pins, batched edits, and per-channel RGB light filters), and X2 world-change gameplay in Dusk Synth (The Neon Bridge). Credit and thanks to Collin Christensen (collincube on GitHub) and Happy Devil Studios for the Godot layer and core optimization work adapted from his MIT-licensed GoVoxelDotCraft project.

Unity vs. Godot Parity (C ABI 12) All 6 Worlds • Same Core & Look
Side-by-side captures across all six voxel worlds: Unity player builds on the left and Godot Forward+ frames on the right for Dusk Synth, Rural Canyons, Frozen Arcology, Jungle Ruins, Sunken Coast, and Sky Islands
Six-world visual parity: Unity URP captures on the left beside Godot 4.5+ frames (Forward+ on lavapipe, MSAA 4x) on the right, generated from the exact same C++17 core, JSON style files, and procedural textures.

Why One Core Matters When Adding Godot

When we started building our custom voxel engine, the core rule followed our multi-engine architecture: keep every expensive voxel loop (32 x 32 x 32 palette chunks, greedy AO meshing, RGB block lighting, DDA raycasts, region compression, and chunk streaming) inside one dependency-free C++17 library behind a flat C99 ABI (voxel_c.h).

This round tested that seam for real. Adding Godot 4.5+ support did not mean rewriting meshing, lighting, or world generation in GDScript or C#. Instead, a thin C GDExtension (cpp~/godot/voxel_gdext.c) and a VoxelWorld node (godot~/addons/voxel/) sit directly on top of the exact same voxel_c.h ABI that drives Unity and Dusk Synth.

flowchart TD subgraph DATA["Versioned JSON + VXR1 LZ4 Regions"] J1["voxel-style.v1, -blocks, -terrain, -volume, -pois, -items (incl. lightFilter)"] end subgraph CORE["C++17 Core + C99 ABI 12 (voxel_c.h)"] C1["32^3 chunks, greedy AO, RGB light + filter, terrain occlusion, far field, mesh on reach, pins, apply_edits"] end subgraph UNITY["Unity Adapter + C# Runtimes"] U1["Voxel.Unity, Voxel.Poi (X2), Voxel.Items, VoxelFarFieldLayer, Dusk Synth"] end subgraph GODOT["Godot 4.5+ Adapter (New)"] G1["voxel_gdext.c (plain C GDExtension) + VoxelWorld GDScript node + URP-matched shaders"] end DATA --> CORE CORE --> UNITY CORE --> GODOT

Godot 4.5+ Parity: Same Look, Different Renderer

Porting geometry alone is only half of visual parity. A voxel city at sunset or a canyon at 16:30 only looks right when sky gradients, striped suns, neon breathing waves, atmospheric fog, clouds, cube weather particles, bloom weights, and tonemapping agree between engines.

Here is what shipped in the Godot layer (godot~/addons/voxel/ and cpp~/godot/voxel_gdext.c):

  • Plain C GDExtension with zero godot-cpp dependency: voxel_gdext.c (~960 lines) uses minimal custom binary interface declarations matching Godot's GDExtension ABI, keeping builds -Wall -Wextra -Werror -Wpedantic clean with both Clang and GCC.
  • Fast binary mesh transfer: mesh_surface and farfield_surface pack vertex positions, normals, block colors, UVs, AO/layer uv2, per-vertex light (ARRAY_CUSTOM0 RGBA8), and clockwise indices into one PackedByteArray per surface pass (opaque, cutout, translucent). In retro-city benchmarks (29,739 faces), the extension builds a surface in 158-175 us per 1,000 faces, and Godot slices and uploads ArrayMesh in 294-310 us.
  • Byte-for-byte texture parity: VoxelNative.texture_pixels reproduces all 346 procedural placeholder texture layers (bricks, window, rock, leaves, glow, and more) from VoxelTextures.cs in C, verified byte-for-byte across all seven styles and pinned by SHA-256 in automated checks.
  • Shader, sky, weather, and post parity: voxel_look.gd, voxel_chunk.gdshaderinc, voxel_atmosphere.gdshaderinc, voxel_sky.gdshader, voxel_clouds.gd, voxel_weather.gd, voxel_flashlight.gd, and voxel_post.gdshader port the Unity URP pipeline formula for formula - including look.cycle keyframe interpolation, 3 x 3 drifting voxel clouds, fixed-seed rain/snow/dust/embers, 3-level bloom halo calibration, LogC color grading, and URP's Neutral tonemapper.
  • Cross-renderer color handling: CURRENT_RENDERER branches handle Godot Forward+ / Mobile (sRGB output + linear color space) alongside GL Compatibility without washed-out highlights.
  • Verified across Godot 4.5.1 and 4.7.2: python3 tools/godot_check.py passes 57 / 57 headless checks covering meshing, raycasts, batched edits + undo, streaming pins, far field, terrain occlusion, region saves, and look parity.
Godot Forward+ Capture dusk-synth in Godot 4.5+
Dusk Synth voxel street rendered in Godot showing glowing pink, magenta, and yellow textured windows, striped sunset sky at the end of the avenue, and drifting neon embers
Dusk Synth in Godot: textured neon windows, world-space grain and neon phase parity, sunset glow, and cube embers running through VoxelWorld and voxel_look.gd.

C ABI 12: New Capabilities & Core Optimizations

Alongside the Godot adapter, C ABI 12 adds six opt-in features in the shared C++17 core (cpp~/). Because every capability lives behind voxel_c.h, Unity, Godot, and future Unreal or WebAssembly adapters all get the same wins. When left off, existing behavior stays byte-for-byte identical (all 126 original golden vectors pass unchanged).

Capability What It Does Measured Result
Terrain Occlusion Second culling stage after the cave visibility walk; hides chunks blocked behind opaque terrain tiles while staying valid for any eye movement within eps (occluder shrinking, re-queried at eps / 2). Hides 32-42% of frustum-kept chunks from street level in rural-canyons and frozen-arcology (and cuts Godot canyon-floor draw calls from 321 to 159, primitives from 219,474 to 149,614).
Far Field (VoxelFarFieldLayer) Renders coarse, crack-free heightfield tiles beyond the near streamed radius out to 8,192 voxels (5 rings). 304 tiles (~150k faces) built in ~50 ms on one thread.
Mesh on Reach Delays meshing buried chunks until a straight line of sight reaches them from the viewer's chunk (or they are adjacent, pinned, or edited). 30-50% fewer meshes across styles at radius 8 (26% fewer faces in frozen-arcology; 286 vs 441 chunk nodes on Godot's canyon floor) with unchanged fill time.
Streaming Pins Keeps up to 16 secondary areas (portals, second cameras, teleport targets, cutscenes) loaded and meshed with alternating load slots and a pins_ready() gate. Ready within 2 updates per pinned chunk alongside a moving viewer without starving primary loads.
Batched Edits (apply_edits) Applies many voxel changes in one call, relights once per 16^3 block, and returns prior block IDs for clean undo. 1,440-voxel prefab applied 8.7x faster than individual set calls.
Per-Channel RGB lightFilter Lets translucent or foliage blocks attenuate R, G, and B block light independently ([r, g, b]) while sky light stays single-channel. Red glass ([1, 15, 15]) passes red alone and water ([5, 3, 2]) tints torches teal (2.48 s -> 2.14 s batch relight, no slowdown).
Terrain Occlusion Proof (Godot) 321 -> 159 Draw Calls
Overhead capture of Rural Canyons showing visible canyon chunks in natural desert tones and 183 terrain-occluded chunks highlighted in bright red
Terrain occlusion from above (show_culled): natural colors show the chunks visible from the canyon floor; bright red marks the 183 chunks hidden behind canyon walls. Between unculled and culled frames, only 2 to 8 pixels out of 921,600 differ on greedy-mesh T-junction cracks.
Far Field Heightfield Rings (Godot) 5 Rings • 8,192 Voxels
Rural Canyons rendered in Godot with near detailed voxel canyons transitioning cleanly into coarse far-field heightfield rings stretching to the horizon
8 km horizon in Rural Canyons: near 32^3 streamed voxel chunks blend into 304 heightfield far-field tiles across 5 rings without seams.

Platform Hardening & Verification Tooling

Before merging ABI 12 to main, we ran a review and optimization pass focused on mobile, WebGL, and desktop targets (building on our zero-allocation Unity C# practices):

  • Zero overhead when off: Terrain occlusion upkeep, mesher occluder extraction, and eye lookups are completely skipped when occlusion_on_ is off, and internal occlusion maps clear immediately on disable.
  • ABI version guard: VoxelNative.AbiVersion checks >= 12 once at startup so older desktop or Android plugins degrade gracefully instead of throwing EntryPointNotFoundException.
  • WebGL & mobile safety: VoxelFarFieldLayer forces 0 worker threads on single-threaded WebGL, ApplyPins() avoids per-frame LINQ allocations, non-finite eye positions are rejected before DDA traversal, and native plugins were rebuilt across macOS (universal), iOS, Android (arm64-v8a, armeabi-v7a, x86_64), and WebGL.
  • Automated proof tools: Added cpp~/build/voxel_render (CPU reference renderer), tools/proof_sheet.py (single-page measured proof sheet), tools/bench_ab.py (interleaved A B B A bootstrap A/B benchmark), tools/mutation_check.py (17 / 17 guarded rule mutations caught), tools/godot_check.py (57 / 57 headless checks), and Voxel.Unity.CompileCheck~.

Dusk Synth Updates: X2 World Changes, The Neon Bridge & ABI 12

On the game side, Dusk Synth moved from single-location POIs into multi-step world-changing set pieces (X2) and updated its submodule and native plugins to ABI 12:

  • X2 World Change primitives: Pure C# PoiWorld now supports volume and transform anchors, placePrefab, removePrefab, swapPrefab, and clearBox with both instant swaps and block-by-block animated build reveals (VoxelPoiEdits), plus world pickups (dropItem, dropLoot, pickedUp), collectible sets, {var} objectives, and full Save/Load persistence.
  • The Neon Bridge (neon_bridge sequence): Following the First Signal loop, players encounter an 8-wide by 4-deep neon-curbed canal cutting across the avenue (z -120..-113) with a 6-wide walkable neon bridge and overhead gantry that lights up when bridge-node comes online.
  • All test suites green after ABI 12 integration: 138 / 138 C++ golden vectors, 62 Python oracle checks, 69 POI dotnet tests, 43 Items dotnet tests, 111 / 111 Unity EditMode tests, 52 / 52 Unity PlayMode tests, 57 / 57 Godot headless checks, and BuildMacPois smoke launch.

What Comes Next

With ABI 12 and Godot parity landed on main, the immediate next milestones are:

  1. Tune mobile & desktop profiles in Dusk Synth: Enable terrain occlusion, mesh on reach, and the far field inside Dusk Synth (com.drawlabs.dusksynth), benchmark before/after with bench_ab.py, and finalize mobile presets for TestFlight and Play internal builds.
  2. Share links & in-app editors (P3 + S0): Route deep links and CLI launch args through VoxelLaunchOptions (-link <url>) for sharing prefabs and POI encounters.
  3. Multiplayer vxnet integration: Connect our Voxel-Net RUDP + WebRTC transport into the live game loop.

Credits & Notes

← Back to All Posts