Restore daemon-backed Unity launch

This commit is contained in:
Meta Vens 2026-08-07 21:10:44 +01:00
commit 023a35944c
28 changed files with 130 additions and 93 deletions

View file

@ -15,37 +15,41 @@ $state = Join-Path $project "Build\aetheria-unity.cc"
$stateRecords = "$state.records"
New-Item -ItemType Directory -Force $artifacts | Out-Null
if (-not $SkipBuild) {
$assetLog = Join-Path $artifacts "asset-bundles.log"
$assets = Start-Process $UnityExe -ArgumentList @(
"-batchmode", "-quit", "-projectPath", $root,
"-executeMethod", "Aetheria.Editor.EveAssetBundleBuilder.BuildWindows",
"-logFile", $assetLog
) -PassThru -WindowStyle Hidden
Write-Host "Asset build PID: $($assets.Id)"
Write-Host "Asset build log: $assetLog"
if (-not $assets.WaitForExit(240000)) { Stop-Process $assets.Id -Force; throw "Asset build timed out." }
if ($assets.ExitCode -ne 0) { Get-Content $assetLog -Tail 120; throw "Asset build failed." }
$clientLog = Join-Path $artifacts "client-build.log"
$build = Start-Process $UnityExe -ArgumentList @(
"-batchmode", "-quit", "-projectPath", $project,
"-executeMethod", "AetheriaUnityBuild.BuildWindows",
"-logFile", $clientLog
) -PassThru -WindowStyle Hidden
Write-Host "Client build PID: $($build.Id)"
Write-Host "Client build log: $clientLog"
if (-not $build.WaitForExit(300000)) { Stop-Process $build.Id -Force; throw "Client build timed out." }
if ($build.ExitCode -ne 0 -or -not (Test-Path $clientExe)) { Get-Content $clientLog -Tail 120; throw "Client build failed." }
}
if (-not (Test-Path $clientExe)) { throw "Client executable not found. Run without -SkipBuild first." }
if (-not (Test-Path $stateRecords)) {
dotnet run --project $importProject -- $root $state
if ($LASTEXITCODE -ne 0 -or -not (Test-Path $stateRecords)) {
throw "Aetheria typed state import failed with exit code $LASTEXITCODE"
}
}
if (-not $SkipBuild) {
$env:AETHERIA_ASSET_CATALOG_STATE = $state
$assetLog = Join-Path $artifacts "asset-bundles.log"
$assets = Start-Process $UnityExe -ArgumentList @(
"-batchmode", "-quit", "-projectPath", $root,
"-cacheServerEnableDownload", "false", "-cacheServerEnableUpload", "false",
"-executeMethod", "Aetheria.Editor.EveAssetBundleBuilder.BuildWindows",
"-logFile", $assetLog
) -PassThru -WindowStyle Hidden
Write-Host "Asset build PID: $($assets.Id)"
Write-Host "Asset build log: $assetLog"
if (-not $assets.WaitForExit(600000)) { Stop-Process $assets.Id -Force; throw "Asset build timed out." }
if ($assets.ExitCode -ne 0) { Get-Content $assetLog -Tail 120; throw "Asset build failed." }
$clientLog = Join-Path $artifacts "client-build.log"
$build = Start-Process $UnityExe -ArgumentList @(
"-batchmode", "-quit", "-projectPath", $project,
"-cacheServerEnableDownload", "false", "-cacheServerEnableUpload", "false",
"-executeMethod", "AetheriaUnityBuild.BuildWindows",
"-logFile", $clientLog
) -PassThru -WindowStyle Hidden
Write-Host "Client build PID: $($build.Id)"
Write-Host "Client build log: $clientLog"
if (-not $build.WaitForExit(600000)) { Stop-Process $build.Id -Force; throw "Client build timed out." }
if ($build.ExitCode -ne 0 -or -not (Test-Path $clientExe)) { Get-Content $clientLog -Tail 120; throw "Client build failed." }
}
if (-not (Test-Path $clientExe)) { throw "Client executable not found. Run without -SkipBuild first." }
$daemonLog = Join-Path $artifacts "daemon.log"
$daemon = Start-Process dotnet -ArgumentList @(
"run", "--project", $daemonProject, "--",
@ -56,6 +60,7 @@ $daemon = Start-Process dotnet -ArgumentList @(
"--client-cultmesh-port", $Port,
"--tick-interval-ms", 20,
"--fixed-delta-ms", 20,
"--terminus-scenario", "standard",
"--no-odin-announcements"
) -PassThru -WindowStyle Hidden -RedirectStandardOutput $daemonLog -RedirectStandardError "$daemonLog.error"
Write-Host "Daemon PID: $($daemon.Id)"
@ -63,7 +68,11 @@ Write-Host "Daemon log: $daemonLog"
try {
$ready = $false
for ($i = 0; $i -lt 60; $i++) {
# A cold daemon build can take several minutes because the state schema
# generator and the Ymir/CultMesh dependency graph compile before Program
# publishes the endpoint. Readiness belongs to the endpoint, not an
# arbitrary 30-second process lifetime.
for ($i = 0; $i -lt 600; $i++) {
if ($daemon.HasExited) { throw "Aetheria daemon exited. See $daemonLog" }
if ((Test-Path $daemonLog) -and (Select-String $daemonLog -Pattern "Aetheria client CultMesh endpoint: cultnet\+tcp://127.0.0.1:$Port" -Quiet)) { $ready = $true; break }
Start-Sleep -Milliseconds 500

View file

@ -1,11 +1,15 @@
param(
[string] $CultLibRoot = "E:\Projects\CultLib",
[string] $EveUnityRoot = "E:\Projects\EveUnity",
[string] $YmirRoot = "E:\Projects\Ymir"
[string] $CultLibRoot = "",
[string] $EveUnityRoot = "",
[string] $YmirRoot = ""
)
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $PSScriptRoot
$projectsRoot = Split-Path -Parent $repoRoot
if ([string]::IsNullOrWhiteSpace($CultLibRoot)) { $CultLibRoot = Join-Path $projectsRoot "CultLib" }
if ([string]::IsNullOrWhiteSpace($EveUnityRoot)) { $EveUnityRoot = Join-Path $projectsRoot "EveUnity" }
if ([string]::IsNullOrWhiteSpace($YmirRoot)) { $YmirRoot = Join-Path $projectsRoot "Ymir" }
$project = Join-Path $repoRoot "Aetheria.State.Daemon.Smoke\Aetheria.State.Daemon.Smoke.csproj"
foreach ($dependency in @(
@ -18,6 +22,17 @@ foreach ($dependency in @(
}
}
$ymirSession = Join-Path $YmirRoot "src\Ymir.Core\YmirSession.cs"
$box2DProject = Join-Path $YmirRoot "src\Ymir.Box3D\Ymir.Box3D.csproj"
$box2DSource = Join-Path $YmirRoot "extern\box3d\CMakeLists.txt"
if (-not (Test-Path -LiteralPath $ymirSession -PathType Leaf) -or
-not (Test-Path -LiteralPath $box2DProject -PathType Leaf)) {
throw "Ymir does not expose the retained Box2D session API required by Aetheria. Use the current Aetheria integration revision."
}
if (-not (Test-Path -LiteralPath $box2DSource -PathType Leaf)) {
throw "Ymir's pinned Box2D submodule is missing. Run 'git -C $YmirRoot submodule update --init --recursive'."
}
$properties = @(
"-p:CultLibRoot=$CultLibRoot",
"-p:EveUnityRoot=$EveUnityRoot",

View file

@ -14,14 +14,14 @@ $manifest = Get-Content (Join-Path $ProjectPath "Packages/manifest.json") -Raw |
$lock = Get-Content (Join-Path $ProjectPath "Packages/packages-lock.json") -Raw | ConvertFrom-Json
$expected = @{
"org.gamecult.cultlib" = @(
"https://github.com/GameCult/CultLib.git?path=/unity/org.gamecult.cultlib#cultlib-unity-v1.0.30",
"0ef59b50c27ac019929f5e68bcd602983a190062")
"https://github.com/GameCult/CultLib.git?path=/unity/org.gamecult.cultlib#cultlib-unity-v1.0.43",
"f67f5122ed1bd11da016e7b820ed60145ccd0299")
"org.gamecult.eve.surface" = @(
"https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.surface#eveunity-surface-v0.2.4",
"e08fa08335f99e9edddeb706912eecfad07cb281")
"org.gamecult.eve.unity-scene" = @(
"https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.88",
"3ce813e29dcc5342b51985187de26c62eb8c90b4")
"https://github.com/GameCult/EveUnity.git?path=/packages/org.gamecult.eve.unity-scene#eveunity-scene-v0.3.103",
"050b2019bd6faa4275013516870d1ded245ee391")
}
foreach ($packageName in $expected.Keys) {
@ -34,9 +34,9 @@ foreach ($packageName in $expected.Keys) {
$cultLibPackage = Get-ChildItem (Join-Path $ProjectPath "Library/PackageCache") -Directory |
Where-Object Name -Like "org.gamecult.cultlib@*" |
Where-Object { (Get-Content (Join-Path $_.FullName "package.json") -Raw | ConvertFrom-Json).version -eq "1.0.30" } |
Where-Object { (Get-Content (Join-Path $_.FullName "package.json") -Raw | ConvertFrom-Json).version -eq "1.0.43" } |
Select-Object -First 1
if (-not $cultLibPackage) { throw "Resolved CultLib package is missing from Library/PackageCache." }
if (-not $cultLibPackage) { throw "Resolved CultLib 1.0.43 package is missing from Library/PackageCache." }
$meshAssembly = Join-Path $cultLibPackage.FullName "Runtime/Plugins/GameCult.Mesh.dll"
if (-not (Test-Path $meshAssembly)) { throw "Resolved GameCult.Mesh.dll is missing." }
@ -46,8 +46,8 @@ $requiredMeshApiNames = @(
"CultMeshBodyPublicationDocument",
"CultMeshBodyPublicationHandle",
"CultMeshFrameBodyPublisher",
"CultMeshContentServer",
"CultMeshSessionContentProviderOptions")
"CultMeshTcpContentServer",
"CultMeshSessionContentProvider")
foreach ($apiName in $requiredMeshApiNames) {
if (-not ($meshApi | Where-Object { $_ -eq $apiName })) {
throw "Resolved GameCult.Mesh.dll does not expose $apiName."
@ -68,9 +68,9 @@ foreach ($requiredInputContract in @("PayloadKeys", "CurrentValue", "ActionBar",
$scenePackage = Get-ChildItem (Join-Path $ProjectPath "Library/PackageCache") -Directory |
Where-Object Name -Like "org.gamecult.eve.unity-scene@*" |
Where-Object { (Get-Content (Join-Path $_.FullName "package.json") -Raw | ConvertFrom-Json).version -eq "0.3.88" } |
Where-Object { (Get-Content (Join-Path $_.FullName "package.json") -Raw | ConvertFrom-Json).version -eq "0.3.103" } |
Select-Object -First 1
if (-not $scenePackage) { throw "Resolved Eve Unity scene 0.3.88 package is missing from Library/PackageCache." }
if (-not $scenePackage) { throw "Resolved Eve Unity scene 0.3.103 package is missing from Library/PackageCache." }
$advertisedInputSource = Get-Content (Join-Path $scenePackage.FullName "Runtime/EveUnityAdvertisedInputAction.cs") -Raw
$inputDriverSource = Get-Content (Join-Path $scenePackage.FullName "Runtime/EveUnityPlayableWorldInputDriver.cs") -Raw
$actionBarSource = Get-Content (Join-Path $scenePackage.FullName "Runtime/EveUnityInputActionBar.cs") -Raw