Files
skate-3-rust-engine/scripts/build-multiplayer-test.ps1
T
Ethanw05 ddc30284b4 Generalize mod APIs, improve multiplayer and optimize mod rendering
Add generalized engine access and challenge mods, repair SKATE turn handling, and improve collision prediction and physics transitions. Reduce mod snapshot and material update overhead, preserve authored GLB materials with lighting and shadows, and improve CPU profiling.
2026-09-14 04:02:20 -06:00

28 lines
2.2 KiB
PowerShell

param([string]$OutputDirectory = 'bin/multiplayer')
$ErrorActionPreference = 'Stop'
$workspace = Split-Path -Parent $PSScriptRoot
Set-Location -LiteralPath $workspace
$output = [IO.Path]::GetFullPath((Join-Path $workspace $OutputDirectory))
$relay = Join-Path $output 'steam-relay'
$build = Join-Path $output 'build'
New-Item -ItemType Directory -Path $relay,$build -Force | Out-Null
$env:CARGO_TARGET_X86_64_PC_WINDOWS_MSVC_RUSTFLAGS = '-C target-feature=+crt-static'
# Share dependency artifacts, but link directly into this checkout's staging folder.
& cargo rustc --release --target x86_64-pc-windows-msvc --target-dir (Join-Path $workspace 'target') -p skate-game --bin skate3-multiplayer --no-default-features --locked -- -C extra-filename=-multiplayer-test --emit "link=$build/skate3-multiplayer-test.exe"
if ($LASTEXITCODE -ne 0) { throw 'Multiplayer build failed.' }
& cargo rustc --release --target x86_64-pc-windows-msvc --target-dir (Join-Path $workspace 'target') -p skate-steam-relay --bin skate-steam-relay --locked -- -C extra-filename=-multiplayer-test --emit "link=$build/relay-multiplayer-test.exe"
if ($LASTEXITCODE -ne 0) { throw 'Steam relay build failed.' }
Copy-Item -LiteralPath (Join-Path $build 'skate3-multiplayer-test.exe') -Destination (Join-Path $output 'skate3-multiplayer.exe') -Force
Copy-Item -LiteralPath (Join-Path $build 'relay-multiplayer-test.exe') -Destination (Join-Path $relay 'skate-steam-relay.exe') -Force
$metadata = (& cargo metadata --format-version 1 --locked) -join "`n"
if ($LASTEXITCODE -ne 0) { throw 'Could not locate the Steam redistributable.' }
# Extract only the JSON string we need. Windows PowerShell's JSON object parser
# rejects unrelated dependency feature keys that differ only in letter case.
$sdk = [regex]::Match($metadata, '"name":"steamworks-sys","version":"0\.13\.0".*?"manifest_path":("(?:[^"\\]|\\.)*")')
if (-not $sdk.Success) { throw 'Steamworks SDK package was not found in Cargo metadata.' }
$manifest = ConvertFrom-Json -InputObject $sdk.Groups[1].Value
$dll = Join-Path (Split-Path -Parent $manifest) 'lib/steam/redistributable_bin/win64/steam_api64.dll'
Copy-Item -LiteralPath $dll -Destination $relay
Write-Host "Staged multiplayer build: $output"
Write-Host 'Build only; no game or Steam process was launched.'