# V3 Pixel Streaming Worker

This directory contains the launch contract for the V3 UE Pixel Streaming worker
fleet.

## Build

The BuildGraph target is `V3 Pixel Streaming Worker` in `V3/ue/Build/Build.xml`.
It compiles `V3PixelStreamingWorker`, cooks the Lilith Commons Atrium for Win64,
stages pak/iostore output, writes the headless Pixel Streaming command line into
the staged build, and archives the worker under:

```text
V3/ue/Saved/BuildGraph/PixelStreamingWorker/Win64
```

Example:

```powershell
& "$env:UE_ROOT\Engine\Build\BatchFiles\RunUAT.bat" BuildGraph `
  -Script="V3\ue\Build\Build.xml" `
  -Target="V3 Pixel Streaming Worker" `
  -Set:ProjectFile="$PWD\V3\ue\V3.uproject" `
  -Set:ArchiveRoot="$PWD\V3\ue\Saved\BuildGraph"
```

## Run

Windows workers should use `launch-worker.ps1`. Linux-hosted containers use
`launch-worker.sh` and require either a native Linux worker archive or `wine64`
for a Win64 archive.

Minimum environment:

```text
V3_WORKER_ROOT=/opt/v3/worker
V3_PIXELSTREAMING_URL=wss://lilith-pxstream-signaller.internal/ws
V3_WORKER_MAP=/Game/World/Atrium/L_LilithCommonsAtrium
```

Production workers require `wss://` signalling. Local `ws://127.0.0.1:*` or
`ws://localhost:*` signallers require `V3_ALLOW_INSECURE_LOCAL_PIXELSTREAMING=1`
so insecure development sessions cannot ship by accident.

The launch scripts always load the Atrium and pass the headless Pixel Streaming
flags:

```text
/Game/World/Atrium/L_LilithCommonsAtrium -RenderOffScreen -AudioMixer -ForceRes -ResX=1920 -ResY=1080 -FPS=60 -PixelStreamingURL=<signaller>
```

The standard quality contract is 1920x1080, 60 fps, 12 Mbps start bitrate.
Workers default to H.264 for broad compatibility. Set `V3_PIXELSTREAMING_CODEC`
to `AV1` only for Chrome 121+ or Edge 121+ sessions on Ada-generation GPU
workers such as AWS g6e. AV1 is accepted only when the browser probe confirms at
least a 3.0 VMAF improvement over H.264 at the same bitrate using
`codec-quality-eval.json`.

## Nightly image

`.github/workflows/v3-pixel-streaming-worker.yml` builds the Win64 archive,
publishes the Ubuntu GPU image to GHCR nightly, and can mirror to ECR when AWS
credentials are configured. The image runs the Win64 cook through `wine64` and
fails fast unless the NVIDIA container runtime exposes `nvidia-smi` and
`libnvidia-encode.so.1`.

The scheduled g6e smoke job pulls the immutable `sha-${GITHUB_SHA}` tag, starts
it with `--gpus all`, and calls the browser WebRTC probe declared by
`V3_PIXELSTREAMING_BROWSER_PROBE_URL`. The AV1 matrix covers Chrome and Edge;
each probe must receive a 1080p60 AV1 session from the Atrium worker within 30
seconds of container start and pass the same-bitrate quality threshold.

The same matrix also covers the H.264 fallback contract for Safari 17+, iOS
Safari 17+, Chrome <= 120, Edge <= 120, and Firefox ESR 115+. Those probes must
negotiate H.264 at 1080p60 from the same image tag without changing worker
archive contents.
