Files

44 lines
1.7 KiB
C#
Raw Permalink Normal View History

using Godot;
using System.IO;
using System.Linq;
using Theriapolis.Core.World.Generation;
using Theriapolis.GodotHost.Platform;
namespace Theriapolis.GodotHost;
/// <summary>
/// M1 determinism oracle. Runs the full Core worldgen pipeline from inside
/// the Godot process and prints FNV hashes. Output must match
/// <c>dotnet run --project Theriapolis.Tools -- worldgen-hash --seed N</c>
/// byte-for-byte. This proves Core works untouched under Godot's csproj.
/// </summary>
public static class SmokeTest
{
public static int Run(ulong seed)
{
string dataDir = ContentPaths.DataDir;
if (!Directory.Exists(dataDir))
{
GD.PrintErr($"[smoke-test] Data directory not found: {dataDir}");
return 1;
}
GD.Print($"[smoke-test] seed=0x{seed:X} data-dir={dataDir}");
var ctx = new WorldGenContext(seed, dataDir);
WorldGenerator.RunAll(ctx);
var w = ctx.World;
GD.Print($"[smoke-test] === FNV hashes ===");
GD.Print($"[smoke-test] elevation = 0x{w.HashElevation():X16}");
GD.Print($"[smoke-test] moisture = 0x{w.HashMoisture():X16}");
GD.Print($"[smoke-test] temperature = 0x{w.HashTemperature():X16}");
GD.Print($"[smoke-test] biomes = 0x{w.HashBiomes():X16}");
GD.Print($"[smoke-test] settlements = 0x{w.HashSettlements():X16}");
GD.Print($"[smoke-test] polylines = 0x{w.HashPolylines():X16}");
GD.Print($"[smoke-test] === Per-stage hashes ({w.StageHashes.Count}) ===");
foreach (var kv in w.StageHashes.OrderBy(k => k.Key, System.StringComparer.Ordinal))
GD.Print($"[smoke-test] {kv.Key,-32} = 0x{kv.Value:X16}");
return 0;
}
}