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 (collincubeon GitHub) and Happy Devil Studios for the Godot layer and core optimization work adapted from his MIT-licensedGoVoxelDotCraftproject.
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.
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-cppdependency:voxel_gdext.c(~960 lines) uses minimal custom binary interface declarations matching Godot's GDExtension ABI, keeping builds-Wall -Wextra -Werror -Wpedanticclean with both Clang and GCC. - Fast binary mesh transfer:
mesh_surfaceandfarfield_surfacepack vertex positions, normals, block colors, UVs, AO/layeruv2, per-vertex light (ARRAY_CUSTOM0RGBA8), and clockwise indices into onePackedByteArrayper surface pass (opaque,cutout,translucent). Inretro-citybenchmarks (29,739faces), the extension builds a surface in158-175 usper1,000faces, and Godot slices and uploadsArrayMeshin294-310 us. - Byte-for-byte texture parity:
VoxelNative.texture_pixelsreproduces all346procedural placeholder texture layers (bricks,window,rock,leaves,glow, and more) fromVoxelTextures.csin 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, andvoxel_post.gdshaderport the Unity URP pipeline formula for formula - includinglook.cyclekeyframe interpolation,3 x 3drifting 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_RENDERERbranches 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.pypasses57 / 57headless checks covering meshing, raycasts, batched edits + undo, streaming pins, far field, terrain occlusion, region saves, and look parity.
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). |
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.
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.AbiVersionchecks>= 12once at startup so older desktop or Android plugins degrade gracefully instead of throwingEntryPointNotFoundException. - WebGL & mobile safety:
VoxelFarFieldLayerforces0worker 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(interleavedA B B Abootstrap A/B benchmark),tools/mutation_check.py(17 / 17guarded rule mutations caught),tools/godot_check.py(57 / 57headless checks), andVoxel.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#
PoiWorldnow supports volume and transform anchors,placePrefab,removePrefab,swapPrefab, andclearBoxwith both instant swaps and block-by-block animated build reveals (VoxelPoiEdits), plus world pickups (dropItem,dropLoot,pickedUp), collectible sets,{var}objectives, and fullSave/Loadpersistence. - The Neon Bridge (
neon_bridgesequence): Following the First Signal loop, players encounter an8-wide by4-deep neon-curbed canal cutting across the avenue (z -120..-113) with a6-wide walkable neon bridge and overhead gantry that lights up whenbridge-nodecomes online. - All test suites green after ABI 12 integration:
138 / 138C++ golden vectors,62Python oracle checks,69POI dotnet tests,43Items dotnet tests,111 / 111Unity EditMode tests,52 / 52Unity PlayMode tests,57 / 57Godot headless checks, andBuildMacPoissmoke launch.
What Comes Next
With ABI 12 and Godot parity landed on main, the immediate next milestones are:
- 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 withbench_ab.py, and finalize mobile presets for TestFlight and Play internal builds. - Share links & in-app editors (
P3+S0): Route deep links and CLI launch args throughVoxelLaunchOptions(-link <url>) for sharing prefabs and POI encounters. - Multiplayer
vxnetintegration: Connect our Voxel-Net RUDP + WebRTC transport into the live game loop.
Credits & Notes
- Collin Christensen (
collincubeon GitHub) & Happy Devil Studios: Built the Godot 4.5+ GDExtension /VoxelWorldparity layer and the C ABI 12 core optimizations (terrain occlusion, far field, streaming pins, mesh on reach, batched edits, and verification tools), with portions adapted from Collin's MIT-licensedGoVoxelDotCraftproject (attribution and MIT notice preserved ingame-lib-voxelunderdocs~/licenses/GoVoxelDotCraft-MIT.txtandREADME.md). - Architecture & Standards References: