# Shared C++ library plan ## Library contents Move the deterministic CPU world pipeline into a portable `VoxelForgeCore` library: plain voxel and world types, math/noise, density operations and caches, cave and passage fields, strate composition, marching cubes, and desired clipmap tile selection. Keep renderer, file loading, asset/reflection access, gameplay actors, and task scheduling in the host applications. ## Compatibility boundary The library should expose standard C++ value types and explicit immutable world inputs. Unreal adapters convert `UObject` settings/assets into those inputs and convert mesh results back to Unreal types. The standalone loader maps its JSON snapshot into the same inputs. No Unreal headers, reflection macros, `UObject`, or host allocator should cross the library boundary. ## Plugin integration Build the core as one C++20 static library and link it from both the standalone viewer and the VoxelForge Unreal module. The plugin keeps ownership of asset loading, worker admission, cancellation, collision, game-thread mesh application, and per-frame upload budgets; workers call the shared density and meshing API with immutable contexts. The standalone keeps its D3D11 renderer and JSON loader and calls the same API. ## Preventing drift before extraction Until the move lands, keep the standalone copies synchronized from the plugin source with a small manifest of shared files and a checked sync script. The script should compare hashes and refuse an ambiguous two-sided edit. Run the exported 3,436-sample bitwise parity corpus after every density change, then remove the duplicate source only when both hosts build against the shared library.