From 2b38d2dcddc24e3ded72ec306e6e9a9438da11ea Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 14 Sep 2026 18:23:55 +0200 Subject: [PATCH] Seed zones from CultMath's PCG hash and pin CultMath 0.2.3 Cut 8a seeded ZoneGenerator's Random from the float bits of CultMath's hash(float2), the frac(sin) shader hash. On a 100x100 position grid that gives 1625 distinct values, where Unity.Mathematics' uint hash separated them. CultMath 0.2.3 adds the PCG integer hashes from Jarzynski and Olano (JCGT 2020), so the seed now uses pcg3d(Position).x, the IEEE bits of the float2 position with z held at 0, xored with the zone-name term as before. - Packages/manifest.json and packages-lock.json pin cultmath-unity-v0.2.3 (CultLib 0f2c1f04). - Directory.Build.props sets CultLibRevision to the same commit. This pin also brings in 0.2.2's normalize: a zero vector now gives NaN, as dxc does and as Unity.Mathematics did before the swap. None of Cut 8a's normalize or LookRotation edits relied on a zero-safe normalize. They are one-to-one type conversions, and 8a removed no guard. So no guard is added. Verified: headless Aetheria.Shared and AetherDb builds with 0 errors. AetherDb census, factions and hardpoint-fit are byte-identical to the captures. Unity 6000.3.24f1 batchmode compile gives 0 errors. Co-Authored-By: Claude Opus 5 --- Assets/Scripts/ServerShared/ZoneGenerator.cs | 2 +- Directory.Build.props | 2 +- Packages/manifest.json | 2 +- Packages/packages-lock.json | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Assets/Scripts/ServerShared/ZoneGenerator.cs b/Assets/Scripts/ServerShared/ZoneGenerator.cs index 948eb79ff..f75526adc 100644 --- a/Assets/Scripts/ServerShared/ZoneGenerator.cs +++ b/Assets/Scripts/ServerShared/ZoneGenerator.cs @@ -44,7 +44,7 @@ public static class ZoneGenerator { var pack = new ZonePack(); - var random = new Random(unchecked((uint) galaxyZone.Name.GetHashCode()) ^ (uint) BitConverter.SingleToInt32Bits(hash(galaxyZone.Position))); + var random = new Random(unchecked((uint) galaxyZone.Name.GetHashCode()) ^ (uint) pcg3d(galaxyZone.Position).x); var density = saturate(galaxy.Background.CloudDensity(galaxyZone.Position)/2); pack.Radius = zoneSettings.ZoneRadius.Evaluate(density); diff --git a/Directory.Build.props b/Directory.Build.props index d8d359c6b..3bd4b9191 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -2,7 +2,7 @@ $(CULTLIB_ROOT) $(MSBuildThisFileDirectory)..\CultLib - f0605367e0d7e57941a57bacb0b8cb8d893073be + 0f2c1f04ef66a8b85c507747c508960ff1417ae0 C:\Program Files\Git\cmd\git.exe git diff --git a/Packages/manifest.json b/Packages/manifest.json index 2b9bf1f6b..104c90df3 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -50,6 +50,6 @@ "com.unity.modules.vr": "1.0.0", "com.unity.modules.wind": "1.0.0", "com.unity.modules.xr": "1.0.0", - "org.gamecult.cultmath": "https://github.com/GameCult/CultLib.git?path=/packages/cultmath/unity/org.gamecult.cultmath#cultmath-unity-v0.2.1" + "org.gamecult.cultmath": "https://github.com/GameCult/CultLib.git?path=/packages/cultmath/unity/org.gamecult.cultmath#cultmath-unity-v0.2.3" } } diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 6ea384cf2..dcde8fc0f 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -243,11 +243,11 @@ "url": "https://packages.unity.com" }, "org.gamecult.cultmath": { - "version": "https://github.com/GameCult/CultLib.git?path=/packages/cultmath/unity/org.gamecult.cultmath#cultmath-unity-v0.2.1", + "version": "https://github.com/GameCult/CultLib.git?path=/packages/cultmath/unity/org.gamecult.cultmath#cultmath-unity-v0.2.3", "depth": 0, "source": "git", "dependencies": {}, - "hash": "f0605367e0d7e57941a57bacb0b8cb8d893073be" + "hash": "0f2c1f04ef66a8b85c507747c508960ff1417ae0" }, "com.unity.modules.accessibility": { "version": "1.0.0",