57fe6bf173
Proves Theriapolis.Core works untouched under Godot's csproj — the worldgen
pipeline produces byte-identical output whether invoked from the Tools CLI
or from inside the Godot process. This is the determinism contract surviving
the port.
Architecture test:
CoreNoDependencyTests now forbids Godot.* and GodotSharp in addition to
Microsoft.Xna and MonoGame. Both bans stay in force for the duration of
the port so neither engine can leak into Core.
Determinism oracle:
New worldgen-hash Tools command runs the full pipeline and prints FNV-1a
hashes for every channel (elevation, moisture, temperature, biomes,
settlements, polylines) plus per-stage hashes. Pairs with the Godot
smoke-test for cross-process verification.
Godot-side smoke test:
SmokeTest.cs runs WorldGenerator.RunAll inside the Godot process; Main.cs
fires it on --smoke-test <seed>. Resolves Content/Data via res:// walk-up.
M0 hello-world behaviour preserved when launched without the flag.
Verification (seed 12345):
- dotnet run -- worldgen-hash and Godot --headless --smoke-test agree on
all 6 channels and all 14 per-stage hashes (diff produces zero output)
- 10-run sweeps stable on both sides post-determinism-fix
- dotnet test: 708/708 pass
Closes M1 of theriapolis-rpg-implementation-plan-godot-port.md.
Next: M2 (world map render).
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
45 lines
1.2 KiB
C#
45 lines
1.2 KiB
C#
using Godot;
|
|
|
|
namespace Theriapolis.GodotHost;
|
|
|
|
public partial class Main : Node
|
|
{
|
|
public override void _Ready()
|
|
{
|
|
var args = OS.GetCmdlineUserArgs();
|
|
ulong? smokeTestSeed = null;
|
|
for (int i = 0; i < args.Length; i++)
|
|
{
|
|
if (args[i] == "--smoke-test")
|
|
{
|
|
ulong seed = 12345UL;
|
|
if (i + 1 < args.Length && ulong.TryParse(args[i + 1], out var parsed))
|
|
seed = parsed;
|
|
smokeTestSeed = seed;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (smokeTestSeed.HasValue)
|
|
{
|
|
int code = SmokeTest.Run(smokeTestSeed.Value);
|
|
GetTree().Quit(code);
|
|
return;
|
|
}
|
|
|
|
GD.Print("Theriapolis.Godot host ready (M0 hello-world).");
|
|
}
|
|
|
|
public override void _UnhandledInput(InputEvent @event)
|
|
{
|
|
if (@event.IsActionPressed("ui_toggle_fullscreen"))
|
|
{
|
|
var mode = DisplayServer.WindowGetMode();
|
|
DisplayServer.WindowSetMode(
|
|
mode == DisplayServer.WindowMode.Fullscreen
|
|
? DisplayServer.WindowMode.Windowed
|
|
: DisplayServer.WindowMode.Fullscreen);
|
|
}
|
|
}
|
|
}
|