Files
VoxelForge/Standalone/Source/parity_main.cpp
T
Fr0zkaandClaude Opus 5.5 05f62cff36 standalone: the owner's world outside Unreal -- bit-identical density, D3D11 fly-through viewer
Standalone/ (C++20, MSVC /O2 /arch:AVX2 /fp:precise, Build.ps1): copied density pipeline, op stack,
cave morphology, passages, strate manager/composer, noise, DetSinCos, mesher, clipmap selection,
with a UE compatibility layer (Compat/). Owner data exported once to Standalone/data/owner_world.json
by a default-off explore-commandlet exporter (the only plugin-source change). 25 cm voxels.
Parity: seed 0, 3,436 samples (strate edges, negative/far coords, rooms, tunnels, passages,
landings): bit-identical. Viewer: full 7-level clipmap, per-level toggles 1-7, T = round winding
tunnels (standalone option), N/P seed, F wireframe.
Timing NOT yet a baseline: 515 s for 12,054 tiles (L0 70 s, L6 296 s); the compat TMap/TSet are
vector-backed with linear lookup, which the plugin's caches do not expect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MmSoF64BbRFmk9C3p1VsBJ
2026-10-02 12:14:04 +02:00

57 lines
2.6 KiB
C++

#include "OwnerWorldLoader.h"
#include "WorldMesher.h"
#include <bit>
#include <iostream>
#include <map>
int main(int argc, char** argv)
{
const std::string DataPath = argc > 1 ? argv[1] : "Standalone/data/owner_world.json";
FStandaloneOwnerWorld World;
std::string Error;
if (!StandaloneOwnerLoader::Load(DataPath,World,Error))
{
std::cerr << "LOAD FAILED: " << Error << '\n';
return 2;
}
std::cout << "Loaded owner world: seed=" << World.Seed
<< " strates=" << World.Manager->GetNumStrates()
<< " passages=" << World.Manager->GetPassages().Num()
<< " samples=" << World.DensitySamples.size() << '\n';
struct FMismatch { size_t Index; float Actual; };
std::vector<FMismatch> Mismatches;
Mismatches.reserve(World.DensitySamples.size());
std::map<std::string,size_t> SampleKinds;
for (size_t I = 0; I < World.DensitySamples.size(); ++I)
{
const FStandaloneParitySample& Sample = World.DensitySamples[I];
const float Actual = World.Generator->GetDensityAt(
static_cast<float>(Sample.PositionVoxels.X),
static_cast<float>(Sample.PositionVoxels.Y),
static_cast<float>(Sample.PositionVoxels.Z));
++SampleKinds[Sample.Kind];
if (std::bit_cast<uint32>(Actual) != std::bit_cast<uint32>(Sample.PluginDensity))
Mismatches.push_back({I,Actual});
}
std::cout << "Parity samples by kind:\n";
for (const auto& [Kind,Count] : SampleKinds) std::cout << " " << Kind << ": " << Count << '\n';
for (const FMismatch& M : Mismatches)
{
const FStandaloneParitySample& S = World.DensitySamples[M.Index];
std::cerr << "MISMATCH index=" << M.Index << " kind=" << S.Kind
<< " strate=" << S.StrateIndex << " at_voxels=("
<< S.PositionVoxels.X << ',' << S.PositionVoxels.Y << ',' << S.PositionVoxels.Z
<< ") plugin=" << S.PluginDensity << " standalone=" << M.Actual
<< " plugin_bits=0x" << std::hex << std::bit_cast<uint32>(S.PluginDensity)
<< " standalone_bits=0x" << std::bit_cast<uint32>(M.Actual) << std::dec << '\n';
}
std::cout << "Parity: " << (World.DensitySamples.size()-Mismatches.size()) << '/'
<< World.DensitySamples.size() << " bit-identical; mismatches=" << Mismatches.size() << '\n';
const FStandaloneCpuClipmap Clipmap = StandaloneWorldMesher::Build(
World,World.ViewerStartVoxels,6);
std::cout << "Clipmap build finished in " << Clipmap.TotalSeconds << " seconds.\n";
return Mismatches.empty() ? 0 : 1;
}