Integrate CultMesh UI and URP cleanup

This commit is contained in:
Meta Vens 2026-06-30 19:14:49 +01:00
commit 4d7bb65868
131 changed files with 7209 additions and 5084 deletions

View file

@ -12,7 +12,7 @@ The rule is blunt:
```text
small UI-only value: derive it inline from already accessible typed state
named UI-only projection: define the projected document, then read it
named UI-only derived view: define the typed derived document, then read it
simulation feature: define one canonical typed document, let daemon authority mutate it, consume the same document everywhere
hot rendering/physics: use SoA, not object-graph UI documents
```
@ -45,12 +45,30 @@ A second document is justified only when it earns a distinct job:
- viewport/windowed selection;
- SoA/native render or physics layout;
- lossy presentation summaries;
- UI surface documents;
- UI surface documents, including nested CultUI `embeddedDocuments` slots when
a parent surface reserves layout for a separately synced child document;
- compatibility mirrors with a named removal stage.
Projection is not the normal way to make state client-visible. Projection is an
exception for a different shape.
Nested UI does not loosen this rule. If a daemon-owned panel needs an embedded
dropdown, item inspector, scene insert, or drag/drop target surface, the parent
surface carries a `surface.slot` with `embeddedDocuments`, and each child is
resolved as its own managed CultMesh document. The renderer lowers the retained
tree and wires commands; it does not invent a Unity-only state model for the
child surface.
Discovery and parity live with the shared Eve contract, not in an Aetheria-only
helper. Any CultUI feature that affects nested surfaces must update the
canonical fixture at `E:\Projects\Eve\web\fixtures\cultui-embedded-surface.json`
or an equivalent versioned fixture, and it must be discoverable from
`E:\Projects\Eve\docs\parity-testing-harness.md`. The active runtime checks are
the browser DSL test, Eve parity harness, Flutter parity smoke, Unity build, and
Aetheria verifier scripts. Android/Kotlin and Fensalir must remain listed in
the matrix with explicit pending/unsupported status until they become active
GUI CultUI renderers. Do not let an untested target disappear into politeness.
## The Ergonomic Bar
UI-only state should take one or two steps.
@ -63,11 +81,11 @@ var currentDocking = client.State.Reactive<AetheriaRuntimeCurrentDockingDocument
var bayName = currentDocking.Current?.DockingBayName ?? "";
```
Use two steps when the projection is shared, non-trivial, or should have a
Use two steps when the derived view is shared, non-trivial, or should have a
stable schema:
```text
1. Define the typed projected document.
1. Define the typed derived document.
2. Read it from Unity as a managed reactive typed document.
```
@ -133,13 +151,13 @@ Use inline derivation when:
- the source typed document is already available to the caller;
- no other system needs the result as a named state surface.
Use a projected typed document when:
Use a derived typed document when:
- multiple callers need the same derived state;
- the state is useful to Unity, RTS, tests, tooling, or the website simulator;
- the derivation joins multiple source documents;
- the result needs a stable schema or cross-runtime binding;
- the projection should update reactively as daemon state changes.
- the derived view should update reactively as daemon state changes.
Use a canonical simulation document when:
@ -148,7 +166,7 @@ Use a canonical simulation document when:
- it needs authority, replay, persistence, or reconciliation;
- the daemon must validate operations before publishing the next state.
Use a projected typed document when the caller needs a different state shape,
Use a derived typed document when the caller needs a different state shape,
not merely because a client needs to see daemon-owned state.
Use SoA/native views when:
@ -194,20 +212,20 @@ public sealed class DockingBadge : IDisposable
```
The caller does not need a custom facade, session, projector, or adapter. If the
inline derivation becomes shared or hard to read, promote it to a projected
inline derivation becomes shared or hard to read, promote it to a derived
document.
## Two-Step UI Projection
## Two-Step Derived UI Document
Use this for shared presentation state such as player HUD, docking summary,
commander wave status, station service summary, or Starbridge support alerts.
Before adding this projection, ask whether the UI can read the canonical
simulation document directly. If it can, do that. The projection exists only
Before adding this document, ask whether the UI can read the canonical
simulation document directly. If it can, do that. The derived document exists only
when the UI shape is genuinely derived, filtered, windowed, or shared enough to
deserve its own schema.
### Step 1: Define The Projected Document
### Step 1: Define The Derived Document
Put the document type in the shared runtime package so every runtime sees the
same schema:
@ -250,7 +268,7 @@ using var status =
The exact registration/publishing code belongs in the runtime plumbing. It
should be generated or centralized. The feature author should not have to write
five separate access classes, wrapper methods, sessions, or facades for one
projected state shape.
derived state shape.
### Step 2: Read It From Unity
@ -290,7 +308,7 @@ public sealed class ZoneDefenseHud : IDisposable
}
```
That is the whole UI projection workflow. If more steps are required, they
That is the whole derived UI document workflow. If more steps are required, they
belong in CultMesh/runtime infrastructure, not in every feature.
## Two Or Three-Step Simulation Feature
@ -406,13 +424,27 @@ from `Current`. Reconnection should not require replaying UI actions.
For inline UI derivation, test the source document and the small consuming
component when behavior is non-trivial.
For projected UI documents, test:
For derived UI documents, test:
- projection from representative daemon state;
- derivation from representative daemon state;
- empty/default state;
- reactive update after source state changes;
- Unity caller reads the typed document directly.
For nested CultUI surfaces, test every target runtime listed in the Eve parity
matrix:
- browser DSL lowering discovers and renders `embeddedDocuments`;
- Eve parity harness preserves slots, child document identity, and command
wiring;
- Flutter parity smoke renders the same nested surface contract;
- Unity build/lowering binds the parent surface and embedded child documents
without local projector state;
- Aetheria verifier scripts prove the game daemon publishes the discoverable
CultMesh surface document;
- pending runtimes such as Android/Kotlin and Fensalir remain explicitly marked
pending/unsupported until they have a real renderer test.
For simulation features, test:
- daemon tick/application mutates the canonical typed document;
@ -463,7 +495,7 @@ freeze the ceremony in place.
Before calling a CultMesh feature ergonomic, answer these questions:
- Can a UI-only inline value be implemented in one local derivation?
- Can a shared UI projection be implemented by defining the document and reading
- Can a shared UI view be implemented by defining the document and reading
it from Unity?
- Can a simulation feature be explained as one canonical typed document plus
authority policy and typed operations?

View file

@ -57,14 +57,14 @@ The current migration is moving toward this shape:
```text
client input
-> typed client facade
-> typed client handles
-> typed command document
-> local Verse node
-> daemon command gate
-> simulation
-> typed daemon frame/fact documents
-> local Verse replica
-> typed projection or native SoA view
-> managed typed document/query or native SoA view
-> Unity/Electron rendering and UI
```
@ -79,7 +79,7 @@ typed Verse state."
Durable typed state and shared runtime contract. This is the center of the new
world. It owns document types, schema registration, state mapping, Eve command
bridges, provider advertisement, player settings, loadout templates, trade
policy, Verse target state, and several projection helpers.
policy, Verse target state, and managed derived document/query helpers.
`Aetheria.State.Daemon`
@ -91,8 +91,8 @@ daemon frame/SoA/health/provider/surface records.
The Unity-embeddable runtime state package. Unity, tests, daemon, and Electron
binding generation all depend on this contract. This package contains the
shared C# client facade (`AetheriaClient`, `AetheriaControl`, `AetheriaUi`),
daemon command documents, RTS/current-entity projections, Starbridge documents,
shared C# client handles (`AetheriaClient`, `AetheriaControl`, `AetheriaUi`),
daemon command documents, RTS/current-entity documents, Starbridge documents,
authority policy, SoA documents, Eve surface builders, and runtime catalog
snapshots.
@ -106,7 +106,7 @@ daemon contract fills in.
`Aetheria.Rts.Web`
Electron RTS client. It is intentionally thin: browser UI plus Electron
CultMesh/Verse access, local projection reads, and typed operation helpers.
CultMesh/Verse access, generated query/document reads, and typed operation helpers.
Generated TypeScript bindings live in
`Aetheria.Rts.Web/Electron/aetheria-rts-generated-bindings.ts` and are derived
from C# `[Key]` declarations.
@ -218,7 +218,7 @@ Command application is in:
Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonOperations.cs
```
### Client Facade
### Client Handles
Use `AetheriaClient` first:
@ -232,9 +232,9 @@ documents, Starbridge seat handles, typed controls through `AetheriaControl`,
and typed UI surface helpers through `AetheriaUi`.
If a Unity panel or Electron surface needs a fact, prefer the generic managed
document call first. Add a named facade only when it carries semantic identity,
document call first. Add a named handle only when it carries semantic identity,
parameters, operation policy, or a distinct derived/native shape. Avoid handing
callers raw daemon frames unless the caller is a transitional projection layer.
callers raw daemon frames unless the caller is an explicitly fenced transition.
### Unity Shell
@ -292,11 +292,11 @@ Add or inspect a daemon command:
- `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeDaemonOperations.cs`
- `Aetheria.State.Verify/Program.cs`
Add a client projection:
Add a managed derived document/query:
- `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeRtsProjection.cs`
- `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeRtsDocuments.cs`
- `Packages/org.gamecult.aetheria.state/Runtime/AetheriaClient.cs`
- `Aetheria.Rts.Web/Electron/aetheria-rts-local-projection.ts`
- `Aetheria.Rts.Web/Electron/aetheria-rts-local-documents.ts`
- `Aetheria.Rts.Web/Electron/aetheria-rts-generated-bindings.ts`
- `Aetheria.State.Verify/Program.cs`
@ -306,7 +306,6 @@ Work on Unity thin-client migration:
- `Assets/Scripts/Gameplay/AetheriaUnityGameplayBootShell.cs`
- `Assets/Scripts/Gameplay/AetheriaUnityGameplayInputShell.cs`
- `Assets/Scripts/Gameplay/AetheriaUnityObservedFrameApplier.cs`
- `Assets/Scripts/Gameplay/AetheriaUnityObservedFacadeProjector.cs`
- `Assets/Scripts/Gameplay/AetheriaUnityCurrentEntityBinder.cs`
- `Assets/Scripts/Gameplay/AetheriaUnityTargetPresentation.cs`
- `Assets/Scripts/UI/Menu/*.cs`
@ -316,7 +315,7 @@ Work on Unity thin-client migration:
Work on Eve/CultUI surfaces:
- `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeEveSurfaceState.cs`
- `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeEveSurfaceAdapter.cs`
- `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeSurfaceDocuments.cs`
- `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeEveCommandClient.cs`
- `Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntime*SurfaceBuilder.cs`
- `Packages/org.gamecult.aetheria.eve-runtime/Runtime/AetheriaEveSurfacePresenter.cs`
@ -330,7 +329,7 @@ Work on RTS/Electron:
- `Aetheria.Rts.Web/Electron/preload.cjs`
- `Aetheria.Rts.Web/Electron/aetheria-cultmesh.ts`
- `Aetheria.Rts.Web/Electron/aetheria-rts-bindings.ts`
- `Aetheria.Rts.Web/Electron/aetheria-rts-local-projection.ts`
- `Aetheria.Rts.Web/Electron/aetheria-rts-local-documents.ts`
- `Aetheria.Rts.Web/scripts/generate-rts-bindings.mjs`
Work on native/SoA render path:
@ -360,7 +359,7 @@ Work on Ymir/physics:
fact.
If yes, promote it into `Aetheria.State` and read it through `AetheriaClient`.
3. If a fact is needed every frame, prefer a typed projection or SoA/native view.
3. If a fact is needed every frame, prefer a typed query/document or SoA/native view.
Do not make Unity crawl a whole daemon frame in a hot path unless the code is
explicitly transitional and fenced by the verifier.
@ -373,7 +372,7 @@ Work on Ymir/physics:
enemy AI, movement rules, trade rules, station rules, or combat rules.
6. Keep Unity honest.
Unity may adapt old facade objects for presentation until Stage 8 finishes,
Unity may adapt old object graphs for presentation until Stage 8 finishes,
but new state truth belongs in typed documents.
7. Do not preserve legacy shape for its own sake.