Load Zyphos fractal terrain from aquageo patch

This commit is contained in:
Meta Vens 2026-05-18 03:24:50 +01:00
commit db8f767c4a
5 changed files with 16 additions and 10 deletions

View file

@ -17,6 +17,7 @@
<ItemGroup>
<Content Include="Shaders\**\*.hlsl" CopyToOutputDirectory="PreserveNewest" TargetPath="Render\Shaders\%(RecursiveDir)%(Filename)%(Extension)" />
<Content Include="Shaders\**\*.hlsli" CopyToOutputDirectory="PreserveNewest" TargetPath="Render\Shaders\%(RecursiveDir)%(Filename)%(Extension)" />
<Content Include="Worlds\**\*.aquageo" CopyToOutputDirectory="PreserveNewest" TargetPath="Worlds\%(RecursiveDir)%(Filename)%(Extension)" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,5 @@
# Zyphos first Aquarium fractal terrain DSL proof.
tile PositiveZ 0 0 0 zyphos/first-fractal-terrain
height basin 0 0 30 30 0 3 1 -0.12 7 basin
ifs crater 3 2 -5 3 6 2.5 0.48 2.6 0.42 4 0.85 -0.10 19 crater
ifs ridge 2 3 6 -4 5 1.35 0.45 3.2 -0.27 3.6 0.72 0.075 31 ridge

View file

@ -9,19 +9,16 @@ namespace Aquarium.Zyphos;
public static class ZyphosFractalTerrain
{
public const string Grammar = """
# Zyphos first Aquarium fractal terrain DSL proof.
tile PositiveZ 0 0 0 zyphos/first-fractal-terrain
height basin 0 0 30 30 0 3 1 -0.12 7 basin
ifs crater 3 2 -5 3 6 2.5 0.48 2.6 0.42 4 0.85 -0.10 19 crater
ifs ridge 2 3 6 -4 5 1.35 0.45 3.2 -0.27 3.6 0.72 0.075 31 ridge
""";
private const string PatchRelativePath = "Worlds/zyphos-first-fractal-terrain.aquageo";
private static readonly Lazy<FractalOwnershipTree> Tree = new(() => FractalDslCompiler.Compile(Grammar));
private static readonly Lazy<string> PatchSource = new(() => File.ReadAllText(PatchPath));
private static readonly Lazy<FractalOwnershipTree> Tree = new(() => FractalDslCompiler.Compile(PatchSource.Value));
private static readonly Lazy<AquariumFractalSummary[]> Summaries = new(() => FractalSummaryBuilder.Build(Tree.Value));
private static readonly Lazy<AquariumSelectedCut[]> SelectedCut = new(() => FractalSelectedCutBuilder.Build(Summaries.Value, _ => 8.0f, maxEstimatedCost: 8.0f));
private static readonly Lazy<AquariumHeightFieldBrush[]> Brushes = new(() => FractalHeightBrushCompiler.CompileMany(Tree.Value.Claims));
public static string PatchPath => Path.Combine(AppContext.BaseDirectory, PatchRelativePath);
public static FractalOwnershipTree OwnershipTree => Tree.Value;
public static AquariumHeightFieldBrush[] HeightBrushes => Brushes.Value;
@ -29,5 +26,5 @@ public static class ZyphosFractalTerrain
public static string DebugDump => FractalDebugDump.Build(OwnershipTree, Summaries.Value, SelectedCut.Value);
public static string Summary =>
$"{OwnershipTree.Claims.Count} DSL claims / {OwnershipTree.Nodes.Count} node / {SelectedCut.Value.Length} cuts / {HeightBrushes.Length} shaped brushes";
$"{Path.GetFileName(PatchPath)} / {OwnershipTree.Claims.Count} DSL claims / {OwnershipTree.Nodes.Count} node / {SelectedCut.Value.Length} cuts / {HeightBrushes.Length} shaped brushes";
}

View file

@ -134,3 +134,4 @@
{"timestamp":"2026-05-18T06:18:00+01:00","topic":"fractal-debug-dump","lesson":"Fractal worlds now have a text debug dump that reports domain, nodes, claims, summaries, and selected cuts. Zyphos exposes this through the `zyphos-fractal` command so the rendered DSL terrain can be inspected as authored semantic rows and LOD decisions instead of inferred from pixels alone.","files":["src/Aquarium.Engine.Fractal/Debug/FractalDebugDump.cs","src/Aquarium.Zyphos/ZyphosFractalTerrain.cs","src/Aquarium.Zyphos/ZyphosRuntime.cs","tests/Aquarium.Engine.Fractal.Tests/FractalDebugDumpTests.cs"],"source":"observability pass after wiring Zyphos to the fractal DSL renderer path"}
{"timestamp":"2026-05-18T06:29:00+01:00","topic":"zyphos-height-brush-table-budget","lesson":"Zyphos' first DSL terrain grammar must currently emit no more than eight height brushes because `D3D12HeightFieldBrushConstants.MaxBrushCount` is still 8. Do not let the demo silently author more claims than the renderer draws; either keep the visible grammar within the fixed table or make the height brush table dynamic before increasing recursive density.","files":["src/Aquarium.Zyphos/ZyphosFractalTerrain.cs","tests/Aquarium.Engine.Fractal.Tests/ZyphosFractalTerrainTests.cs","src/Aquarium.Engine/Render/Features/D3D12HeightFieldBrushConstants.cs"],"source":"runtime proof pass noticed the DSL emitted 12 claims while the current height brush constant table renders only 8"}
{"timestamp":"2026-05-18T06:43:00+01:00","topic":"height-brush-table-sixteen","lesson":"The fixed D3D12 height-field brush table now carries 16 brushes, so Zyphos can render its 12-claim DSL terrain without silent truncation. This is still a bounded interim table, not the final streaming brush backend; before raising recursive density further, move height brush packets to a structured buffer or selected-cut page stream.","files":["src/Aquarium.Engine/Render/Features/D3D12HeightFieldBrushConstants.cs","src/Aquarium.Engine/Render/Shaders/D3D12HeightField.hlsl","src/Aquarium.Zyphos/ZyphosFractalTerrain.cs","tests/Aquarium.Engine.Fractal.Tests/ZyphosFractalTerrainTests.cs"],"source":"follow-up after detecting the fixed eight-brush table clipped the first Zyphos DSL terrain"}
{"timestamp":"2026-05-18T06:58:00+01:00","topic":"aquageo-world-patch-files","lesson":"Aquarium fractal world DSL patches should be authored as `.aquageo` content files, copied into the client output, and loaded from disk at runtime. Zyphos' first terrain proof now loads `Worlds/zyphos-first-fractal-terrain.aquageo`; do not keep demo grammars embedded as fallback strings because that hides asset pipeline failures.","files":["src/Aquarium.Zyphos/Worlds/zyphos-first-fractal-terrain.aquageo","src/Aquarium.Zyphos/ZyphosFractalTerrain.cs","src/Aquarium.Zyphos/Aquarium.Zyphos.csproj","tests/Aquarium.Engine.Fractal.Tests/ZyphosFractalTerrainTests.cs"],"source":"user asked to load the world DSL patch via file and call it .aquageo"}

View file

@ -10,6 +10,8 @@ public sealed class ZyphosFractalTerrainTests
var tree = ZyphosFractalTerrain.OwnershipTree;
var brushes = ZyphosFractalTerrain.HeightBrushes;
Assert.EndsWith(".aquageo", ZyphosFractalTerrain.PatchPath, StringComparison.Ordinal);
Assert.True(File.Exists(ZyphosFractalTerrain.PatchPath), $"Expected copied aquageo patch at {ZyphosFractalTerrain.PatchPath}.");
Assert.Equal(12, tree.Claims.Count);
Assert.Equal(tree.Claims.Count, brushes.Length);
Assert.Contains(tree.Claims, claim => claim.Tags == "crater");