Discover playable worlds through CultMesh Verses
This commit is contained in:
parent
d8d0bd5eff
commit
e10821f1cc
7 changed files with 179 additions and 18 deletions
|
|
@ -8,14 +8,16 @@ does not own provider state, simulation, commands, receipts, assets, or plugin
|
|||
semantics.
|
||||
|
||||
The first package is `org.gamecult.eve.unity-scene`. A generic Unity host can
|
||||
connect any provider component that implements the EveUnity provider ports,
|
||||
including Aetheria's provider-owned adapter for its daemon-published 3D ARPG
|
||||
surface.
|
||||
discover a Verse from one CultMesh rendezvous endpoint, select an advertised
|
||||
`interactive-world` surface, and connect through the EveUnity provider ports.
|
||||
Aetheria's daemon-published 3D ARPG surface is the product witness; no Aetheria
|
||||
assembly is part of the client.
|
||||
|
||||
```powershell
|
||||
powershell -ExecutionPolicy Bypass -File .\scripts\run-package-tests.ps1
|
||||
powershell -ExecutionPolicy Bypass -File .\scripts\pack.ps1
|
||||
powershell -ExecutionPolicy Bypass -File .\scripts\run-playmode-capture.ps1
|
||||
powershell -ExecutionPolicy Bypass -File .\scripts\run-aetheria-daemon-world-witness.ps1
|
||||
```
|
||||
|
||||
See [docs/authority-map.md](docs/authority-map.md) for the live boundary.
|
||||
|
|
|
|||
|
|
@ -165,12 +165,12 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
[Timeout(300000)]
|
||||
public IEnumerator GenericCultMeshClientLowersAndMovesAdvertisedWorld()
|
||||
{
|
||||
var endpoint = Environment.GetEnvironmentVariable("EVEUNITY_PROVIDER_ENDPOINT");
|
||||
if (string.IsNullOrWhiteSpace(endpoint))
|
||||
Assert.Ignore("EVEUNITY_PROVIDER_ENDPOINT is not configured for the live provider witness.");
|
||||
var rendezvousEndpoint = Environment.GetEnvironmentVariable("EVEUNITY_RENDEZVOUS_ENDPOINT");
|
||||
if (string.IsNullOrWhiteSpace(rendezvousEndpoint))
|
||||
Assert.Ignore("EVEUNITY_RENDEZVOUS_ENDPOINT is not configured for the live provider witness.");
|
||||
|
||||
var providerId = Environment.GetEnvironmentVariable("EVEUNITY_PROVIDER_ID") ?? "aetheria.daemon";
|
||||
var surfaceId = Environment.GetEnvironmentVariable("EVEUNITY_SURFACE_ID") ?? "aetheria.game";
|
||||
var providerId = Environment.GetEnvironmentVariable("EVEUNITY_PROVIDER_ID") ?? "";
|
||||
var surfaceId = Environment.GetEnvironmentVariable("EVEUNITY_SURFACE_ID") ?? "";
|
||||
var replicaPath = Environment.GetEnvironmentVariable("EVEUNITY_REPLICA_PATH") ??
|
||||
Path.Combine(Application.temporaryCachePath, $"eve-unity-{Guid.NewGuid():N}.cc");
|
||||
var capturePath = Environment.GetEnvironmentVariable("EVEUNITY_AETHERIA_CAPTURE_PATH") ??
|
||||
|
|
@ -191,8 +191,20 @@ namespace GameCult.EveUnity.GenericClient.PlayModeTests
|
|||
|
||||
try
|
||||
{
|
||||
var selection = new EveUnityCultMeshProviderDiscovery().Discover(
|
||||
rendezvousEndpoint,
|
||||
providerId,
|
||||
surfaceId,
|
||||
"interactive-world");
|
||||
Assert.That(selection.VerseId, Is.Not.Empty);
|
||||
Assert.That(selection.ProviderId, Is.Not.Empty);
|
||||
Assert.That(selection.SurfaceId, Is.Not.Empty);
|
||||
transport = new EveUnityCultMeshLiveProviderTransport(
|
||||
replicaPath, endpoint, providerId, surfaceId, $"eve-unity-test-{Guid.NewGuid():N}");
|
||||
replicaPath,
|
||||
selection.Endpoint,
|
||||
selection.ProviderId,
|
||||
selection.SurfaceId,
|
||||
$"eve-unity-test-{Guid.NewGuid():N}");
|
||||
var publicationDeadline = Time.realtimeSinceStartup + 10f;
|
||||
while (true)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ drivers, asset-provider hooks, package release, runtime tests, and captures.
|
|||
|
||||
## Inputs
|
||||
|
||||
- CultMesh rendezvous endpoint
|
||||
- CultMesh Verse catalog
|
||||
- `gamecult.eve.provider_advertisement.v1`
|
||||
- `gamecult.eve.surface.v1`
|
||||
- provider asset-manifest documents
|
||||
|
|
@ -39,10 +41,11 @@ projection shells may not implement Sai, Norn, or TeX semantics.
|
|||
|
||||
## Shared Paths
|
||||
|
||||
Initial connect, refresh, reconnect, and terminal-receipt reconciliation all
|
||||
consume provider surface documents. Movement, focus, target, and action input
|
||||
all become `gamecult.eve.command_invocation.v1` through the provider-advertised command
|
||||
boundary.
|
||||
Initial connect discovers a Verse endpoint and selects a provider surface by
|
||||
semantic kind. Refresh, reconnect, and terminal-receipt reconciliation consume
|
||||
that provider's surface documents. Movement, focus, target, and action input all
|
||||
become `gamecult.eve.command_invocation.v1` through the provider-advertised
|
||||
command boundary.
|
||||
|
||||
## Cut Line
|
||||
|
||||
|
|
@ -55,5 +58,7 @@ runtime lifecycle.
|
|||
|
||||
`TestProject` proves that a clean Unity project can install CultLib, Eve
|
||||
contracts, and EveUnity without Aetheria or Brokkr assemblies. Its world-smoke
|
||||
capture is the generic control witness. The product witness must use the same
|
||||
client body against a separately running provider daemon.
|
||||
capture is the generic control witness. The Aetheria product witness gives the
|
||||
same client only a rendezvous endpoint, then proves Verse discovery, provider
|
||||
selection, asset loading, movement, commands, receipts, and rendered capture
|
||||
against a separately running daemon.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,138 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using GameCult.Eve.Surface;
|
||||
using GameCult.Mesh;
|
||||
using GameCult.Networking;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace GameCult.Eve.UnityScene
|
||||
{
|
||||
public sealed class EveUnityCultMeshProviderSelection
|
||||
{
|
||||
public EveUnityCultMeshProviderSelection(
|
||||
string endpoint,
|
||||
string verseId,
|
||||
string providerId,
|
||||
string surfaceId,
|
||||
string surfaceKind)
|
||||
{
|
||||
Endpoint = endpoint ?? "";
|
||||
VerseId = verseId ?? "";
|
||||
ProviderId = providerId ?? "";
|
||||
SurfaceId = surfaceId ?? "";
|
||||
SurfaceKind = surfaceKind ?? "";
|
||||
}
|
||||
|
||||
public string Endpoint { get; }
|
||||
public string VerseId { get; }
|
||||
public string ProviderId { get; }
|
||||
public string SurfaceId { get; }
|
||||
public string SurfaceKind { get; }
|
||||
}
|
||||
|
||||
public sealed class EveUnityCultMeshProviderDiscovery
|
||||
{
|
||||
private static readonly Type[] AdvertisementDocumentTypes =
|
||||
{
|
||||
typeof(EveProviderAdvertisementDocument)
|
||||
};
|
||||
|
||||
public EveUnityCultMeshProviderSelection Discover(
|
||||
string rendezvousEndpoint,
|
||||
string providerId = "",
|
||||
string surfaceId = "",
|
||||
string surfaceKind = "interactive-world",
|
||||
string verseId = "")
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(rendezvousEndpoint))
|
||||
throw new ArgumentException("Rendezvous endpoint must be non-empty.", nameof(rendezvousEndpoint));
|
||||
|
||||
var response = CultMesh.CreateVerseDiscoveryClient().FetchAsync(
|
||||
rendezvousEndpoint,
|
||||
new CultMeshVerseCatalogRequestMessage
|
||||
{
|
||||
VerseIds = string.IsNullOrWhiteSpace(verseId) ? null : new[] { verseId },
|
||||
TransportVersion = "cultmesh.v0"
|
||||
})
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
|
||||
var candidates = response.Verses
|
||||
.Where(verse => string.IsNullOrWhiteSpace(verseId) ||
|
||||
string.Equals(verse.VerseId, verseId, StringComparison.Ordinal))
|
||||
.SelectMany(verse => (verse.DiscoveryEndpoints ?? Array.Empty<string>())
|
||||
.Select(endpoint => new { Verse = verse, Endpoint = endpoint }))
|
||||
.Where(candidate => !string.IsNullOrWhiteSpace(candidate.Endpoint))
|
||||
.ToArray();
|
||||
if (candidates.Length == 0)
|
||||
throw new InvalidOperationException("The rendezvous endpoint advertised no compatible Verse endpoints.");
|
||||
|
||||
var failures = new List<string>();
|
||||
foreach (var candidate in candidates)
|
||||
{
|
||||
try
|
||||
{
|
||||
var advertisement = FetchAdvertisements(candidate.Endpoint)
|
||||
.Where(document => string.IsNullOrWhiteSpace(providerId) ||
|
||||
string.Equals(document.ProviderId, providerId, StringComparison.Ordinal))
|
||||
.Select(document => new
|
||||
{
|
||||
Document = document,
|
||||
Surface = document.Surfaces.FirstOrDefault(surface =>
|
||||
(string.IsNullOrWhiteSpace(surfaceId) ||
|
||||
string.Equals(surface.SurfaceId, surfaceId, StringComparison.Ordinal)) &&
|
||||
(string.IsNullOrWhiteSpace(surfaceKind) ||
|
||||
string.Equals(surface.SurfaceKind, surfaceKind, StringComparison.Ordinal)))
|
||||
})
|
||||
.FirstOrDefault(match => match.Surface != null);
|
||||
if (advertisement?.Surface == null)
|
||||
continue;
|
||||
|
||||
return new EveUnityCultMeshProviderSelection(
|
||||
candidate.Endpoint,
|
||||
candidate.Verse.VerseId,
|
||||
advertisement.Document.ProviderId,
|
||||
advertisement.Surface.SurfaceId,
|
||||
advertisement.Surface.SurfaceKind);
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
failures.Add($"{candidate.Endpoint}: {error.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
var filter = $"provider='{providerId}', surface='{surfaceId}', kind='{surfaceKind}'";
|
||||
var detail = failures.Count == 0 ? "" : $" Endpoint failures: {string.Join(" | ", failures)}";
|
||||
throw new InvalidOperationException($"No advertised Eve surface matched {filter}.{detail}");
|
||||
}
|
||||
|
||||
private static EveProviderAdvertisementDocument[] FetchAdvertisements(string endpoint)
|
||||
{
|
||||
var cacheRegistry = CultMesh.CreateCultCacheDocumentRegistry(AdvertisementDocumentTypes);
|
||||
var networkRegistry = CultMesh.CreateCultNetDocumentRegistry(AdvertisementDocumentTypes, cacheRegistry);
|
||||
var snapshot = CultMesh.SnapshotEndpoint(
|
||||
endpoint,
|
||||
new CultMeshSnapshotEndpointOptions
|
||||
{
|
||||
Context = CultMesh.Verse("eve.discovery", "eve-unity").Context,
|
||||
DocumentRegistry = networkRegistry,
|
||||
Request = new CultMeshSnapshotRequestOptions
|
||||
{
|
||||
ShardId = "provider",
|
||||
ShardEpoch = 1,
|
||||
ConnectTimeout = TimeSpan.FromSeconds(5),
|
||||
ResponseTimeout = TimeSpan.FromSeconds(10),
|
||||
MessageIdPrefix = "eve-unity-discovery",
|
||||
RudpRuntimeId = "eve-unity.discovery",
|
||||
RudpMaxFragmentBytes = 2048
|
||||
}
|
||||
});
|
||||
return snapshot.FetchDocumentsAsync<EveProviderAdvertisementDocument>()
|
||||
.GetAwaiter()
|
||||
.GetResult()
|
||||
.ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: bdb9db9c8b284da98aa2f3cff21b5868
|
||||
|
|
@ -15,6 +15,7 @@
|
|||
},
|
||||
"supportedFeatures": [
|
||||
"providerAdvertisements",
|
||||
"verseDiscovery",
|
||||
"commandTransport",
|
||||
"providerSurfaceSession",
|
||||
"providerSurfaceSource",
|
||||
|
|
@ -84,6 +85,7 @@
|
|||
"packages/org.gamecult.eve.unity-scene/Runtime/EveUnitySceneClientSession.cs",
|
||||
"packages/org.gamecult.eve.unity-scene/Runtime/EveUnitySceneProviderConnection.cs",
|
||||
"packages/org.gamecult.eve.unity-scene/Runtime/EveUnitySceneLiveProviderBridge.cs",
|
||||
"packages/org.gamecult.eve.unity-scene/Runtime/CultMesh/EveUnityCultMeshProviderDiscovery.cs",
|
||||
"packages/org.gamecult.eve.unity-scene/Runtime/EveUnityPlayableWorldLiveClient.cs",
|
||||
"packages/org.gamecult.eve.unity-scene/Runtime/EveUnityPlayableWorldRuntime.cs",
|
||||
"packages/org.gamecult.eve.unity-scene/Runtime/EveUnityPlayableWorldClientHost.cs",
|
||||
|
|
|
|||
|
|
@ -103,9 +103,9 @@ try {
|
|||
}
|
||||
if (-not $ready) { throw "Aetheria daemon did not open CultMesh port $Port. See $daemonLogPath" }
|
||||
|
||||
$env:EVEUNITY_PROVIDER_ENDPOINT = "rudp://127.0.0.1:$Port"
|
||||
$env:EVEUNITY_PROVIDER_ID = "aetheria.daemon"
|
||||
$env:EVEUNITY_SURFACE_ID = "aetheria.game"
|
||||
$env:EVEUNITY_RENDEZVOUS_ENDPOINT = "rudp://127.0.0.1:$Port"
|
||||
Remove-Item Env:EVEUNITY_PROVIDER_ID -ErrorAction SilentlyContinue
|
||||
Remove-Item Env:EVEUNITY_SURFACE_ID -ErrorAction SilentlyContinue
|
||||
$env:EVEUNITY_REPLICA_PATH = $replicaPath
|
||||
$env:EVEUNITY_AETHERIA_CAPTURE_PATH = $capturePath
|
||||
$env:EVEUNITY_ASSET_CACHE_PATH = $assetCachePath
|
||||
|
|
|
|||
Reference in a new issue