Split Epiphany client from engine runtime

This commit is contained in:
Meta Vens 2026-05-12 02:13:45 +01:00
commit a5f5103926
21 changed files with 169 additions and 85 deletions

View file

@ -11,7 +11,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aquarium.Engine", "src\Aqua
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CultMath", "..\CultMath\src\CultMath\CultMath.csproj", "{0089E341-25F2-43FC-8FD9-CBD1AE646D91}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aquarium.Engine.Live", "src\Aquarium.Engine.Live\Aquarium.Engine.Live.csproj", "{33654E0D-B31A-4062-B6AC-C1CE4C1A1F65}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aquarium.Epiphany", "src\Aquarium.Epiphany\Aquarium.Epiphany.csproj", "{33654E0D-B31A-4062-B6AC-C1CE4C1A1F65}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GameCult.Caching.MessagePack", "..\CultLib\src\GameCult.Caching.MessagePack\GameCult.Caching.MessagePack.csproj", "{A8EDAE19-805B-4B09-9566-BE63937CA1B9}"
EndProject

View file

@ -2,6 +2,6 @@
<Folder Name="/src/">
<Project Path="src/Aquarium.Engine.Contracts/Aquarium.Engine.Contracts.csproj" />
<Project Path="src/Aquarium.Engine/Aquarium.Engine.csproj" />
<Project Path="src/Aquarium.Engine.Live/Aquarium.Engine.Live.csproj" />
<Project Path="src/Aquarium.Epiphany/Aquarium.Epiphany.csproj" />
</Folder>
</Solution>

View file

@ -25,9 +25,9 @@ Aquarium world in HLSL, and draws crisp overlay text through DirectWrite. The
camera target is the Grid center. Grid radius follows zoom distance. Body anchors
remain world-space.
The live runtime is split behind `Aquarium.Engine.Contracts`, so gameplay code
can reload while the host, window, renderer, and D3D device stay alive. Runtime
state is banked through CultCache MessagePack documents instead of loose JSON.
The Epiphany client is split behind `Aquarium.Engine.Contracts`, so client code
can reload while the engine host, window, renderer, and D3D device stay alive.
Runtime state is banked through CultCache MessagePack documents instead of loose JSON.
## Run
@ -37,7 +37,7 @@ Aquarium currently expects the sibling `CultMath` and `CultLib` repos at
```powershell
dotnet build Aquarium.Engine.slnx
dotnet run --project src\Aquarium.Engine\Aquarium.Engine.csproj
dotnet run --project src\Aquarium.Engine\Aquarium.Engine.csproj -- --client-assembly src\Aquarium.Epiphany\bin\Debug\net10.0\Aquarium.Epiphany.dll
```
For Rider, open `Aquarium.Engine.sln`. The `.slnx` stays as the compact
@ -95,15 +95,15 @@ shaders in the running process, then swaps the D3D shader objects only after
compilation succeeds. A bad shader edit leaves the previous working shaders
bound and writes the compiler failure to stderr.
Live gameplay/runtime code is split into `Aquarium.Engine.Live` behind
`Aquarium.Engine.Contracts`. The host loads that live DLL through a collectible
assembly load context, while `dev-watch.ps1` builds live-only changes into
Epiphany client/runtime code is split into `Aquarium.Epiphany` behind
`Aquarium.Engine.Contracts`. The host loads that client DLL through a collectible
assembly load context, while `dev-watch.ps1` builds client-only changes into
`artifacts\dev-reload\live-slots` and updates `live-current.txt`. The running
host sees the pointer change, loads and starts the new runtime first, then
disposes the old one only after the replacement is valid. A bad live DLL leaves
disposes the old one only after the replacement is valid. A bad client DLL leaves
the previous runtime alive and reports the reload failure to stderr. The watcher
waits for the host log to acknowledge the exact live DLL path before calling a
live reload successful; pointer updates without host acknowledgement are treated
waits for the host log to acknowledge the exact client DLL path before calling a
client reload successful; pointer updates without host acknowledgement are treated
as reload failures. Successful reloads rehydrate through CultCache without
restarting the window or D3D device.
Host, renderer, contract, project, script, and `src\Aquarium.Engine\Assets`
@ -125,7 +125,7 @@ Stop the script-owned Aquarium process:
Headless smoke:
```powershell
dotnet run --project src\Aquarium.Engine\Aquarium.Engine.csproj -- --headless
dotnet run --project src\Aquarium.Engine\Aquarium.Engine.csproj -- --headless --client-assembly src\Aquarium.Epiphany\bin\Debug\net10.0\Aquarium.Epiphany.dll
```
Headless reload smoke without touching the normal build output:
@ -147,7 +147,7 @@ Shipping publish:
```
This writes a self-contained Windows build to
`artifacts\publish\win-x64`, verifies the executable, live runtime DLL,
`artifacts\publish\win-x64`, verifies the executable, Epiphany client DLL,
contracts DLL, icon, bundled fonts, and shader source, then optionally creates
`artifacts\publish\EpiphanyAquariumEngine-win-x64.zip`.
@ -166,6 +166,7 @@ go out with the trash; the repo is not a scrapbook.
## Docs
- `docs/aquarium-engine-doctrine.md`: engine doctrine and invariants.
- `docs/engine-client-boundary.md`: Engine/Epiphany ownership split.
- `docs/vortice-spine.md`: native host/renderer spine.
- `docs/hlsl-renderer.md`: current shader path.
- `docs/input.md`: camera and input contract.

View file

@ -48,11 +48,11 @@ It stores global renderer presentation controls: render debug mode, scene
exposure, bloom intensity, and bloom veil intensity. `GraphicsSettings` lives in
the contracts assembly so the native host and renderer can consume the same
typed values without depending on CultCache internals. The Direct2D debug panel
edits the renderer copy, the host syncs changed values back to the live runtime,
edits the renderer copy, the host syncs changed values back to the client runtime,
and the runtime persists dirty graphics settings through the same CultCache file
used for live state.
Live reload flushes the current runtime before loading the next live assembly,
Live reload flushes the current runtime before loading the next client assembly,
so changed graphics settings survive both process restart and assembly reload.
## CultNet Surface

View file

@ -0,0 +1,52 @@
# Engine And Client Boundary
Aquarium Engine is not the Epiphany frontend client.
`Aquarium.Engine` owns the native machinery: Win32 windowing, D3D12 device
state, swapchain presentation, resource lifetime, shader compilation, reload
transport, input translation, render target allocation, and future render graph
execution.
`Aquarium.Epiphany` owns the client meaning: CultCache runtime state, CultNet
interpretation, camera intent, cursor semantics, agent visual state, diegetic
layout rules, and the render graph configuration that turns Epiphany state into
world pixels.
## Hard Rules
- Engine code may expose rendering abstractions. It may not know Epiphany roles,
sub-agent identities, CultNet surface semantics, or frontend-specific layout
policy.
- Epiphany code may configure cameras, render targets, shader passes, body
registries, and resource bindings through engine APIs. It may not reach into
D3D12 implementation details.
- Hot reload is transport. It is not architecture. The reload boundary exists so
the client can change without killing the device, not so client policy can
leak into the engine under a nicer hat.
- If a feature name includes `Self`, `Face`, `Imagination`, `Eyes`, `Body`,
`Hands`, `Soul`, `Life`, `CultNet`, or Epiphany state semantics, the default
home is `Aquarium.Epiphany` unless it is a data-only contract.
- If a feature owns descriptors, command lists, fences, barriers, render target
transitions, shader object lifetime, or swapchain presentation, the default
home is `Aquarium.Engine`.
## Next Engine API Shape
The next durable renderer cut should make the client configure a small set of
engine primitives:
- Render targets: format, dimensions, history policy, clear policy, and exported
handles.
- Cameras: view/projection data, previous-frame data, jitter policy, and named
consumers.
- Shader passes: shader module, root bindings, target outputs, depth policy,
dispatch/draw shape, and reload identity.
- Scene resources: structured buffers, textures, samplers, body registries, and
light registries behind typed handles.
- Frame graph edges: explicit read/write dependencies so pass ordering is data,
not hidden renderer folklore.
Do not build this by piling adapters around the current monolith. First expose
the smallest real engine abstraction that lets `Aquarium.Epiphany` describe one
pass without D3D12 details. Then move one client-owned concept through it. Then
repeat.

View file

@ -21,7 +21,7 @@ keeping C# and Rider as the everyday working environment.
The renderer owns the visible Aquarium frame:
1. Camera and Grid constants come from the live runtime.
1. Camera and Grid constants come from the client runtime.
2. A Grid-space height pass renders the gravity/terrain height target.
3. A fullscreen D3D12 HLSL pass traces Self, planets, cursor, and the Grid event
lane.

View file

@ -13,7 +13,7 @@ Set-StrictMode -Version Latest
$repoRoot = Resolve-Path (Join-Path $PSScriptRoot "..")
$projectPath = Join-Path $repoRoot "src\Aquarium.Engine\Aquarium.Engine.csproj"
$liveProjectPath = Join-Path $repoRoot "src\Aquarium.Engine.Live\Aquarium.Engine.Live.csproj"
$liveProjectPath = Join-Path $repoRoot "src\Aquarium.Epiphany\Aquarium.Epiphany.csproj"
$devRoot = Join-Path $repoRoot "artifacts\dev-reload"
$slotRoot = Join-Path $devRoot "slots"
$visibleStatePath = Join-Path $devRoot "state.clixml"
@ -184,7 +184,7 @@ function Start-AquariumProcess {
}
if (-not (Test-Path $LiveAssemblyPath)) {
throw "Expected live runtime assembly does not exist: $LiveAssemblyPath"
throw "Expected client runtime assembly does not exist: $LiveAssemblyPath"
}
Set-Content -Path $liveReloadPointerPath -Value $LiveAssemblyPath -Encoding UTF8
@ -192,8 +192,8 @@ function Start-AquariumProcess {
$arguments = @(
"--cache", $cultCachePath,
"--shader-source", $shaderSourcePath,
"--live-assembly", $LiveAssemblyPath,
"--live-reload-pointer", $liveReloadPointerPath
"--client-assembly", $LiveAssemblyPath,
"--client-reload-pointer", $liveReloadPointerPath
)
if ($RunHeadless) {
$arguments += "--headless"
@ -234,7 +234,7 @@ function Reopen-VisibleProcess {
}
$slotPath = [string]$state.slot
$liveAssemblyPath = Join-Path $slotPath "Aquarium.Engine.Live.dll"
$liveAssemblyPath = Join-Path $slotPath "Aquarium.Epiphany.dll"
if ($state.PSObject.Properties.Name -contains "liveAssembly" -and $state.liveAssembly) {
$liveAssemblyPath = [string]$state.liveAssembly
}
@ -283,7 +283,7 @@ dotnet build $liveProjectPath `
-c Debug `
-o $slotPath
if ($LASTEXITCODE -ne 0) {
throw "live runtime build failed with exit code $LASTEXITCODE."
throw "client runtime build failed with exit code $LASTEXITCODE."
}
if ($BuildOnly) {
@ -301,13 +301,13 @@ if ($BuildOnly) {
Stop-PreviousOwnedProcess
$exePath = Join-Path $slotPath "Aquarium.Engine.exe"
$liveAssemblyPath = Join-Path $slotPath "Aquarium.Engine.Live.dll"
$liveAssemblyPath = Join-Path $slotPath "Aquarium.Epiphany.dll"
if (-not (Test-Path $exePath)) {
throw "Expected apphost was not produced: $exePath"
}
if (-not (Test-Path $liveAssemblyPath)) {
throw "Expected live runtime assembly was not produced: $liveAssemblyPath"
throw "Expected client runtime assembly was not produced: $liveAssemblyPath"
}
$process = Start-AquariumProcess -SlotPath $slotPath -LiveAssemblyPath $liveAssemblyPath -RunHeadless:$Headless

View file

@ -14,7 +14,7 @@ Set-StrictMode -Version Latest
$repoRoot = Resolve-Path (Join-Path $PSScriptRoot "..")
$reloadScript = Join-Path $PSScriptRoot "dev-reload.ps1"
$liveProjectPath = Join-Path $repoRoot "src\Aquarium.Engine.Live\Aquarium.Engine.Live.csproj"
$liveProjectPath = Join-Path $repoRoot "src\Aquarium.Epiphany\Aquarium.Epiphany.csproj"
$watchLogPath = Join-Path $repoRoot "artifacts\dev-reload\watch.log"
$liveSlotRoot = Join-Path $repoRoot "artifacts\dev-reload\live-slots"
$liveReloadPointerPath = Join-Path $repoRoot "artifacts\dev-reload\live-current.txt"
@ -70,13 +70,13 @@ function Get-SourceFiles {
function Get-LiveFiles {
Get-SourceFiles | Where-Object {
$_.FullName -like (Join-Path $repoRoot "src\Aquarium.Engine.Live\*")
$_.FullName -like (Join-Path $repoRoot "src\Aquarium.Epiphany\*")
}
}
function Get-RestartFiles {
Get-SourceFiles | Where-Object {
$_.FullName -notlike (Join-Path $repoRoot "src\Aquarium.Engine.Live\*")
$_.FullName -notlike (Join-Path $repoRoot "src\Aquarium.Epiphany\*")
}
}
@ -283,12 +283,12 @@ function Invoke-LiveReload {
Write-WatchLog "Live reload requested: $reason"
dotnet build $liveProjectPath -c Debug -o $liveSlot
if ($LASTEXITCODE -ne 0) {
throw "live runtime build failed with exit code $LASTEXITCODE."
throw "client runtime build failed with exit code $LASTEXITCODE."
}
$liveAssemblyPath = Join-Path $liveSlot "Aquarium.Engine.Live.dll"
$liveAssemblyPath = Join-Path $liveSlot "Aquarium.Epiphany.dll"
if (-not (Test-Path $liveAssemblyPath)) {
throw "Expected live runtime assembly was not produced: $liveAssemblyPath"
throw "Expected client runtime assembly was not produced: $liveAssemblyPath"
}
Set-Content -Path $liveReloadPointerPath -Value $liveAssemblyPath -Encoding UTF8
@ -313,7 +313,7 @@ function Wait-LiveReloadAcknowledged {
$stderrLog = if ($state.stderrLog) { [string]$state.stderrLog } else { $null }
$timeoutSeconds = [Math]::Max(1, $LiveReloadAckTimeoutSeconds)
$deadline = (Get-Date).AddSeconds($timeoutSeconds)
$appliedLine = "Live runtime reload applied: $liveAssemblyPath"
$appliedLine = "Client runtime reload applied: $liveAssemblyPath"
while ((Get-Date) -lt $deadline) {
if (Test-Path $stdoutLog) {
@ -326,8 +326,8 @@ function Wait-LiveReloadAcknowledged {
if ($stderrLog -and (Test-Path $stderrLog)) {
$stderrTail = (Get-Content -Path $stderrLog -Tail 120 -ErrorAction SilentlyContinue) -join "`n"
if ($stderrTail -match "Live runtime reload failed") {
throw "host reported live runtime reload failure. See $stderrLog"
if ($stderrTail -match "Client runtime reload failed") {
throw "host reported client runtime reload failure. See $stderrLog"
}
}

View file

@ -12,7 +12,7 @@ Set-StrictMode -Version Latest
$repoRoot = Resolve-Path (Join-Path $PSScriptRoot "..")
$projectPath = Join-Path $repoRoot "src\Aquarium.Engine\Aquarium.Engine.csproj"
$liveProjectPath = Join-Path $repoRoot "src\Aquarium.Engine.Live\Aquarium.Engine.Live.csproj"
$liveProjectPath = Join-Path $repoRoot "src\Aquarium.Epiphany\Aquarium.Epiphany.csproj"
$publishRoot = if ([string]::IsNullOrWhiteSpace($OutputRoot)) {
Join-Path $repoRoot "artifacts\publish"
}
@ -41,7 +41,7 @@ $publishArguments = @(
Write-Host "Publishing Aquarium Engine:"
Write-Host " Project: $projectPath"
Write-Host " Live: $liveProjectPath"
Write-Host " Client: $liveProjectPath"
Write-Host " Runtime: $Runtime"
Write-Host " Output: $publishPath"
dotnet @publishArguments
@ -51,12 +51,12 @@ if ($LASTEXITCODE -ne 0) {
dotnet publish $liveProjectPath -c $Configuration -r $Runtime --self-contained false -o $publishPath
if ($LASTEXITCODE -ne 0) {
throw "live runtime publish failed with exit code $LASTEXITCODE."
throw "client runtime publish failed with exit code $LASTEXITCODE."
}
$requiredFiles = @(
"Aquarium.Engine.exe",
"Aquarium.Engine.Live.dll",
"Aquarium.Epiphany.dll",
"Aquarium.Engine.Contracts.dll",
"Assets\Aquarium-Engine-Icon.ico",
"Assets\Fonts\Montserrat[wght].ttf",

View file

@ -1,8 +1,8 @@
using System.Diagnostics;
using Aquarium.Engine.Input;
using Aquarium.Engine.Live;
using Aquarium.Engine.Platform;
using Aquarium.Engine.Render;
using Aquarium.Engine.Runtime;
using System.Numerics;
namespace Aquarium.Engine;
@ -12,13 +12,13 @@ public static class AquariumHost
public static int Run(string[] args)
{
var runtimeOptions = new AquariumRuntimeOptions(ParseHeadless(args), ParseCachePath(args), ParseRenderDebugMode(args));
using var runtimeLoader = new LiveRuntimeLoader(runtimeOptions, ParseLiveAssemblyPath(args), ParseLiveReloadPointerPath(args));
using var runtimeLoader = new ClientRuntimeLoader(runtimeOptions, ParseClientAssemblyPath(args), ParseClientReloadPointerPath(args));
var runtime = runtimeLoader.Load();
var input = new InputState();
var width = runtime.Options.Headless ? 640 : 1280;
var height = runtime.Options.Headless ? 360 : 720;
var iconPath = Path.Combine(AppContext.BaseDirectory, "Assets", "Aquarium-Engine-Icon.ico");
using var window = Win32Window.Create("Epiphany Aquarium Engine", width, height, input, iconPath, visible: !runtime.Options.Headless);
using var window = Win32Window.Create("Aquarium Engine", width, height, input, iconPath, visible: !runtime.Options.Headless);
window.PaintSplash("Aquarium", "Preparing runtime state");
using var renderer = CreateRenderer(
window.Handle,
@ -128,32 +128,36 @@ public static class AquariumHost
return Environment.GetEnvironmentVariable("AQUARIUM_SHADER_SOURCE");
}
private static string? ParseLiveAssemblyPath(IReadOnlyCollection<string> args)
private static string? ParseClientAssemblyPath(IReadOnlyCollection<string> args)
{
var values = args.ToArray();
for (var index = 0; index < values.Length - 1; index++)
{
if (string.Equals(values[index], "--live-assembly", StringComparison.OrdinalIgnoreCase))
if (string.Equals(values[index], "--client-assembly", StringComparison.OrdinalIgnoreCase)
|| string.Equals(values[index], "--live-assembly", StringComparison.OrdinalIgnoreCase))
{
return values[index + 1];
}
}
return Environment.GetEnvironmentVariable("AQUARIUM_LIVE_ASSEMBLY");
return Environment.GetEnvironmentVariable("AQUARIUM_CLIENT_ASSEMBLY")
?? Environment.GetEnvironmentVariable("AQUARIUM_LIVE_ASSEMBLY");
}
private static string? ParseLiveReloadPointerPath(IReadOnlyCollection<string> args)
private static string? ParseClientReloadPointerPath(IReadOnlyCollection<string> args)
{
var values = args.ToArray();
for (var index = 0; index < values.Length - 1; index++)
{
if (string.Equals(values[index], "--live-reload-pointer", StringComparison.OrdinalIgnoreCase))
if (string.Equals(values[index], "--client-reload-pointer", StringComparison.OrdinalIgnoreCase)
|| string.Equals(values[index], "--live-reload-pointer", StringComparison.OrdinalIgnoreCase))
{
return values[index + 1];
}
}
return Environment.GetEnvironmentVariable("AQUARIUM_LIVE_RELOAD_POINTER");
return Environment.GetEnvironmentVariable("AQUARIUM_CLIENT_RELOAD_POINTER")
?? Environment.GetEnvironmentVariable("AQUARIUM_LIVE_RELOAD_POINTER");
}
private static int? ParseRenderDebugMode(IReadOnlyCollection<string> args)

View file

@ -2,25 +2,22 @@ using System.Reflection;
using System.Runtime.Loader;
using System.Diagnostics;
namespace Aquarium.Engine.Live;
namespace Aquarium.Engine.Runtime;
public sealed class LiveRuntimeLoader : IDisposable
public sealed class ClientRuntimeLoader : IDisposable
{
private const string LiveAssemblyName = "Aquarium.Engine.Live.dll";
private const string FactoryTypeName = "Aquarium.Engine.AquariumRuntimeFactory";
private readonly string liveAssemblyPath;
private readonly string? liveReloadPointerPath;
private readonly string? clientAssemblyPath;
private readonly string? clientReloadPointerPath;
private readonly Stopwatch reloadClock = Stopwatch.StartNew();
private readonly AquariumRuntimeOptions options;
private ReloadedRuntime? current;
private TimeSpan lastReloadCheck;
private string? currentAssemblyPath;
public LiveRuntimeLoader(AquariumRuntimeOptions options, string? liveAssemblyPath = null, string? liveReloadPointerPath = null)
public ClientRuntimeLoader(AquariumRuntimeOptions options, string? clientAssemblyPath = null, string? clientReloadPointerPath = null)
{
this.liveAssemblyPath = liveAssemblyPath ?? Path.Combine(AppContext.BaseDirectory, LiveAssemblyName);
this.liveReloadPointerPath = liveReloadPointerPath;
this.clientAssemblyPath = clientAssemblyPath;
this.clientReloadPointerPath = clientReloadPointerPath;
this.options = options;
}
@ -30,7 +27,7 @@ public sealed class LiveRuntimeLoader : IDisposable
{
if (current == null)
{
Reload(liveAssemblyPath, options);
Reload(RequireClientAssemblyPath(), options);
}
return current!.Runtime;
@ -39,23 +36,32 @@ public sealed class LiveRuntimeLoader : IDisposable
public IAquariumRuntime Load()
{
Reload(liveAssemblyPath, options);
Reload(RequireClientAssemblyPath(), options);
return Runtime;
}
public void Reload(string assemblyPath, AquariumRuntimeOptions options)
{
var previous = current;
var loadContext = new LiveAssemblyLoadContext(assemblyPath);
var loadContext = new ClientAssemblyLoadContext(assemblyPath);
IAquariumRuntime? nextRuntime = null;
try
{
var assembly = loadContext.LoadFromAssemblyPath(assemblyPath);
var factoryType = assembly.GetType(FactoryTypeName, throwOnError: true)
?? throw new InvalidOperationException($"Live runtime factory was not found: {FactoryTypeName}");
var factoryTypes = assembly.GetTypes()
.Where(type => typeof(IAquariumRuntimeFactory).IsAssignableFrom(type)
&& type is { IsAbstract: false, IsInterface: false })
.ToArray();
if (factoryTypes.Length != 1)
{
throw new InvalidOperationException(
$"Client runtime assembly must contain exactly one concrete {nameof(IAquariumRuntimeFactory)} implementation; found {factoryTypes.Length}.");
}
var factoryType = factoryTypes[0];
var factory = (IAquariumRuntimeFactory?)Activator.CreateInstance(factoryType)
?? throw new InvalidOperationException($"Live runtime factory could not be created: {FactoryTypeName}");
?? throw new InvalidOperationException($"Client runtime factory could not be created: {factoryType.FullName}");
nextRuntime = factory.Create(options);
nextRuntime.Start();
@ -81,7 +87,7 @@ public sealed class LiveRuntimeLoader : IDisposable
private void TryReloadFromPointer()
{
if (string.IsNullOrWhiteSpace(liveReloadPointerPath) || reloadClock.Elapsed - lastReloadCheck < TimeSpan.FromMilliseconds(500))
if (string.IsNullOrWhiteSpace(clientReloadPointerPath) || reloadClock.Elapsed - lastReloadCheck < TimeSpan.FromMilliseconds(500))
{
return;
}
@ -90,7 +96,7 @@ public sealed class LiveRuntimeLoader : IDisposable
string candidatePath;
try
{
candidatePath = File.ReadAllText(liveReloadPointerPath).Trim();
candidatePath = File.ReadAllText(clientReloadPointerPath).Trim();
}
catch
{
@ -108,14 +114,24 @@ public sealed class LiveRuntimeLoader : IDisposable
{
current?.Runtime.FlushState();
Reload(candidatePath, options);
Console.WriteLine($"Live runtime reload applied: {candidatePath}");
Console.WriteLine($"Client runtime reload applied: {candidatePath}");
}
catch (Exception error)
{
Console.Error.WriteLine($"Live runtime reload failed; keeping previous runtime. {error.Message}");
Console.Error.WriteLine($"Client runtime reload failed; keeping previous runtime. {error.Message}");
}
}
private string RequireClientAssemblyPath()
{
if (!string.IsNullOrWhiteSpace(clientAssemblyPath))
{
return clientAssemblyPath;
}
throw new InvalidOperationException("A client runtime assembly path is required. Pass --client-assembly or set AQUARIUM_CLIENT_ASSEMBLY.");
}
public void Dispose()
{
var runtime = current;
@ -124,7 +140,7 @@ public sealed class LiveRuntimeLoader : IDisposable
runtime?.Unload();
}
private sealed class ReloadedRuntime(LiveAssemblyLoadContext loadContext, IAquariumRuntime runtime)
private sealed class ReloadedRuntime(ClientAssemblyLoadContext loadContext, IAquariumRuntime runtime)
{
public IAquariumRuntime Runtime { get; } = runtime;
@ -134,7 +150,7 @@ public sealed class LiveRuntimeLoader : IDisposable
}
}
private sealed class LiveAssemblyLoadContext(string assemblyPath) : AssemblyLoadContext(isCollectible: true)
private sealed class ClientAssemblyLoadContext(string assemblyPath) : AssemblyLoadContext(isCollectible: true)
{
private readonly AssemblyDependencyResolver resolver = new(assemblyPath);

View file

@ -2,6 +2,8 @@
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<AssemblyName>Aquarium.Epiphany</AssemblyName>
<RootNamespace>Aquarium.Epiphany</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

View file

@ -1,8 +1,9 @@
using System.Numerics;
using Aquarium.Engine;
using Aquarium.Engine.Input;
using Aquarium.Engine.State;
using Aquarium.Epiphany.State;
namespace Aquarium.Engine;
namespace Aquarium.Epiphany;
public sealed class AquariumRuntime : IAquariumRuntime
{

View file

@ -1,10 +1,11 @@
using System.Numerics;
using Aquarium.Engine;
using GameCult.Caching;
using GameCult.Caching.MessagePack;
using GameCult.Networking;
using MessagePack;
namespace Aquarium.Engine.State;
namespace Aquarium.Epiphany.State;
public sealed class AquariumCultStateStore : IDisposable
{

View file

@ -1,7 +1,8 @@
using GameCult.Caching;
using MessagePack;
using Aquarium.Engine;
namespace Aquarium.Engine.State;
namespace Aquarium.Epiphany.State;
[CultDocument("epiphany.aquarium.graphics_settings", "epiphany.aquarium.graphics_settings.v0")]
[MessagePackObject]

View file

@ -1,7 +1,8 @@
using GameCult.Caching;
using MessagePack;
using Aquarium.Epiphany;
namespace Aquarium.Engine.State;
namespace Aquarium.Epiphany.State;
[CultDocument("epiphany.aquarium.live_state", "epiphany.aquarium.live_state.v0")]
[MessagePackObject]

View file

@ -1,4 +1,4 @@
namespace Aquarium.Engine;
namespace Aquarium.Epiphany;
public static class Angle
{

View file

@ -1,7 +1,7 @@
using System.Numerics;
using Aquarium.Engine.Input;
namespace Aquarium.Engine;
namespace Aquarium.Epiphany;
public sealed class OrbitCameraRig
{

View file

@ -1,5 +1,6 @@
{"timestamp":"2026-05-09T04:42:00+01:00","topic":"debug-ui-control-grammar","lesson":"Aquarium debug UI uses a code-first Direct2D/DirectWrite overlay with explicit bound controls. Rect math must distinguish edges from width/height, controls need base/hover/active feedback, tooltips live in declarations, and long mode selectors should be named option rows instead of numeric sliders.","files":["src/Aquarium.Engine/Render/Ui/DebugUi.cs","src/Aquarium.Engine/Render/D3D12Renderer.cs","state/memory.json"]}
{"timestamp":"2026-05-09T05:20:00+01:00","topic":"graphics-settings-cultcache","lesson":"Renderer presentation knobs belong in a typed CultCache graphics settings document, not process folklore. Current durable knobs are render debug mode, exposure, bloom intensity, and bloom veil.","files":["src/Aquarium.Engine.Contracts/GraphicsSettings.cs","src/Aquarium.Engine.Live/State/AquariumGraphicsSettingsState.cs","state/memory.json"]}
{"timestamp":"2026-05-09T05:20:00+01:00","topic":"graphics-settings-cultcache","lesson":"Renderer presentation knobs belong in a typed CultCache graphics settings document, not process folklore. Current durable knobs are render debug mode, exposure, bloom intensity, and bloom veil.","files":["src/Aquarium.Engine.Contracts/GraphicsSettings.cs","src/Aquarium.Epiphany/State/AquariumGraphicsSettingsState.cs","state/memory.json"]}
{"timestamp":"2026-05-12T00:00:00+01:00","topic":"engine-client-boundary","lesson":"Aquarium.Engine is the native D3D12/window/render graph layer and must not accrete Epiphany frontend semantics. Aquarium.Epiphany is the client/runtime layer behind Aquarium.Engine.Contracts and should configure engine abstractions for cameras, targets, shaders, resources, and passes.","files":["docs/engine-client-boundary.md","src/Aquarium.Epiphany/Aquarium.Epiphany.csproj","src/Aquarium.Engine/Runtime/ClientRuntimeLoader.cs","state/memory.json","state/map.yaml"]}
{"timestamp":"2026-05-10T07:47:46+01:00","topic":"cursor-teardrop-sdf","lesson":"Use the MathWorld teardrop curve for the cursor profile with m=6, revolved into an SDF locator. Keep ripples as geometry, material as brass GGX metal, and avoid ambient fill.","files":["src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl","state/memory.json"],"source":"https://mathworld.wolfram.com/TeardropCurve.html"}
{"timestamp":"2026-05-11T00:00:00+01:00","topic":"aquarium-focus-cut","lesson":"Runtime volumetrics, cloud/fog research, and the D3D11 scene renderer are shelved because they distract from Aquarium's Epiphany-client mission. Git history holds the experiment; live repo state should not preserve compatibility husks or dead guidance for removed medium settings.","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","src/Aquarium.Engine.Contracts/GraphicsSettings.cs","state/map.yaml","state/memory.json","state/scratch.md"]}
{"timestamp":"2026-05-11T04:20:00+01:00","topic":"medium-froxel-purge","lesson":"Medium/froxel render targets, structured buffers, shader bindings, scene outputs, post history lanes, and medium debug paths were removed from the live D3D12 renderer. Future atmospheric or field transport work needs a new explicit pass contract rather than reviving shelved scaffolding.","files":["src/Aquarium.Engine/Render/D3D12Renderer.cs","src/Aquarium.Engine/Render/Shaders/D3D12Scene.hlsl","src/Aquarium.Engine/Render/Shaders/D3D12Post.hlsl","state/map.yaml","state/memory.json"]}

View file

@ -4,8 +4,9 @@ project:
upstream: https://github.com/GameCult/Aquarium-Engine
purpose: >
Native C# engine core for the Epiphany Aquarium client. The engine owns the
Win32 host, D3D12 renderer, input loop, live runtime boundary,
CultCache-backed state, and diegetic UI/runtime integration.
Win32 host, D3D12 renderer, input loop, client reload boundary, and future
render graph abstractions. The Epiphany client owns frontend intent and
configures those engine abstractions.
current_model:
host:
@ -31,13 +32,13 @@ current_model:
post_shader: src/Aquarium.Engine/Render/Shaders/D3D12Post.hlsl
overlay_text: src/Aquarium.Engine/Render/DirectWriteOverlay.cs
debug_ui: src/Aquarium.Engine/Render/Ui/DebugUi.cs
runtime_loader: src/Aquarium.Engine/Live/LiveRuntimeLoader.cs
runtime_loader: src/Aquarium.Engine/Runtime/ClientRuntimeLoader.cs
dev_reload: scripts/dev-reload.ps1
dev_watch: scripts/dev-watch.ps1
live_runtime:
epiphany_client:
contracts: src/Aquarium.Engine.Contracts
implementation: src/Aquarium.Engine.Live
state_store: src/Aquarium.Engine.Live/State/AquariumCultStateStore.cs
implementation: src/Aquarium.Epiphany
state_store: src/Aquarium.Epiphany/State/AquariumCultStateStore.cs
state_document: epiphany.aquarium.live_state
graphics_settings_document: epiphany.aquarium.graphics_settings
dependencies:
@ -45,6 +46,7 @@ current_model:
cult_lib: E:\Projects\CultLib
docs:
doctrine: docs/aquarium-engine-doctrine.md
engine_client_boundary: docs/engine-client-boundary.md
renderer: docs/hlsl-renderer.md
agent_sdf_visual_language: docs/epiphany-agent-sdf-visual-language.md
runtime_surface: docs/cult-runtime-surface.md

View file

@ -14,7 +14,9 @@
"technical_memory": {
"native_engine": [
"Aquarium Engine lives at E:\\Projects\\Aquarium-Engine. Main is the live development branch.",
"The host owns Win32 windowing, D3D12 rendering, input translation, and the live-runtime assembly boundary.",
"Aquarium.Engine is the native engine layer: Win32 hosting, D3D12 rendering, input translation, reload transport, resource abstractions, and future render graph execution. It must not know Epiphany frontend roles, policy, or semantic client layout.",
"Aquarium.Epiphany is the Epiphany client layer behind Aquarium.Engine.Contracts. It owns client runtime state, CultCache documents, CultNet interpretation, camera intent, and future render graph configuration against engine abstractions.",
"The host owns Win32 windowing, D3D12 rendering, input translation, and the client-runtime assembly boundary.",
"D3D12 descriptor ownership stays explicit: static descriptors for long-lived views, per-frame transient descriptors reset only after fence wait, and whole-arena rebuilds on resize until real descriptor churn demands free lists.",
"D3D12 previous-frame camera/Grid/time/cursor state is renderer-level temporal state, not per-swapchain-frame-resource state.",
"Grid height is brush-rendered into one scalar R16_Float target. Height is one value; do not spend extra channels without a concrete pass contract.",
@ -69,7 +71,7 @@
],
"state_and_reload": [
"CultCache is the client memory organ. Runtime state, camera, renderer knobs, body state, UI state, and future Epiphany connection state should be typed Cult documents.",
"Global graphics presentation settings live in epiphany.aquarium.graphics_settings. The debug UI edits the renderer copy; the host syncs changed renderer settings back to the live runtime; the runtime flushes dirty settings through CultCache.",
"Global graphics presentation settings live in epiphany.aquarium.graphics_settings. The debug UI edits the renderer copy; the host syncs changed renderer settings back to the client runtime; the runtime flushes dirty settings through CultCache.",
"A truncated or unreadable single-file CultCache backing store is not a schema migration failure. Aquarium should quarantine the corrupt snapshot and boot fresh typed state.",
"dev-reload builds disposable apphost slots so a running window does not lock normal build output. Headless smoke runs use a separate CultCache from the visible dev window.",
"Live runtime reload is not successful just because dev-watch wrote live-current.txt. The watcher must see the host acknowledge the exact live DLL path in stdout.",