wip(assembler): M1 round 5 -- native SurfaceWorld manifest delivered into the Unreal Core route
Manifest imported into UVoxelSettings (hash 8933693d9560ba9f), folded into the season content hash only when Core is on. BuildHost: W1/W8/W16 stable, 2553 surface tiles match standalone, 432 LOD transitions, collision on all 36 expected tiles. Matched timing 96.8 s native vs 197.3 s bridge (2.04x). Collision support tiles wait for Core region admission. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MmSoF64BbRFmk9C3p1VsBJ
This commit is contained in:
1 parent
2d0cec90e4
commit
f67b519e75
11 files changed
+1002
-45
No files matched your search
@@ -66,6 +66,7 @@
|
||||
#include <atomic>
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <limits>
|
||||
#include <string>
|
||||
@@ -341,6 +342,7 @@ struct FExploreArguments
|
||||
int32 Slot = 4;
|
||||
FString StrateReference;
|
||||
FString SettingsReference;
|
||||
FString CoreWorldAssemblyManifestPath;
|
||||
bool bRender = true;
|
||||
bool bWalk = true;
|
||||
bool bExport = true;
|
||||
@@ -457,6 +459,7 @@ bool ParseArguments(const FString& Params, FExploreArguments& OutArguments, FStr
|
||||
FParse::Value(*Params, TEXT("slot="), OutArguments.Slot);
|
||||
FParse::Value(*Params, TEXT("strateref="), OutArguments.StrateReference);
|
||||
FParse::Value(*Params, TEXT("settingsref="), OutArguments.SettingsReference);
|
||||
FParse::Value(*Params, TEXT("coreworldassembly="), OutArguments.CoreWorldAssemblyManifestPath);
|
||||
FParse::Value(*Params, TEXT("modes="), ModesText);
|
||||
// FParse::Value treats a comma as a command-line separator in some UE commandlet
|
||||
// launch paths. Recover the complete token so both -modes=walk,export and the
|
||||
@@ -987,6 +990,11 @@ bool ParseArguments(const FString& Params, FExploreArguments& OutArguments, FStr
|
||||
OutError = TEXT("coreworldtest requires settingsref and must omit strateref.");
|
||||
return false;
|
||||
}
|
||||
if (!OutArguments.CoreWorldAssemblyManifestPath.IsEmpty() && !OutArguments.bCoreWorldTest)
|
||||
{
|
||||
OutError = TEXT("coreworldassembly is accepted only by coreworldtest.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (OutText.IsEmpty())
|
||||
{
|
||||
@@ -13197,6 +13205,30 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Arguments.CoreWorldAssemblyManifestPath.IsEmpty())
|
||||
{
|
||||
const FString ManifestPath = FPaths::ConvertRelativePathToFull(
|
||||
Arguments.CoreWorldAssemblyManifestPath);
|
||||
if (!IsUnderVoxelForgeSaved(ManifestPath))
|
||||
{
|
||||
OutError = TEXT("Core world assembly test input must be staged under the plugin Saved directory.");
|
||||
return false;
|
||||
}
|
||||
FString ManifestJson;
|
||||
if (!FFileHelper::LoadFileToString(ManifestJson, *ManifestPath))
|
||||
{
|
||||
OutError = FString::Printf(TEXT("Could not read staged Core world assembly '%s'."), *ManifestPath);
|
||||
return false;
|
||||
}
|
||||
FString ImportReport;
|
||||
if (!AuthoredSettings->SetWorldAssemblyManifestJson(ManifestJson, ImportReport))
|
||||
{
|
||||
OutError = FString::Printf(TEXT("Could not inject native SurfaceWorld plan: %s"), *ImportReport);
|
||||
return false;
|
||||
}
|
||||
UE_LOG(LogTemp, Display, TEXT("[VoxelForgeCoreWorldTest] %s"), *ImportReport);
|
||||
}
|
||||
|
||||
TStrongObjectPtr<UVoxelStrateManager> Manager(NewObject<UVoxelStrateManager>(
|
||||
GetTransientPackage(), NAME_None, RF_Transient));
|
||||
int32 ResolvedSeed = AuthoredSettings->Seed;
|
||||
@@ -13227,6 +13259,9 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
|
||||
TSet<FVoxelTileKey> ExpectedInitialDesiredSet;
|
||||
TSet<FVoxelTileKey> ExpectedTravelDesiredSet;
|
||||
TSet<FVoxelTileKey> ExpectedSurfaceTravelDesiredSet;
|
||||
TSet<FVoxelTileKey> ExpectedSurfaceCollisionSet;
|
||||
int32 ExpectedSurfaceCollisionBodyCount = 0;
|
||||
int32 ExpectedSurfaceCollisionNoBodyCount = 0;
|
||||
TArray<FVoxelTileKey> ExpectedAffectedTiles;
|
||||
FVector CarveLocalPositionCm = FVector::ZeroVector;
|
||||
FVoxelTileKey CarveTargetTile;
|
||||
@@ -13234,10 +13269,18 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
|
||||
constexpr double CoreVoxelSizeCm = 25.0;
|
||||
const double CarveBrushRadiusCoreVoxels =
|
||||
CarveBrushRadiusLegacyVoxels * static_cast<double>(VOXEL_SIZE) / CoreVoxelSizeCm;
|
||||
const int32 CollisionRadius = FMath::Clamp(AuthoredSettings->PawnCollisionRadiusChunks, 1, 4);
|
||||
uint64 ExpectedEditDigest = 0;
|
||||
std::array<std::uint64_t, 4> InitialAggregates{};
|
||||
std::array<std::uint64_t, 4> TravelAggregates{};
|
||||
std::array<std::uint64_t, 4> SurfaceTravelAggregates{};
|
||||
std::vector<VoxelForgeCore::TileKey> MatchedTimingInitialDesired;
|
||||
std::vector<VoxelForgeCore::TileKey> MatchedTimingSurfaceDesired;
|
||||
std::vector<VoxelForgeCore::TileKey> MatchedTimingSurfaceMissingFine;
|
||||
VoxelForgeCore::ShapeBuildRequest MatchedTimingInitialRequest;
|
||||
double NativeSurfaceRegionCompileSeconds = 0.0;
|
||||
double NativeSurfaceTileGenerationSeconds = 0.0;
|
||||
std::uint64_t NativeSurfaceTriangleCount = 0;
|
||||
std::size_t ExpectedInitialTileCount = 0;
|
||||
std::size_t ExpectedTravelTileCount = 0;
|
||||
std::size_t TravelFineTilesCompiled = 0;
|
||||
@@ -13256,8 +13299,11 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
|
||||
VoxelForgeCore::TileRegionCompileStats SurfaceTravelCompileStats;
|
||||
const VoxelForgeCore::Vec3d TravelCameraVoxels{-156.75164794921875, 25.093801498413086,
|
||||
-823.67364501953125};
|
||||
const VoxelForgeCore::Vec3d SurfaceCameraVoxels{-156.75164794921875, 25.093801498413086,
|
||||
-1024.0};
|
||||
const VoxelForgeCore::Vec3d SurfaceCameraVoxels{37.0, 165.0, -2011.0};
|
||||
uint32 NativeSurfaceBiomeId = 0;
|
||||
int32 NativeBiomeIdsSampled = 0;
|
||||
int32 NativeBiomeSampleCount = 0;
|
||||
bool bNativeBiomeFieldValidated = false;
|
||||
{
|
||||
FTCHARToUTF8 Utf8Json(*Json);
|
||||
std::string CoreError;
|
||||
@@ -13271,6 +13317,102 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
|
||||
UTF8_TO_TCHAR(CoreError.c_str()));
|
||||
return false;
|
||||
}
|
||||
FString CheckedAssemblyJson;
|
||||
FString ExpectedAssemblyHash;
|
||||
FString AssemblyValidationError;
|
||||
if (!AuthoredSettings->GetWorldAssemblyManifestJson(
|
||||
CheckedAssemblyJson, ExpectedAssemblyHash, AssemblyValidationError))
|
||||
{
|
||||
OutError = FString::Printf(TEXT("Core actor test settings manifest failed validation: %s"),
|
||||
*AssemblyValidationError);
|
||||
return false;
|
||||
}
|
||||
if (!ExpectedAssemblyHash.IsEmpty())
|
||||
{
|
||||
const VoxelForgeCore::WorldAssemblyManifest* Assembly = Snapshot->worldAssembly();
|
||||
const FString SnapshotHash = Assembly == nullptr ? FString() : FString::Printf(
|
||||
TEXT("%016llx"), static_cast<unsigned long long>(Assembly->contentHash));
|
||||
if (Assembly == nullptr || !SnapshotHash.Equals(ExpectedAssemblyHash, ESearchCase::IgnoreCase))
|
||||
{
|
||||
OutError = TEXT("Core runtime adapter did not preserve the settings world assembly manifest.");
|
||||
return false;
|
||||
}
|
||||
UE_LOG(LogTemp, Display,
|
||||
TEXT("[VoxelForgeCoreWorldTest] world_assembly_hash=%s plans=%d native=1"),
|
||||
*SnapshotHash, static_cast<int32>(Assembly->plan.strates.size()));
|
||||
}
|
||||
else if (Snapshot->worldAssembly() != nullptr)
|
||||
{
|
||||
OutError = TEXT("Core runtime adapter unexpectedly attached a world assembly manifest.");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Validate the native Core field's biome assignment, not the legacy decoration query.
|
||||
// Valider les biomes du champ Core natif, pas la requete historique des decorations.
|
||||
const VoxelForgeCore::WorldAssemblyManifest* NativeAssembly = Snapshot->worldAssembly();
|
||||
const VoxelForgeCore::WorldAssemblyStratumPlanV1* NativeSurfacePlan = nullptr;
|
||||
if (NativeAssembly != nullptr)
|
||||
{
|
||||
for (const VoxelForgeCore::WorldAssemblyStratumPlanV1& Plan : NativeAssembly->plan.strates)
|
||||
{
|
||||
if (Plan.strateIndex == 1)
|
||||
{
|
||||
NativeSurfacePlan = &Plan;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (NativeAssembly == nullptr || NativeSurfacePlan == nullptr)
|
||||
{
|
||||
OutError = TEXT("Core runtime snapshot has no native biome plan for SurfaceWorld strate 1.");
|
||||
return false;
|
||||
}
|
||||
const VoxelForgeCore::Heightfield2D NativeSurfaceField(
|
||||
NativeAssembly->recipe, *NativeSurfacePlan);
|
||||
if (!NativeSurfaceField.isValid())
|
||||
{
|
||||
OutError = TEXT("Core runtime snapshot's native SurfaceWorld heightfield is invalid.");
|
||||
return false;
|
||||
}
|
||||
const int64 SubvoxelsPerVoxel = VoxelForgeCore::WorldAssemblySubvoxelsPerVoxel;
|
||||
const VoxelForgeCore::HeightfieldPointSample SurfaceBiomeSample = NativeSurfaceField.point(
|
||||
static_cast<int64>(std::llround(SurfaceCameraVoxels.x * SubvoxelsPerVoxel)),
|
||||
static_cast<int64>(std::llround(SurfaceCameraVoxels.y * SubvoxelsPerVoxel)), 0);
|
||||
if (SurfaceBiomeSample.biomeId == 0)
|
||||
{
|
||||
OutError = TEXT("Native SurfaceWorld heightfield returned no biome at the route camera.");
|
||||
return false;
|
||||
}
|
||||
TSet<uint32> NativeBiomeIds;
|
||||
constexpr int32 BiomeProbeSide = 64;
|
||||
constexpr double BiomeProbeSpanVoxels = 3200.0;
|
||||
for (int32 Y = 0; Y < BiomeProbeSide; ++Y)
|
||||
for (int32 X = 0; X < BiomeProbeSide; ++X)
|
||||
{
|
||||
const double XVoxel = (static_cast<double>(X) / (BiomeProbeSide - 1) - 0.5)
|
||||
* BiomeProbeSpanVoxels;
|
||||
const double YVoxel = (static_cast<double>(Y) / (BiomeProbeSide - 1) - 0.5)
|
||||
* BiomeProbeSpanVoxels;
|
||||
const VoxelForgeCore::HeightfieldPointSample Sample = NativeSurfaceField.point(
|
||||
static_cast<int64>(std::llround(XVoxel * SubvoxelsPerVoxel)),
|
||||
static_cast<int64>(std::llround(YVoxel * SubvoxelsPerVoxel)), 0);
|
||||
if (Sample.biomeId != 0) NativeBiomeIds.Add(Sample.biomeId);
|
||||
if (Sample.neighborBiomeId != 0 && Sample.biomeWeightQ16 > 0)
|
||||
NativeBiomeIds.Add(Sample.neighborBiomeId);
|
||||
++NativeBiomeSampleCount;
|
||||
}
|
||||
if (NativeBiomeIds.Num() < 2)
|
||||
{
|
||||
OutError = TEXT("Native SurfaceWorld heightfield did not assign at least two biomes across its review domain.");
|
||||
return false;
|
||||
}
|
||||
NativeSurfaceBiomeId = SurfaceBiomeSample.biomeId;
|
||||
NativeBiomeIdsSampled = NativeBiomeIds.Num();
|
||||
bNativeBiomeFieldValidated = true;
|
||||
UE_LOG(LogTemp, Display,
|
||||
TEXT("[VoxelForgeCoreWorldTest] native_biome_field=1 surface_biome_id=%u sampled_biomes=%d samples=%d span_voxels=%.0f"),
|
||||
NativeSurfaceBiomeId, NativeBiomeIdsSampled, NativeBiomeSampleCount,
|
||||
BiomeProbeSpanVoxels);
|
||||
|
||||
VoxelForgeCore::World ReferenceWorld(std::move(*Snapshot));
|
||||
const std::vector<VoxelForgeCore::TileKey> Desired = ReferenceWorld.desiredTiles({});
|
||||
@@ -13314,6 +13456,8 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
|
||||
Request.workerLimit = 8;
|
||||
Request.detail = VoxelForgeCore::DetailVariant::coherent;
|
||||
Request.includeFarWorld = true;
|
||||
MatchedTimingInitialDesired = Desired;
|
||||
MatchedTimingInitialRequest = Request;
|
||||
FStandaloneCoreAdapterScheduler Scheduler;
|
||||
if (!ReferenceWorld.compile(Request, Scheduler, CoreError))
|
||||
{
|
||||
@@ -13651,6 +13795,7 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
|
||||
}
|
||||
std::vector<VoxelForgeCore::TileKey> MissingSurfaceFineTiles;
|
||||
MissingSurfaceFineTiles.reserve(SurfaceTravelDesired.size());
|
||||
MatchedTimingSurfaceDesired = SurfaceTravelDesired;
|
||||
for (const VoxelForgeCore::TileKey& Key : SurfaceTravelDesired)
|
||||
{
|
||||
const FVoxelTileKey RuntimeKey(
|
||||
@@ -13659,8 +13804,10 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
|
||||
if (Key.lod < ReferenceWorld.configuration().fullResolutionLodCount)
|
||||
MissingSurfaceFineTiles.push_back(Key);
|
||||
}
|
||||
MatchedTimingSurfaceMissingFine = MissingSurfaceFineTiles;
|
||||
// Keep the retained reference clipmap bounded while compiling the second remote region.
|
||||
// Garder la référence bornée avant de compiler la seconde région distante.
|
||||
const double NativeSurfaceRegionCompileStart = FPlatformTime::Seconds();
|
||||
ReferenceWorld.retainTileRegions(SurfaceTravelDesired);
|
||||
if (!ReferenceWorld.compileTileRegion(MissingSurfaceFineTiles, 16, Scheduler, CoreError,
|
||||
&SurfaceTravelFineTilesCompiled, &SurfaceTravelCompileStats))
|
||||
@@ -13669,11 +13816,14 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
|
||||
UTF8_TO_TCHAR(CoreError.c_str()));
|
||||
return false;
|
||||
}
|
||||
NativeSurfaceRegionCompileSeconds = FPlatformTime::Seconds()
|
||||
- NativeSurfaceRegionCompileStart;
|
||||
SurfaceTravelRegionsBuilt = SurfaceTravelCompileStats.regionsBuilt;
|
||||
std::vector<FStandaloneCoreAdapterTileHashes> SurfaceTravelRows;
|
||||
SurfaceTravelRows.reserve(SurfaceTravelDesired.size());
|
||||
for (const VoxelForgeCore::TileKey& Key : SurfaceTravelDesired)
|
||||
{
|
||||
const double TileGenerationStart = FPlatformTime::Seconds();
|
||||
const std::optional<VoxelForgeCore::TileMesh> Mesh =
|
||||
ReferenceWorld.generateTile(Key, TravelOptions, CoreError);
|
||||
if (!Mesh || !Mesh->hasDensityHash || !Mesh->hasMeshHash
|
||||
@@ -13683,6 +13833,9 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
|
||||
UTF8_TO_TCHAR(CoreError.c_str()));
|
||||
return false;
|
||||
}
|
||||
NativeSurfaceTileGenerationSeconds += FPlatformTime::Seconds()
|
||||
- TileGenerationStart;
|
||||
NativeSurfaceTriangleCount += Mesh->indices.size() / 3;
|
||||
const FVoxelTileKey RuntimeKey(
|
||||
FIntVector(Key.coordinate.x, Key.coordinate.y, Key.coordinate.z), Key.lod);
|
||||
FVoxelForgeCoreTileHashRecord Record;
|
||||
@@ -13698,6 +13851,27 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
|
||||
{Record.Density, Record.Mesh, Record.Payload, Record.Topology}});
|
||||
if (Mesh->groups.skirtTriangleCount > 0) ++SurfaceTravelTilesWithSkirts;
|
||||
}
|
||||
const FIntVector SurfaceCollisionCenter(
|
||||
FMath::FloorToInt(SurfaceCameraVoxels.x / CHUNK_SIZE),
|
||||
FMath::FloorToInt(SurfaceCameraVoxels.y / CHUNK_SIZE),
|
||||
FMath::FloorToInt(SurfaceCameraVoxels.z / CHUNK_SIZE));
|
||||
for (int32 Z = -CollisionRadius; Z <= CollisionRadius; ++Z)
|
||||
for (int32 Y = -CollisionRadius; Y <= CollisionRadius; ++Y)
|
||||
for (int32 X = -CollisionRadius; X <= CollisionRadius; ++X)
|
||||
{
|
||||
const FVoxelTileKey Key(SurfaceCollisionCenter + FIntVector(X, Y, Z), 0);
|
||||
const FVoxelForgeCoreTileHashRecord* Record = ExpectedSurfaceTravelHashes.Find(Key);
|
||||
if (Record == nullptr)
|
||||
{
|
||||
OutError = FString::Printf(
|
||||
TEXT("Standalone native-surface reference omitted expected collision tile (%d,%d,%d)."),
|
||||
Key.Coord.X, Key.Coord.Y, Key.Coord.Z);
|
||||
return false;
|
||||
}
|
||||
ExpectedSurfaceCollisionSet.Add(Key);
|
||||
if (Record->bEmpty) ++ExpectedSurfaceCollisionNoBodyCount;
|
||||
else ++ExpectedSurfaceCollisionBodyCount;
|
||||
}
|
||||
SurfaceTravelAggregates = StandaloneCoreAggregateHashes(SurfaceTravelRows);
|
||||
UE_LOG(LogTemp, Display,
|
||||
TEXT("[VoxelForgeCoreWorldTest] standalone_surface_reference=1 location=(%.3f,%.3f,%.3f) tiles=%d fine_compiled=%llu regions=%llu local_tiles=%d checked_faces=%d lod_transition_faces=%d skirt_tiles=%d density=0x%016llx mesh=0x%016llx payload=0x%016llx topology=0x%016llx"),
|
||||
@@ -13719,6 +13893,107 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
|
||||
CarveTargetTile.Coord.Z, CarveTargetTile.Level);
|
||||
}
|
||||
|
||||
// Compare native and compatibility bridge on the same remote surface keys in this process.
|
||||
// Comparer le champ natif et le pont de compatibilite sur les memes cles de surface.
|
||||
if (MatchedTimingInitialDesired.empty() || MatchedTimingSurfaceDesired.empty()
|
||||
|| MatchedTimingSurfaceMissingFine.empty())
|
||||
{
|
||||
OutError = TEXT("Matched native/bridge timing did not retain its reference tile keys.");
|
||||
return false;
|
||||
}
|
||||
FString BridgeJson = Json;
|
||||
TSharedPtr<FJsonObject> BridgeRoot;
|
||||
const TSharedRef<TJsonReader<>> BridgeReader = TJsonReaderFactory<>::Create(BridgeJson);
|
||||
if (!FJsonSerializer::Deserialize(BridgeReader, BridgeRoot) || !BridgeRoot.IsValid())
|
||||
{
|
||||
OutError = TEXT("Matched legacy-bridge timing could not parse the Core snapshot JSON.");
|
||||
return false;
|
||||
}
|
||||
BridgeRoot->RemoveField(TEXT("world_assembly"));
|
||||
BridgeRoot->RemoveField(TEXT("world_assembly_content_hash"));
|
||||
BridgeJson.Reset();
|
||||
const TSharedRef<FExploreJsonWriter> BridgeWriter = TJsonWriterFactory<TCHAR,
|
||||
TCondensedJsonPrintPolicy<TCHAR>>::Create(&BridgeJson);
|
||||
if (!FJsonSerializer::Serialize(BridgeRoot.ToSharedRef(), BridgeWriter))
|
||||
{
|
||||
OutError = TEXT("Matched legacy-bridge timing could not serialize the bridge snapshot.");
|
||||
return false;
|
||||
}
|
||||
BridgeWriter->Close();
|
||||
|
||||
FTCHARToUTF8 BridgeUtf8(*BridgeJson);
|
||||
std::string BridgeError;
|
||||
std::optional<VoxelForgeCore::ResolvedWorldSnapshot> BridgeSnapshot =
|
||||
VoxelForgeCore::ResolvedWorldSnapshot::FromJson(
|
||||
std::string_view(BridgeUtf8.Get(), static_cast<std::size_t>(BridgeUtf8.Length())),
|
||||
BridgeError);
|
||||
if (!BridgeSnapshot || BridgeSnapshot->worldAssembly() != nullptr)
|
||||
{
|
||||
OutError = FString::Printf(
|
||||
TEXT("Matched legacy-bridge snapshot failed validation or retained a native plan: %s"),
|
||||
UTF8_TO_TCHAR(BridgeError.c_str()));
|
||||
return false;
|
||||
}
|
||||
VoxelForgeCore::World BridgeWorld(std::move(*BridgeSnapshot));
|
||||
FStandaloneCoreAdapterScheduler BridgeScheduler;
|
||||
if (!BridgeWorld.compile(MatchedTimingInitialRequest, BridgeScheduler, BridgeError))
|
||||
{
|
||||
OutError = FString::Printf(TEXT("Matched legacy-bridge initial compile failed: %s"),
|
||||
UTF8_TO_TCHAR(BridgeError.c_str()));
|
||||
return false;
|
||||
}
|
||||
BridgeWorld.retainTileRegions(MatchedTimingInitialDesired);
|
||||
const double BridgeRegionCompileStart = FPlatformTime::Seconds();
|
||||
BridgeWorld.retainTileRegions(MatchedTimingSurfaceDesired);
|
||||
VoxelForgeCore::TileRegionCompileStats BridgeRegionStats;
|
||||
if (!BridgeWorld.compileTileRegion(MatchedTimingSurfaceMissingFine, 16, BridgeScheduler,
|
||||
BridgeError, nullptr, &BridgeRegionStats))
|
||||
{
|
||||
OutError = FString::Printf(TEXT("Matched legacy-bridge surface compile failed: %s"),
|
||||
UTF8_TO_TCHAR(BridgeError.c_str()));
|
||||
return false;
|
||||
}
|
||||
const double BridgeSurfaceRegionCompileSeconds = FPlatformTime::Seconds()
|
||||
- BridgeRegionCompileStart;
|
||||
VoxelForgeCore::TileGenerationOptions BridgeTileOptions;
|
||||
BridgeTileOptions.hashDensity = true;
|
||||
double BridgeSurfaceTileGenerationSeconds = 0.0;
|
||||
std::uint64_t BridgeSurfaceTriangleCount = 0;
|
||||
std::size_t BridgeSurfaceTilesGenerated = 0;
|
||||
for (const VoxelForgeCore::TileKey& Key : MatchedTimingSurfaceDesired)
|
||||
{
|
||||
const double TileGenerationStart = FPlatformTime::Seconds();
|
||||
const std::optional<VoxelForgeCore::TileMesh> Mesh =
|
||||
BridgeWorld.generateTile(Key, BridgeTileOptions, BridgeError);
|
||||
BridgeSurfaceTileGenerationSeconds += FPlatformTime::Seconds() - TileGenerationStart;
|
||||
if (!Mesh || !Mesh->hasDensityHash || !Mesh->hasMeshHash
|
||||
|| !Mesh->hasPayloadHash || !Mesh->hasTopologyHash)
|
||||
{
|
||||
OutError = FString::Printf(TEXT("Matched legacy-bridge tile generation failed: %s"),
|
||||
UTF8_TO_TCHAR(BridgeError.c_str()));
|
||||
return false;
|
||||
}
|
||||
BridgeSurfaceTriangleCount += Mesh->indices.size() / 3;
|
||||
++BridgeSurfaceTilesGenerated;
|
||||
}
|
||||
if (BridgeSurfaceTilesGenerated != MatchedTimingSurfaceDesired.size())
|
||||
{
|
||||
OutError = TEXT("Matched legacy-bridge timing did not generate the complete surface key set.");
|
||||
return false;
|
||||
}
|
||||
const double NativeTotal = NativeSurfaceRegionCompileSeconds
|
||||
+ NativeSurfaceTileGenerationSeconds;
|
||||
const double BridgeTotal = BridgeSurfaceRegionCompileSeconds
|
||||
+ BridgeSurfaceTileGenerationSeconds;
|
||||
UE_LOG(LogTemp, Display,
|
||||
TEXT("[VoxelForgeCoreWorldTest] matched_surface_tile_timing=1 native_backend=heightfield2d bridge_backend=legacy_surface_bridge same_keys=1 tiles=%llu hashes=on native_region_compile_s=%.6f bridge_region_compile_s=%.6f native_tile_generation_s=%.6f bridge_tile_generation_s=%.6f native_compile_plus_tiles_s=%.6f bridge_compile_plus_tiles_s=%.6f speedup=%.3fx native_triangles=%llu bridge_triangles=%llu"),
|
||||
static_cast<unsigned long long>(MatchedTimingSurfaceDesired.size()),
|
||||
NativeSurfaceRegionCompileSeconds, BridgeSurfaceRegionCompileSeconds,
|
||||
NativeSurfaceTileGenerationSeconds, BridgeSurfaceTileGenerationSeconds,
|
||||
NativeTotal, BridgeTotal, BridgeTotal / FMath::Max(NativeTotal, 1.0e-9),
|
||||
static_cast<unsigned long long>(NativeSurfaceTriangleCount),
|
||||
static_cast<unsigned long long>(BridgeSurfaceTriangleCount));
|
||||
|
||||
const UWorld::InitializationValues WorldInitialization = UWorld::InitializationValues()
|
||||
.AllowAudioPlayback(false)
|
||||
.RequiresHitProxies(false)
|
||||
@@ -13901,7 +14176,6 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
|
||||
}
|
||||
}
|
||||
|
||||
const int32 CollisionRadius = FMath::Clamp(AuthoredSettings->PawnCollisionRadiusChunks, 1, 4);
|
||||
TSet<FVoxelTileKey> ExpectedCollisionSet;
|
||||
int32 ExpectedBodyCount = 0;
|
||||
int32 ExpectedNoBodyCount = 0;
|
||||
@@ -14178,6 +14452,21 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (bVisualTilesReady)
|
||||
{
|
||||
for (const FVoxelTileKey& Key : ExpectedSurfaceCollisionSet)
|
||||
{
|
||||
const FVoxelForgeCoreTileHashRecord* Expected = ExpectedSurfaceTravelHashes.Find(Key);
|
||||
const bool bExpectedBody = Expected != nullptr && !Expected->bEmpty;
|
||||
if (!Actor->CollisionDesiredTiles.Contains(Key)
|
||||
|| (bExpectedBody && !Actor->CollisionReadyTiles.Contains(Key))
|
||||
|| (!bExpectedBody && !Actor->CollisionNotRequiredTiles.Contains(Key)))
|
||||
{
|
||||
bVisualTilesReady = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bVisualTilesReady) return true;
|
||||
}
|
||||
return false;
|
||||
@@ -14201,6 +14490,39 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
|
||||
return false;
|
||||
}
|
||||
|
||||
int32 ActualSurfaceCollisionReady = 0;
|
||||
int32 ActualSurfaceCollisionNoBody = 0;
|
||||
for (const FVoxelTileKey& Key : ExpectedSurfaceCollisionSet)
|
||||
{
|
||||
const FVoxelForgeCoreTileHashRecord& Expected = ExpectedSurfaceTravelHashes.FindChecked(Key);
|
||||
if (!Actor->CollisionDesiredTiles.Contains(Key))
|
||||
{
|
||||
OutError = FString::Printf(TEXT("Native-surface collision tile (%d,%d,%d) was not requested."),
|
||||
Key.Coord.X, Key.Coord.Y, Key.Coord.Z);
|
||||
return false;
|
||||
}
|
||||
if (Expected.bEmpty)
|
||||
{
|
||||
if (!Actor->CollisionNotRequiredTiles.Contains(Key))
|
||||
{
|
||||
OutError = FString::Printf(TEXT("Native-surface empty tile (%d,%d,%d) has unexpected collision state."),
|
||||
Key.Coord.X, Key.Coord.Y, Key.Coord.Z);
|
||||
return false;
|
||||
}
|
||||
++ActualSurfaceCollisionNoBody;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Actor->CollisionReadyTiles.Contains(Key))
|
||||
{
|
||||
OutError = FString::Printf(TEXT("Native-surface solid tile (%d,%d,%d) has no cooked collision body."),
|
||||
Key.Coord.X, Key.Coord.Y, Key.Coord.Z);
|
||||
return false;
|
||||
}
|
||||
++ActualSurfaceCollisionReady;
|
||||
}
|
||||
}
|
||||
|
||||
TSet<FVoxelTileKey> ActualSurfaceVisualDesiredSet;
|
||||
std::vector<VoxelForgeCore::TileKey> ActorSurfaceTravelDesired;
|
||||
ActorSurfaceTravelDesired.reserve(static_cast<std::size_t>(Actor->DesiredSorted.Num()));
|
||||
@@ -14231,14 +14553,31 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
|
||||
const FVoxelForgeCoreTileHashRecord* Actual = Actor->VoxelForgeCoreTileHashes.Find(Key);
|
||||
const FVoxelForgeCoreTileHashRecord* Expected = ExpectedSurfaceTravelHashes.Find(Key);
|
||||
if (Actual == nullptr || Expected == nullptr || !Actual->bHasHashes
|
||||
|| (!Expected->bEmpty && !Actor->LoadedTiles.Contains(Key))
|
||||
|| Actual->Density != Expected->Density || Actual->Mesh != Expected->Mesh
|
||||
|| (!Expected->bEmpty && !Actor->LoadedTiles.Contains(Key)))
|
||||
{
|
||||
OutError = FString::Printf(
|
||||
TEXT("Core actor surface-strate tile state is incomplete at (%d,%d,%d) lod=%d (actual=%d expected=%d hashed=%d loaded=%d)."),
|
||||
Key.Coord.X, Key.Coord.Y, Key.Coord.Z, Key.Level,
|
||||
Actual ? 1 : 0, Expected ? 1 : 0, Actual && Actual->bHasHashes ? 1 : 0,
|
||||
Actor->LoadedTiles.Contains(Key) ? 1 : 0);
|
||||
return false;
|
||||
}
|
||||
if (Actual->Density != Expected->Density || Actual->Mesh != Expected->Mesh
|
||||
|| Actual->Payload != Expected->Payload || Actual->Topology != Expected->Topology
|
||||
|| Actual->Triangles != Expected->Triangles || Actual->bEmpty != Expected->bEmpty)
|
||||
{
|
||||
OutError = FString::Printf(
|
||||
TEXT("Core actor surface-strate tile differs from standalone Core at (%d,%d,%d) lod=%d."),
|
||||
Key.Coord.X, Key.Coord.Y, Key.Coord.Z, Key.Level);
|
||||
TEXT("Core actor surface-strate hash mismatch at (%d,%d,%d) lod=%d; density=%016llx/%016llx mesh=%016llx/%016llx payload=%016llx/%016llx topology=%016llx/%016llx triangles=%d/%d empty=%d/%d."),
|
||||
Key.Coord.X, Key.Coord.Y, Key.Coord.Z, Key.Level,
|
||||
static_cast<unsigned long long>(Actual->Density),
|
||||
static_cast<unsigned long long>(Expected->Density),
|
||||
static_cast<unsigned long long>(Actual->Mesh),
|
||||
static_cast<unsigned long long>(Expected->Mesh),
|
||||
static_cast<unsigned long long>(Actual->Payload),
|
||||
static_cast<unsigned long long>(Expected->Payload),
|
||||
static_cast<unsigned long long>(Actual->Topology),
|
||||
static_cast<unsigned long long>(Expected->Topology),
|
||||
Actual->Triangles, Expected->Triangles, Actual->bEmpty ? 1 : 0, Expected->bEmpty ? 1 : 0);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -14255,20 +14594,20 @@ bool RunCoreWorldActorIntegrationTest(const FExploreArguments& Arguments, FStrin
|
||||
*SurfaceCoverageError);
|
||||
return false;
|
||||
}
|
||||
const FVoxelBiomeQuery SurfaceBiome = Actor->GetBiomeAtWorldLocation(SurfaceWorldPosition);
|
||||
if (!SurfaceBiome.bHasBiomes || SurfaceBiome.DominantContextIndex < 0)
|
||||
if (!bNativeBiomeFieldValidated || NativeBiomeIdsSampled < 2)
|
||||
{
|
||||
OutError = TEXT("Core-mode biome query returned no dominant biome at the authored surface-strate fixture.");
|
||||
OutError = TEXT("Core native SurfaceWorld biome validation did not complete.");
|
||||
return false;
|
||||
}
|
||||
UE_LOG(LogTemp, Display,
|
||||
TEXT("[VoxelForgeCoreWorldTest] pass phase=surface_strate_travel center=(%.3f,%.3f,%.3f) desired=%d loaded=%d fine_compiled=%llu regions=%llu local_tiles=%d checked_faces=%d lod_transition_faces=%d biome_index=%d biome=%s density=0x%016llx mesh=0x%016llx payload=0x%016llx topology=0x%016llx"),
|
||||
TEXT("[VoxelForgeCoreWorldTest] pass phase=surface_strate_travel center=(%.3f,%.3f,%.3f) desired=%d loaded=%d fine_compiled=%llu regions=%llu local_tiles=%d checked_faces=%d lod_transition_faces=%d collision_desired=%d collision_ready=%d collision_no_body=%d native_surface_biome_id=%u native_biomes_sampled=%d density=0x%016llx mesh=0x%016llx payload=0x%016llx topology=0x%016llx"),
|
||||
SurfaceCameraVoxels.x, SurfaceCameraVoxels.y, SurfaceCameraVoxels.z,
|
||||
ActualSurfaceVisualDesiredSet.Num(), Actor->LoadedTiles.Num(),
|
||||
static_cast<unsigned long long>(SurfaceTravelFineTilesCompiled),
|
||||
static_cast<unsigned long long>(SurfaceTravelRegionsBuilt), ActorSurfaceLocalTiles,
|
||||
ActorSurfaceCheckedFaces, ActorSurfaceTransitionFaces,
|
||||
SurfaceBiome.DominantContextIndex, *SurfaceBiome.DominantName.ToString(),
|
||||
ActorSurfaceCheckedFaces, ActorSurfaceTransitionFaces, ExpectedSurfaceCollisionSet.Num(),
|
||||
ActualSurfaceCollisionReady, ActualSurfaceCollisionNoBody,
|
||||
NativeSurfaceBiomeId, NativeBiomeIdsSampled,
|
||||
static_cast<unsigned long long>(SurfaceTravelAggregates[0]),
|
||||
static_cast<unsigned long long>(SurfaceTravelAggregates[1]),
|
||||
static_cast<unsigned long long>(SurfaceTravelAggregates[2]),
|
||||
|
||||
Reference in new issue
Block a user