Files
esports/streamer/WSL.md
Stan Runge 54444a77f0 feat: add native Windows broadcaster and live score modules
- streamer/windows: vash-broadcast.exe (setup/login/start/stop/status/doctor)
  with per-instance OBS, tosu and FFmpeg, a supervised worker, OCR room
  selection and OBS scene reconciliation; built and tested on Linux only
- streamer/relay.ts shared with Vash TV; Cloudflare Access proxy for dev/staging
- worker status validation and live score helpers for the site
- STREAMING_HANDOFF.md and streamer/ALPHA_TEST.md record what is unverified

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 22:02:25 +00:00

100 lines
6.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Test a match from Windows 11 + WSL Ubuntu
Use Ubuntu for the repository, builds, and optional Docker relay. Run osu!tourney, tosu, OBS, and the compiled Windows agent on Windows. This uses OBS's native AMD encoder on an RX 7900 XT. The Vash web server and its IRC host stay on the existing server; this PC only runs the broadcast tools.
WSL can [launch Windows executables directly](https://learn.microsoft.com/en-us/windows/wsl/filesystems#run-windows-tools-from-linux). Using `vash-streamer.exe` means its `127.0.0.1` addresses refer to Windows, where OBS and tosu are running.
## 1. Clone and build in Ubuntu
If Ubuntu is not installed yet, run `wsl --install -d Ubuntu` in an administrator PowerShell window, restart if prompted, and finish Ubuntu's first-run setup. Open Ubuntu with `wsl -d Ubuntu`.
Inside Ubuntu:
```bash
sudo apt update
sudo apt install -y git curl unzip
curl -fsSL https://bun.com/install | bash
source ~/.bashrc
mkdir -p ~/dev
cd ~/dev
git clone --branch dev https://git.stanrunge.dev/stan/esports.git
cd esports
bun install --frozen-lockfile
bun run streamer:build
```
The build produces `dist/vash-streamer.exe` and `dist/vash-streamer`. Use the `.exe` for this setup. A streaming-only clone needs no server `.env`, database, or `bun run dev`.
## 2. Prepare the Windows programs
1. Make a separate osu! stable installation for osu!tourney and follow the [official setup guide](https://osu.ppy.sh/wiki/en/osu!_tournament_client/osu!tourney/Setup). Sign in with an account you are allowed to operate that has osu!supporter. The spectating account must differ from the account playing the match.
2. Put this `tournament.cfg` next to that installation's `osu!.exe` for a 1v1 test, then launch it:
```ini
TeamSize = 1
acronym = VASH
```
3. Start the Windows build of [tosu](https://github.com/tosuapp/tosu/releases). Its WebSocket should be available at `ws://127.0.0.1:24050/websocket/v2`.
4. Start OBS. Enable **Tools → WebSocket Server Settings → Enable WebSocket server**, keep port **4455**, and copy its password. Set a 1920×1080 canvas and choose the AMD H.264 encoder for streaming/recording.
## 3. Connect a broadcast channel
On **https://esports-dev.vash.software/broadcast**, create a channel using **Over osu! gameplay**. Choose **One match** for a specific test, or the automatic mode while setting up. Copy the channel ID and its agent token. The **Agent token** button on the Broadcast list generates a new token and invalidates the old one; use the same current token for this agent and the optional relay.
In Ubuntu, from the repository root, replace the three placeholders:
```bash
./dist/vash-streamer.exe \
--server https://esports-dev.vash.software \
--channel 'CHANNEL_ID' --token 'AGENT_TOKEN' \
--obs-password 'OBS_WEBSOCKET_PASSWORD' --setup-obs
```
This creates a **Vash** scene, an osu! capture source, and the overlay. In OBS, open the capture source's properties and select the osu!tourney window. Arrange the gameplay beneath the overlay. The setup command exits; now start the agent and leave it running:
```bash
./dist/vash-streamer.exe \
--server https://esports-dev.vash.software \
--channel 'CHANNEL_ID' --token 'AGENT_TOKEN' \
--obs-password 'OBS_WEBSOCKET_PASSWORD'
```
## 4. Test one match
1. Create one real-lobby match in Vash's simulation lab. The match page should show a lobby link and move from opening to waiting for players.
2. Point the broadcast channel at that match. Join the lobby with your playing account. In osu!tourney's lower control panel, select the matching `VASH: (Red) vs (Blue)` room. Windows room selection is manual.
3. For password/referee access, configure `OSU_TOURNEY_ACCOUNT` on the Vash server to the spectating username before creating the lobby. The host grants it referee access during setup.
4. Start with OBS **Start Recording** or its preview. Play a map and check the overlay, agent connection, and live score on the match page. A simulated opponent exists inside Vash and has no real gameplay window to spectate.
5. To stream directly, configure the destination in OBS and press **Start Streaming**. OBS controls this stream; the site's **Go live** button controls the optional relay/container.
If the agent gets an HTTP login page or WebSocket 403 instead of connecting, check any access proxy in front of the dev site. Browser login cookies are not inherited by the standalone agent.
## 5. Optional: site playback, recording, and multistream
Install Docker Desktop on Windows. Enable **Use the WSL 2 based engine** and **Settings → Resources → WSL Integration → Ubuntu** ([Docker instructions](https://docs.docker.com/desktop/features/wsl/)). Then, in Ubuntu:
```bash
docker version
docker build -f streamer/tv/Dockerfile -t vash-tv streamer
docker run -d --name vash-relay --restart unless-stopped \
-p 127.0.0.1:1935:1935 \
-e VASH_SERVER=https://esports-dev.vash.software \
-e VASH_CHANNEL='CHANNEL_ID' -e VASH_TOKEN='AGENT_TOKEN' \
-e INGEST_KEY='CHOOSE_A_PRIVATE_KEY' vash-tv
docker ps --filter name=vash-relay
docker logs -f vash-relay
```
In OBS, choose **Settings → Stream → Custom**:
- Server: `rtmp://127.0.0.1:1935/live`
- Stream key: the `INGEST_KEY` value above
Configure destinations on the channel's Stream page, press **Go live**, then **Start Streaming** in OBS. The relay forwards OBS's encoded stream and uploads the recording when server storage is configured. It does not require GPU access. Stop OBS and press **End stream** when finished; `docker stop vash-relay` stops the relay. Use `docker start vash-relay` next time.
## Running the entire tourney container in WSL
The [Wine/container setup](README.md#6-autonomous-osutourney-container) can also be built and launched from WSL's Docker CLI, but it still needs osu! installation, login, and a real gameplay test on that host. The current image uses Xvfb and CPU encoding; it has no configured AMD GPU path. Docker Desktop's documented GPU support is [NVIDIA GPU-PV](https://docs.docker.com/desktop/features/gpu/). Windows OBS is the recommended first test for this AMD machine.