Publish CultMesh-native Aetheria Eve surfaces
This commit is contained in:
parent
59e783f6a0
commit
f220057ccf
35 changed files with 1993 additions and 1247 deletions
|
|
@ -1,6 +1,9 @@
|
|||
import {
|
||||
renderEveSurface,
|
||||
type EveCommandIntent,
|
||||
} from "../node_modules/@gamecult/eve-browser-lowering/dist/index.js";
|
||||
import type {
|
||||
AetheriaRtsApi,
|
||||
AetheriaMenuSurfaceComponent,
|
||||
AetheriaMenuSurfaceDocument,
|
||||
AuthorityStatusDocument,
|
||||
AetheriaRuntimeViewportFeedSnapshot,
|
||||
|
|
@ -99,29 +102,9 @@ async function showMainMenu(surfaceId = "aetheria.main_menu.root"): Promise<void
|
|||
inGame: false,
|
||||
canOpenRuntimeInputScreen: false,
|
||||
});
|
||||
installMenuFonts(surface);
|
||||
renderMainMenuSurface(surface);
|
||||
}
|
||||
|
||||
function installMenuFonts(surface: AetheriaMenuSurfaceDocument): void {
|
||||
const googleFont = surface.surface.styles.find(token => token.name === "font.web.google")?.value;
|
||||
if (!googleFont || document.querySelector(`link[data-aetheria-menu-fonts="${googleFont}"]`)) {
|
||||
return;
|
||||
}
|
||||
|
||||
const preconnect = document.createElement("link");
|
||||
preconnect.rel = "preconnect";
|
||||
preconnect.href = "https://fonts.gstatic.com";
|
||||
preconnect.crossOrigin = "anonymous";
|
||||
document.head.append(preconnect);
|
||||
|
||||
const link = document.createElement("link");
|
||||
link.rel = "stylesheet";
|
||||
link.href = googleFont;
|
||||
link.dataset.aetheriaMenuFonts = googleFont;
|
||||
document.head.append(link);
|
||||
}
|
||||
|
||||
function renderMainMenuSurface(surface: AetheriaMenuSurfaceDocument): void {
|
||||
let host = document.querySelector<HTMLElement>("#main-menu-host");
|
||||
if (!host) {
|
||||
|
|
@ -131,7 +114,13 @@ function renderMainMenuSurface(surface: AetheriaMenuSurfaceDocument): void {
|
|||
document.body.append(host);
|
||||
}
|
||||
|
||||
host.replaceChildren(lowerMenuComponent(surface.surface.root, surface));
|
||||
renderEveSurface(surface, host, {
|
||||
body: document.body,
|
||||
clientId: "aetheria.rts.electron",
|
||||
commandSink: intent => handleMenuCommand(intent.command, surface),
|
||||
source: "Aetheria Electron",
|
||||
statusElement: statusEl,
|
||||
});
|
||||
wireWindowControls();
|
||||
}
|
||||
|
||||
|
|
@ -145,72 +134,13 @@ async function startDebugSurface(): Promise<void> {
|
|||
}
|
||||
|
||||
function renderDebugSurface(surface: AetheriaMenuSurfaceDocument): void {
|
||||
installMenuFonts(surface);
|
||||
debugSurfaceHost.replaceChildren(lowerMenuComponent(surface.surface.root, surface));
|
||||
}
|
||||
|
||||
function lowerMenuComponent(
|
||||
component: AetheriaMenuSurfaceComponent,
|
||||
surface: AetheriaMenuSurfaceDocument,
|
||||
): HTMLElement {
|
||||
const kind = component.kind || "surface";
|
||||
if (kind === "control.button") {
|
||||
const button = document.createElement("button");
|
||||
button.id = component.id;
|
||||
button.className = "eve-control-button";
|
||||
button.type = "button";
|
||||
button.textContent = component.props.label ?? "";
|
||||
button.addEventListener("click", () => handleMenuCommand(component.props.command ?? "", surface));
|
||||
return button;
|
||||
}
|
||||
|
||||
if (kind.startsWith("text")) {
|
||||
const label = document.createElement("div");
|
||||
label.id = component.id;
|
||||
label.className = menuTextClasses(component, kind).join(" ");
|
||||
label.textContent = component.props.value ?? component.props.text ?? "";
|
||||
return label;
|
||||
}
|
||||
|
||||
if (kind === "metric") {
|
||||
const metric = document.createElement("dl");
|
||||
metric.id = component.id;
|
||||
metric.className = "eve-metric";
|
||||
const term = document.createElement("dt");
|
||||
term.textContent = component.props.label ?? "";
|
||||
const value = document.createElement("dd");
|
||||
value.textContent = component.props.value ?? "";
|
||||
metric.append(term, value);
|
||||
return metric;
|
||||
}
|
||||
|
||||
const element = document.createElement("div");
|
||||
element.id = component.id;
|
||||
element.className = [
|
||||
kind === "surface" ? "eve-surface" : "",
|
||||
kind === "column" ? "eve-column" : "",
|
||||
kind === "row" ? "eve-row" : "",
|
||||
kind === "form" ? "eve-form" : "",
|
||||
].filter(Boolean).join(" ");
|
||||
for (const child of component.children ?? []) {
|
||||
element.append(lowerMenuComponent(child, surface));
|
||||
}
|
||||
return element;
|
||||
}
|
||||
|
||||
function menuTextClasses(component: AetheriaMenuSurfaceComponent, kind: string): string[] {
|
||||
const classes: string[] = [];
|
||||
if (kind === "text.title")
|
||||
classes.push("eve-text-title");
|
||||
if (kind === "text.subtitle")
|
||||
classes.push("eve-text-subtitle");
|
||||
if (classes.length === 0)
|
||||
classes.push("eve-text");
|
||||
if (component.id === "aetheria.main_menu.root.title")
|
||||
classes.push("eve-root-title");
|
||||
if (component.id === "aetheria.main_menu.root.subtitle")
|
||||
classes.push("eve-root-subtitle");
|
||||
return classes;
|
||||
renderEveSurface(surface, debugSurfaceHost, {
|
||||
body: document.body,
|
||||
clientId: "aetheria.rts.electron",
|
||||
commandSink: intent => handleMenuCommand(intent.command, surface),
|
||||
source: "CultUI Debug",
|
||||
statusElement: statusEl,
|
||||
});
|
||||
}
|
||||
|
||||
function wireWindowControls(): void {
|
||||
|
|
@ -229,7 +159,8 @@ function wireWindowControls(): void {
|
|||
});
|
||||
}
|
||||
|
||||
function handleMenuCommand(command: string, surface: AetheriaMenuSurfaceDocument): void {
|
||||
function handleMenuCommand(commandOrIntent: string | EveCommandIntent, surface: AetheriaMenuSurfaceDocument): void {
|
||||
const command = typeof commandOrIntent === "string" ? commandOrIntent : commandOrIntent.command;
|
||||
switch (command) {
|
||||
case "aetheria.main_menu.root.show_settings":
|
||||
void showMainMenu("aetheria.main_menu.settings");
|
||||
|
|
|
|||
|
|
@ -70,6 +70,14 @@ export type AetheriaCultMeshClientOptions = {
|
|||
snapshotTimeoutMs?: number;
|
||||
};
|
||||
|
||||
export type AetheriaCultMeshDaemonTarget = {
|
||||
readonly uri: string;
|
||||
readonly peerId?: string;
|
||||
readonly verseId?: string;
|
||||
readonly role?: string;
|
||||
readonly endpoints?: readonly string[];
|
||||
};
|
||||
|
||||
export type AetheriaMenuSurfaceRequest = {
|
||||
surfaceId?: string;
|
||||
inGame?: boolean;
|
||||
|
|
@ -96,6 +104,8 @@ export type AetheriaMenuSurfaceComponent = {
|
|||
id: string;
|
||||
kind: string;
|
||||
props: Record<string, string>;
|
||||
layout?: Record<string, string>;
|
||||
style?: Record<string, string>;
|
||||
children: AetheriaMenuSurfaceComponent[];
|
||||
};
|
||||
|
||||
|
|
@ -134,21 +144,23 @@ export class AetheriaCultMeshClient {
|
|||
private readonly verse: CultMeshVerse;
|
||||
private readonly queryVerse: CultMeshVerse;
|
||||
private readonly commandVerse: CultMeshVerse;
|
||||
private readonly daemonTarget: Required<AetheriaCultMeshDaemonTarget>;
|
||||
|
||||
public constructor(
|
||||
private readonly endpoint: string,
|
||||
daemonTarget: string | AetheriaCultMeshDaemonTarget,
|
||||
statePath: string,
|
||||
private readonly runtimeId = "aetheria-rts-electron",
|
||||
options: AetheriaCultMeshClientOptions = {},
|
||||
) {
|
||||
this.daemonTarget = normalizeDaemonTarget(daemonTarget);
|
||||
const publicationMode = options.publicationMode ?? "local";
|
||||
this.publicationDescription = publicationMode === "remote" ? this.endpoint : statePath;
|
||||
this.publicationDescription = publicationMode === "remote" ? this.daemonTarget.uri : statePath;
|
||||
this.verse = CultMesh.verse("aetheria.local", this.runtimeId);
|
||||
this.queryVerse = publicationMode === "remote"
|
||||
? this.verse.withRoute("network", this.publicationDescription)
|
||||
: this.verse.withRoute("shared-memory", this.publicationDescription);
|
||||
this.commandVerse = this.verse
|
||||
.withRoute("network", this.endpoint)
|
||||
.withRoute("network", this.daemonTarget.uri)
|
||||
.withClaim("commander-control", { shardId: "aetheria.local" });
|
||||
this.publications = CultMesh.documentsFromPublication(
|
||||
this.createPublicationSource(publicationMode),
|
||||
|
|
@ -233,7 +245,7 @@ export class AetheriaCultMeshClient {
|
|||
}
|
||||
}
|
||||
|
||||
throw new Error(`Timed out waiting for Aetheria CultMesh frame at ${this.endpoint}. ${lastError}`);
|
||||
throw new Error(`Timed out waiting for Aetheria CultMesh frame at ${this.daemonTarget.uri}. ${lastError}`);
|
||||
}
|
||||
|
||||
public async mapViewport(request: ViewportRequest): Promise<ViewportResponse> {
|
||||
|
|
@ -355,7 +367,7 @@ export class AetheriaCultMeshClient {
|
|||
return () => ({
|
||||
kind: "peer-snapshot",
|
||||
peer: () => this.peer(),
|
||||
endpoint: this.endpoint,
|
||||
endpoint: this.resolvedRudpEndpoint(),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -484,16 +496,69 @@ export class AetheriaCultMeshClient {
|
|||
private async peer(): Promise<CultNetPeer> {
|
||||
if (this.#peer)
|
||||
return this.#peer;
|
||||
this.#peer = await CultMesh.createRudpPeer(this.runtimeId, connectionId, this.endpoint, {
|
||||
const peers = CultMesh.createPeerCatalog();
|
||||
const leases = CultMesh.createAuthorityLeaseCatalog();
|
||||
const leaseId = `${this.daemonTarget.peerId}:authority`;
|
||||
peers.upsert({
|
||||
peerId: this.daemonTarget.peerId,
|
||||
verseId: this.daemonTarget.verseId,
|
||||
endpoints: this.daemonTarget.endpoints,
|
||||
roles: [this.daemonTarget.role],
|
||||
authorityLeaseId: leaseId,
|
||||
});
|
||||
leases.upsert({
|
||||
leaseId,
|
||||
verseId: this.daemonTarget.verseId,
|
||||
peerId: this.daemonTarget.peerId,
|
||||
roles: [this.daemonTarget.role],
|
||||
validFrom: new Date(Date.now() - 60_000),
|
||||
expiresAt: new Date(Date.now() + 60_000),
|
||||
});
|
||||
this.#peer = await CultMesh.createRudpPeerForAuthorizedPeer(
|
||||
this.runtimeId,
|
||||
connectionId,
|
||||
peers,
|
||||
leases,
|
||||
this.daemonTarget.verseId,
|
||||
this.daemonTarget.role,
|
||||
{
|
||||
connectTimeoutMs: 2000,
|
||||
maxFragmentBytes: 1200,
|
||||
maxPendingReliablePackets: 512,
|
||||
});
|
||||
},
|
||||
);
|
||||
this.#peer.on("close", () => {
|
||||
this.#peer = null;
|
||||
});
|
||||
return this.#peer;
|
||||
}
|
||||
|
||||
private resolvedRudpEndpoint(): string {
|
||||
const endpoint = this.daemonTarget.endpoints.find(value => value.toLowerCase().startsWith("rudp://"));
|
||||
if (!endpoint) {
|
||||
throw new Error(`Daemon ${this.daemonTarget.uri} has no resolved RUDP transport endpoint. Resolve it through Odin/CultMesh before opening a transport peer.`);
|
||||
}
|
||||
return endpoint;
|
||||
}
|
||||
}
|
||||
|
||||
function normalizeDaemonTarget(target: string | AetheriaCultMeshDaemonTarget): Required<AetheriaCultMeshDaemonTarget> {
|
||||
const value = typeof target === "string"
|
||||
? { uri: target }
|
||||
: target;
|
||||
if (!value.uri.trim()) {
|
||||
throw new Error("Aetheria CultMesh daemon target URI is required.");
|
||||
}
|
||||
if (value.uri.toLowerCase().startsWith("rudp://")) {
|
||||
throw new Error("Aetheria daemon targets must be CultMesh URIs; raw RUDP endpoints belong in resolved peer-card endpoints.");
|
||||
}
|
||||
return {
|
||||
uri: value.uri,
|
||||
peerId: value.peerId?.trim() || "aetheria-rts-daemon",
|
||||
verseId: value.verseId?.trim() || "aetheria.local",
|
||||
role: value.role?.trim() || "aetheria-rts-daemon",
|
||||
endpoints: value.endpoints ?? [],
|
||||
};
|
||||
}
|
||||
|
||||
function buildMainMenuSurface(
|
||||
|
|
@ -563,9 +628,33 @@ function buildMainMenuSurface(
|
|||
command("aetheria.main_menu.root.show_settings", "Settings"),
|
||||
command("aetheria.main_menu.root.quit", "Quit"),
|
||||
],
|
||||
text("aetheria.main_menu.root.title", "AETHERIA", "text.title"),
|
||||
text("aetheria.main_menu.root.subtitle", "TERMINUS", "text.subtitle"),
|
||||
buttonColumn("aetheria.main_menu.root.actions", ...actionButtons),
|
||||
gravitySurface("aetheria.main_menu.root.gravity"),
|
||||
node(
|
||||
"aetheria.main_menu.root.menu",
|
||||
"column",
|
||||
{},
|
||||
{
|
||||
position: "relative",
|
||||
padding: "7.25rem 0 0 6.75rem",
|
||||
gap: "1.1rem",
|
||||
width: "44rem",
|
||||
maxWidth: "calc(100vw - 3rem)",
|
||||
minHeight: "100vh",
|
||||
alignItems: "flex-start",
|
||||
},
|
||||
{ color: "#e9fbff" },
|
||||
text("aetheria.main_menu.root.title", "AETHERIA", "text.title", { margin: "0 0 -1.6rem 0" }, {
|
||||
font: "100 5.9rem/0.98 Montserrat, sans-serif",
|
||||
color: "rgba(232, 250, 255, 0.94)",
|
||||
whiteSpace: "nowrap",
|
||||
}),
|
||||
text("aetheria.main_menu.root.subtitle", "TERMINUS", "text.subtitle", { margin: "0 0 0.35rem 16.8rem" }, {
|
||||
font: "100 2.6rem/1 Montserrat, sans-serif",
|
||||
color: "rgba(232, 250, 255, 0.9)",
|
||||
whiteSpace: "nowrap",
|
||||
}),
|
||||
buttonColumn("aetheria.main_menu.root.actions", ...actionButtons),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -584,7 +673,13 @@ function surfaceDocument(
|
|||
updatedAtUtc,
|
||||
surface: {
|
||||
id: surfaceId,
|
||||
root: node(`${surfaceId}.root`, "surface", {}, ...children),
|
||||
root: node(
|
||||
`${surfaceId}.root`,
|
||||
"surface",
|
||||
{},
|
||||
{ position: "relative", overflow: "hidden", width: "100%", height: "100vh", minHeight: "100vh" },
|
||||
{ background: "#020606" },
|
||||
...children),
|
||||
styles: [
|
||||
{ name: "font.title.family", value: "Montserrat" },
|
||||
{ name: "font.title.style", value: "Thin" },
|
||||
|
|
@ -610,13 +705,28 @@ function node(
|
|||
id: string,
|
||||
kind: string,
|
||||
props: Record<string, string>,
|
||||
layoutOrChild?: Record<string, string> | AetheriaMenuSurfaceComponent,
|
||||
styleOrChild?: Record<string, string> | AetheriaMenuSurfaceComponent,
|
||||
...children: AetheriaMenuSurfaceComponent[]
|
||||
): AetheriaMenuSurfaceComponent {
|
||||
return { id, kind, props, children };
|
||||
const layout = isSurfaceComponent(layoutOrChild) ? undefined : layoutOrChild;
|
||||
const style = isSurfaceComponent(styleOrChild) ? undefined : styleOrChild;
|
||||
const normalizedChildren = [
|
||||
...(isSurfaceComponent(layoutOrChild) ? [layoutOrChild] : []),
|
||||
...(isSurfaceComponent(styleOrChild) ? [styleOrChild] : []),
|
||||
...children,
|
||||
];
|
||||
return { id, kind, props, layout, style, children: normalizedChildren };
|
||||
}
|
||||
|
||||
function text(id: string, value: string, kind = "text"): AetheriaMenuSurfaceComponent {
|
||||
return node(id, kind, { value });
|
||||
function text(
|
||||
id: string,
|
||||
value: string,
|
||||
kind = "text",
|
||||
layout?: Record<string, string>,
|
||||
style?: Record<string, string>,
|
||||
): AetheriaMenuSurfaceComponent {
|
||||
return node(id, kind, { value }, layout, style);
|
||||
}
|
||||
|
||||
function metric(id: string, label: string, value: string): AetheriaMenuSurfaceComponent {
|
||||
|
|
@ -624,11 +734,65 @@ function metric(id: string, label: string, value: string): AetheriaMenuSurfaceCo
|
|||
}
|
||||
|
||||
function button(id: string, label: string, commandId: string): AetheriaMenuSurfaceComponent {
|
||||
return node(id, "control.button", { label, command: commandId });
|
||||
return node(
|
||||
id,
|
||||
"control.button",
|
||||
{ label, command: commandId },
|
||||
{ minWidth: "0", padding: "0.04rem 0" },
|
||||
{
|
||||
background: "rgba(0, 0, 0, 0)",
|
||||
borderWidth: "0",
|
||||
borderStyle: "solid",
|
||||
boxShadow: "none",
|
||||
font: "400 1.55rem/1.2 Ubuntu, sans-serif",
|
||||
color: "#e8fbff",
|
||||
textAlign: "left",
|
||||
});
|
||||
}
|
||||
|
||||
function buttonColumn(id: string, ...children: AetheriaMenuSurfaceComponent[]): AetheriaMenuSurfaceComponent {
|
||||
return node(id, "column", {}, ...children);
|
||||
return node(id, "column", {}, { gap: "0.18rem", alignItems: "flex-start" }, { color: "#e8fbff" }, ...children);
|
||||
}
|
||||
|
||||
function gravitySurface(id: string): AetheriaMenuSurfaceComponent {
|
||||
return node(
|
||||
id,
|
||||
"gravity.surface",
|
||||
{
|
||||
label: "Aetheria level gravity surface",
|
||||
viewRadius: "1450",
|
||||
terrainRadius: "1450",
|
||||
terrainDepth: "-8",
|
||||
terrainDepthExponent: "1.2",
|
||||
terrainWaveFrequency: "0.6",
|
||||
simulationTimeSeconds: "0",
|
||||
samplesX: "196",
|
||||
isolines: "22",
|
||||
shader: "perlines.gravity-map.v1",
|
||||
noiseAsset: "cultmesh://aetheria/assets/textures/perlines-nebula",
|
||||
tintSplatAsset: "cultmesh://aetheria/assets/textures/tint_splat",
|
||||
bodies: [
|
||||
"terminus-sun|Sun|0|0|900|-80|3|450|10|2|cultmesh://aetheria/assets/icons/star.terminus-sun|cultmesh://aetheria/assets/textures/tint_splat",
|
||||
"anchor-moon|Planet|360|-180|260|-22|2.2|180|4|1.4|cultmesh://aetheria/assets/icons/body.anchor-moon|cultmesh://aetheria/assets/textures/tint_splat",
|
||||
"blueglass|Planet|-540|340|340|-34|2.6|150|5|1.1|cultmesh://aetheria/assets/icons/body.blueglass|cultmesh://aetheria/assets/textures/tint_splat",
|
||||
"emberhook|Planet|-680|-420|310|-28|2.1|130|4|1.3|cultmesh://aetheria/assets/icons/body.emberhook|cultmesh://aetheria/assets/textures/tint_splat",
|
||||
"vesper|Gas Giant|780|420|420|-38|2.4|210|6|0.7|cultmesh://aetheria/assets/icons/body.vesper|cultmesh://aetheria/assets/textures/tint_splat",
|
||||
"latch|Moon|-160|620|210|-18|2.8|95|3|1.6|cultmesh://aetheria/assets/icons/body.latch|cultmesh://aetheria/assets/textures/tint_splat",
|
||||
].join(";"),
|
||||
objects: [
|
||||
"anchor-station|station|Anchor Station|-220|-90|1|0|player|1|1|cultmesh://aetheria/assets/icons/station.anchor-station",
|
||||
"vanguard-one|ship|Vanguard One|-60|-40|1|0.2|player|1|1|cultmesh://aetheria/assets/icons/ship.vanguard-one",
|
||||
"wing-two|ship|Wing Two|180|120|-0.4|0.9|player|1|1|cultmesh://aetheria/assets/icons/ship.wing-two",
|
||||
"torch-three|ship|Torch Three|-160|210|0.6|-0.8|player|1|1|cultmesh://aetheria/assets/icons/ship.torch-three",
|
||||
"ash-raider|ship|Ash Raider|420|180|-0.8|-0.1|raider|0|1|cultmesh://aetheria/assets/icons/ship.ash-raider",
|
||||
"derelict-relay|station|Derelict Relay|-260|260|0|1|neutral|0|1|cultmesh://aetheria/assets/icons/station.derelict-relay",
|
||||
].join(";"),
|
||||
},
|
||||
{ position: "absolute", top: "0", right: "0", bottom: "0", left: "0", width: "100%", height: "100%" });
|
||||
}
|
||||
|
||||
function isSurfaceComponent(value: unknown): value is AetheriaMenuSurfaceComponent {
|
||||
return !!value && typeof value === "object" && "kind" in value && "props" in value && "children" in value;
|
||||
}
|
||||
|
||||
function stableToken(value: string): string {
|
||||
|
|
|
|||
|
|
@ -23,13 +23,16 @@ const debugSurfacePath = resolve(process.env.AETHERIA_CULTUI_DEBUG_SURFACE_PATH
|
|||
const daemonDll = resolve(repoRoot, "Aetheria.State.Daemon", "bin", "Debug", "net10.0", "Aetheria.State.Daemon.dll");
|
||||
const rendererIndex = resolve(projectRoot, "wwwroot", "index.html");
|
||||
const rtsCultMeshPort = Number.parseInt(process.env.AETHERIA_RTS_CULTMESH_PORT ?? "3076", 10);
|
||||
const configuredDaemonEndpoint = process.env.AETHERIA_RTS_DAEMON_ENDPOINT?.trim() ?? "";
|
||||
const launchLocalDaemon = configuredDaemonEndpoint.length === 0;
|
||||
const rtsCultMeshEndpoint = configuredDaemonEndpoint || `rudp://127.0.0.1:${rtsCultMeshPort}`;
|
||||
const rtsVerseId = process.env.AETHERIA_RTS_VERSE_ID?.trim() || "aetheria.local";
|
||||
const rtsDaemonId = process.env.AETHERIA_RTS_DAEMON_ID?.trim() || "starfire-rts";
|
||||
const configuredDaemonUri = process.env.AETHERIA_RTS_CULTMESH_URI?.trim() ?? "";
|
||||
const legacyDaemonEndpoint = process.env.AETHERIA_RTS_DAEMON_ENDPOINT?.trim() ?? "";
|
||||
const launchLocalDaemon = configuredDaemonUri.length === 0 && legacyDaemonEndpoint.length === 0;
|
||||
const rtsCultMeshUri = configuredDaemonUri || `cultmesh://odin/aetheria/rts/${encodeURIComponent(rtsDaemonId)}`;
|
||||
const rtsCultMeshAdvertiseHost = process.env.AETHERIA_RTS_CULTMESH_ADVERTISE_HOST?.trim() || "127.0.0.1";
|
||||
const peerCultMeshEndpoints = parseEndpointList(process.env.AETHERIA_RTS_PEER_CULTMESH_ENDPOINTS);
|
||||
const removedResolvedRudpEndpoint = process.env.AETHERIA_RTS_RESOLVED_RUDP_ENDPOINT?.trim() ?? "";
|
||||
const removedPeerCultMeshEndpoints = process.env.AETHERIA_RTS_PEER_CULTMESH_ENDPOINTS?.trim() ?? "";
|
||||
const localDaemonRudpEndpoint = launchLocalDaemon ? `rudp://127.0.0.1:${rtsCultMeshPort}` : "";
|
||||
const electronSmoke = process.env.AETHERIA_RTS_ELECTRON_SMOKE === "1";
|
||||
const electronSmokeResultPath = process.env.AETHERIA_RTS_ELECTRON_SMOKE_RESULT;
|
||||
const rendererView = process.env.AETHERIA_RTS_VIEW?.trim() ?? "";
|
||||
|
|
@ -83,6 +86,16 @@ app.whenReady().then(async () => {
|
|||
showStartup("Preparing Aetheria RTS", "Building daemon if needed.");
|
||||
|
||||
try {
|
||||
if (legacyDaemonEndpoint) {
|
||||
throw new Error("AETHERIA_RTS_DAEMON_ENDPOINT has been removed. Configure AETHERIA_RTS_CULTMESH_URI and let Odin/CultMesh resolve the transport.");
|
||||
}
|
||||
if (removedResolvedRudpEndpoint) {
|
||||
throw new Error("AETHERIA_RTS_RESOLVED_RUDP_ENDPOINT has been removed. Configure AETHERIA_RTS_CULTMESH_URI and let Odin/CultMesh resolve the daemon transport.");
|
||||
}
|
||||
if (removedPeerCultMeshEndpoints) {
|
||||
throw new Error("AETHERIA_RTS_PEER_CULTMESH_ENDPOINTS has been removed. Configure AETHERIA_RTS_CULTMESH_URI and let Odin/CultMesh discover peer endpoints.");
|
||||
}
|
||||
|
||||
if (rendererView === "main-menu") {
|
||||
showStartup("Launching Aetheria Menu", "Lowering the CultUI main-menu surface.");
|
||||
mkdirSync(runtimeRoot, { recursive: true });
|
||||
|
|
@ -107,15 +120,20 @@ app.whenReady().then(async () => {
|
|||
"20",
|
||||
"--api-publication-interval-ms",
|
||||
"100000",
|
||||
...peerCultMeshEndpoints.flatMap(endpoint => ["--peer-cultmesh-endpoint", endpoint]),
|
||||
]);
|
||||
} else {
|
||||
showStartup("Connecting Aetheria RTS", `Using daemon ${rtsCultMeshEndpoint}.`);
|
||||
showStartup("Connecting Aetheria RTS", `Using daemon ${rtsCultMeshUri}.`);
|
||||
mkdirSync(runtimeRoot, { recursive: true });
|
||||
}
|
||||
|
||||
rtsClient = new AetheriaCultMeshClient(
|
||||
rtsCultMeshEndpoint,
|
||||
{
|
||||
uri: rtsCultMeshUri,
|
||||
peerId: rtsDaemonId,
|
||||
verseId: rtsVerseId,
|
||||
role: "aetheria-rts-daemon",
|
||||
endpoints: localDaemonRudpEndpoint ? [localDaemonRudpEndpoint] : [],
|
||||
},
|
||||
runtimeStatePath,
|
||||
"aetheria-rts-electron",
|
||||
{ publicationMode: launchLocalDaemon ? "local" : "remote" });
|
||||
|
|
@ -339,10 +357,10 @@ function registerIpc(): void {
|
|||
() => ({
|
||||
status: "ok",
|
||||
transport: "cultmesh-rudp",
|
||||
endpoint: rtsCultMeshEndpoint,
|
||||
endpoint: rtsCultMeshUri,
|
||||
verseId: rtsVerseId,
|
||||
daemonId: rtsDaemonId,
|
||||
peerEndpoints: peerCultMeshEndpoints,
|
||||
peerEndpoints: [],
|
||||
daemonRunning: daemonProcess != null && !daemonProcess.killed,
|
||||
daemonMode: launchLocalDaemon ? "local" : "remote",
|
||||
}));
|
||||
|
|
@ -526,16 +544,6 @@ function stringOr(value: unknown, fallback: string): string {
|
|||
return typeof value === "string" ? value : fallback;
|
||||
}
|
||||
|
||||
function parseEndpointList(value: string | undefined): string[] {
|
||||
if (!value)
|
||||
return [];
|
||||
|
||||
return value
|
||||
.split(/[;,]/u)
|
||||
.map(endpoint => endpoint.trim())
|
||||
.filter(endpoint => endpoint.length > 0);
|
||||
}
|
||||
|
||||
function requireClient(): AetheriaCultMeshClient {
|
||||
if (!rtsClient)
|
||||
throw new Error("Aetheria RTS CultMesh client is not initialized.");
|
||||
|
|
|
|||
12
Aetheria.Rts.Web/package-lock.json
generated
12
Aetheria.Rts.Web/package-lock.json
generated
|
|
@ -8,6 +8,7 @@
|
|||
"name": "aetheria-rts-web",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@gamecult/eve-browser-lowering": "file:../../Eve/packages/eve-browser-lowering",
|
||||
"@msgpack/msgpack": "^3.1.2",
|
||||
"cultcache-ts": "file:../../CultLib/packages/cultcache-ts",
|
||||
"cultmesh-ts": "file:../../CultLib/packages/cultmesh-ts",
|
||||
|
|
@ -60,6 +61,13 @@
|
|||
"zod": "^3.25.76"
|
||||
}
|
||||
},
|
||||
"../../Eve/packages/eve-browser-lowering": {
|
||||
"name": "@gamecult/eve-browser-lowering",
|
||||
"version": "0.1.0",
|
||||
"devDependencies": {
|
||||
"typescript": "^5.6.3"
|
||||
}
|
||||
},
|
||||
"node_modules/@electron-internal/extract-zip": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@electron-internal/extract-zip/-/extract-zip-1.0.3.tgz",
|
||||
|
|
@ -91,6 +99,10 @@
|
|||
"undici": "^7.24.4"
|
||||
}
|
||||
},
|
||||
"node_modules/@gamecult/eve-browser-lowering": {
|
||||
"resolved": "../../Eve/packages/eve-browser-lowering",
|
||||
"link": true
|
||||
},
|
||||
"node_modules/@msgpack/msgpack": {
|
||||
"version": "3.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@msgpack/msgpack/-/msgpack-3.1.3.tgz",
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"@msgpack/msgpack": "^3.1.2",
|
||||
"@gamecult/eve-browser-lowering": "file:../../Eve/packages/eve-browser-lowering",
|
||||
"cultcache-ts": "file:../../CultLib/packages/cultcache-ts",
|
||||
"cultmesh-ts": "file:../../CultLib/packages/cultmesh-ts",
|
||||
"cultnet-ts": "file:../../CultLib/packages/cultnet-ts"
|
||||
|
|
|
|||
|
|
@ -250,12 +250,12 @@ if (-not $clientText.Contains('? this.verse.withRoute("network", this.publicatio
|
|||
}
|
||||
|
||||
if (-not $clientText.Contains('this.commandVerse = this.verse') -or
|
||||
-not $clientText.Contains('.withRoute("network", this.endpoint)') -or
|
||||
-not $clientText.Contains('.withRoute("network", this.daemonTarget.uri)') -or
|
||||
-not $clientText.Contains('.withClaim("commander-control"')) {
|
||||
Write-Error "Stage 7B verifier failed: RTS client is not deriving a network Verse view with an explicit command authority claim."
|
||||
}
|
||||
|
||||
if (-not $clientText.Contains('this.publicationDescription = publicationMode === "remote" ? this.endpoint : statePath')) {
|
||||
if (-not $clientText.Contains('this.publicationDescription = publicationMode === "remote" ? this.daemonTarget.uri : statePath')) {
|
||||
Write-Error "Stage 7B verifier failed: RTS client query route metadata does not include the local publication source description."
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,13 +33,13 @@ if (-not $mainText.Contains('await api.setMoveVector') -or
|
|||
Write-Error "Stage 7C Electron shell verifier failed: Electron smoke does not verify typed operation receipts through preload."
|
||||
}
|
||||
|
||||
if (-not $mainText.Contains('AETHERIA_RTS_PEER_CULTMESH_ENDPOINTS') -or
|
||||
-not $mainText.Contains('--peer-cultmesh-endpoint') -or
|
||||
if (-not $mainText.Contains('AETHERIA_RTS_RESOLVED_RUDP_ENDPOINT has been removed') -or
|
||||
-not $mainText.Contains('AETHERIA_RTS_PEER_CULTMESH_ENDPOINTS has been removed') -or
|
||||
-not $mainText.Contains('AETHERIA_RTS_VERSE_ID') -or
|
||||
-not $mainText.Contains('--verse-id') -or
|
||||
-not $mainText.Contains('AETHERIA_RTS_DAEMON_ID') -or
|
||||
-not $mainText.Contains('--daemon-id')) {
|
||||
Write-Error "Stage 7C Electron shell verifier failed: Electron launcher does not pass Verse identity and peer CultMesh endpoints into the local daemon."
|
||||
Write-Error "Stage 7C Electron shell verifier failed: Electron launcher does not enforce CultMesh URI daemon targeting."
|
||||
}
|
||||
|
||||
$electron = Join-Path $root "node_modules\electron\dist\electron.exe"
|
||||
|
|
@ -60,7 +60,6 @@ try {
|
|||
$env:AETHERIA_RTS_CULTMESH_PORT = $port.ToString()
|
||||
$env:AETHERIA_RTS_VERSE_ID = "aetheria.stage7c.electron"
|
||||
$env:AETHERIA_RTS_DAEMON_ID = "stage7c-starfire"
|
||||
$env:AETHERIA_RTS_PEER_CULTMESH_ENDPOINTS = "rudp://127.0.0.1:1"
|
||||
$env:AETHERIA_RTS_ELECTRON_SMOKE_RESULT = $resultPath
|
||||
$process = Start-Process -FilePath $electron -ArgumentList "." -WorkingDirectory $root -Wait -PassThru
|
||||
if ($process.ExitCode -ne 0) {
|
||||
|
|
@ -83,6 +82,7 @@ finally {
|
|||
Remove-Item Env:\AETHERIA_RTS_VERSE_ID -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:\AETHERIA_RTS_DAEMON_ID -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:\AETHERIA_RTS_PEER_CULTMESH_ENDPOINTS -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:\AETHERIA_RTS_RESOLVED_RUDP_ENDPOINT -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:\AETHERIA_RTS_ELECTRON_SMOKE_RESULT -ErrorAction SilentlyContinue
|
||||
Remove-Item -LiteralPath $tempRoot -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,7 +54,13 @@ if (!clientModulePath)
|
|||
|
||||
const { AetheriaCultMeshClient } = await import(pathToFileURL(clientModulePath).href);
|
||||
|
||||
const client = new AetheriaCultMeshClient(endpoint, statePath, "stage7c-verifier");
|
||||
const client = new AetheriaCultMeshClient({
|
||||
uri: "cultmesh://odin/aetheria/rts/stage7c-verifier",
|
||||
peerId: "stage7c-daemon",
|
||||
verseId: "aetheria.local",
|
||||
role: "aetheria-rts-daemon",
|
||||
endpoints: [endpoint],
|
||||
}, statePath, "stage7c-verifier");
|
||||
const viewport = await client.mapViewport({ minX: -5000, minY: -5000, maxX: 5000, maxY: 5000 });
|
||||
const objectsViewport = await client.objectsViewport({ minX: -5000, minY: -5000, maxX: 5000, maxY: 5000 });
|
||||
const gravityViewport = await client.gravityViewport({ minX: -5000, minY: -5000, maxX: 5000, maxY: 5000 });
|
||||
|
|
|
|||
|
|
@ -66,15 +66,21 @@ try {
|
|||
@'
|
||||
import { pathToFileURL } from "node:url";
|
||||
|
||||
const endpoint = process.env.AETHERIA_STAGE7D_REMOTE_ENDPOINT;
|
||||
const endpoint = process.env.AETHERIA_STAGE7D_RESOLVED_RUDP_ENDPOINT;
|
||||
const clientModulePath = process.env.AETHERIA_STAGE7D_REMOTE_CLIENT_MODULE;
|
||||
if (!endpoint)
|
||||
throw new Error("Stage 7D verifier missing remote endpoint.");
|
||||
throw new Error("Stage 7D verifier missing resolved RUDP endpoint.");
|
||||
if (!clientModulePath)
|
||||
throw new Error("Stage 7D verifier missing compiled client module path.");
|
||||
|
||||
const { AetheriaCultMeshClient } = await import(pathToFileURL(clientModulePath).href);
|
||||
const client = new AetheriaCultMeshClient(endpoint, "unused-local-state.cc", "stage7d-starfire", {
|
||||
const client = new AetheriaCultMeshClient({
|
||||
uri: "cultmesh://odin/aetheria/rts/stage7d-starfire",
|
||||
peerId: "stage7d-daemon",
|
||||
verseId: "aetheria.local",
|
||||
role: "aetheria-rts-daemon",
|
||||
endpoints: [endpoint],
|
||||
}, "unused-local-state.cc", "stage7d-starfire", {
|
||||
publicationMode: "remote",
|
||||
snapshotTimeoutMs: 5000,
|
||||
});
|
||||
|
|
@ -120,7 +126,7 @@ try {
|
|||
}
|
||||
'@ | Set-Content -LiteralPath $smokeScript -Encoding UTF8
|
||||
|
||||
$env:AETHERIA_STAGE7D_REMOTE_ENDPOINT = $endpoint
|
||||
$env:AETHERIA_STAGE7D_RESOLVED_RUDP_ENDPOINT = $endpoint
|
||||
$env:AETHERIA_STAGE7D_REMOTE_CLIENT_MODULE = Join-Path $root "electron-dist\aetheria-cultmesh.js"
|
||||
node $smokeScript
|
||||
if ($LASTEXITCODE -ne 0) {
|
||||
|
|
@ -128,7 +134,7 @@ try {
|
|||
}
|
||||
}
|
||||
finally {
|
||||
Remove-Item Env:\AETHERIA_STAGE7D_REMOTE_ENDPOINT -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:\AETHERIA_STAGE7D_RESOLVED_RUDP_ENDPOINT -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:\AETHERIA_STAGE7D_REMOTE_CLIENT_MODULE -ErrorAction SilentlyContinue
|
||||
if ($daemon -and -not $daemon.HasExited) {
|
||||
Stop-Process -Id $daemon.Id -Force
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Aetheria RTS</title>
|
||||
<link rel="stylesheet" href="../node_modules/@gamecult/eve-browser-lowering/styles.css">
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
Loading…
Reference in a new issue