Can a single GPU and one Linux box turn a "realtime playable" neural renderer from a demo clip into something running in your terminal? That promise has been made and broken repeatedly, so when Matrix-Game 4.0 shipped its code, weights and assets on 2026-10-15, the interesting question was not the advertised frame rate but a simpler one: if I follow the docs, will it run? This SOP answers exactly that: install from scratch on a Linux machine with an NVIDIA GPU, pull the resources, render one clip, open one browser demo, and know where you will trip.
Per the division of labor for batch 53, the companion open-source piece covers positioning, architecture, license and ecosystem. This piece covers install, run and verify only, and does not repeat the project background; nor does it cover realtime voice API integration.
Every command and flag below is taken verbatim from the v4 subdirectory README, from the SkyworkAI/Matrix-Game repository at Matrix-Game-4/README.md.
Repository address: github.com/SkyworkAI/Matrix-Game
The nine steps below are the shortest path from a bare machine to "I press a key and the picture responds."
1. Align on the machine requirements first
The most common failure is not a typo but an environment assumption that does not hold.
Model inference, the real gate. You need Linux, an NVIDIA GPU and Python 3.12 at once. The reference A100 80 GB deployment uses PyTorch 2.12.0 / CUDA 13.2. The repo also ships a dedicated RTX 5090 runtime that does not auto-detect hardware: you must select the matching preset explicitly, or you fall through to the default path.
Browser demo. The server side must be a Linux host that also builds the game and the GStreamer pipeline. The desktop client targets Safari and Chrome and needs no GPU, so an ordinary laptop can open the page while the compute stays on the server.
Standalone play and recording. Needs macOS or Linux plus CMake, C++20, SDL2 and FFmpeg. The legacy Windows entry is retained but not validated for feature parity, so do not treat Windows as a production path.
Disk. Assets and weights are downloaded separately, not shipped in the repo, and the README warns to allow space for the Hugging Face Hub cache on top of the installed copy, so the same weights occupy disk twice.
2. Install inside the Matrix-Game-4/ directory
From Install onward, every command runs inside the Matrix-Game-4/ subdirectory, not the repository root. The root is a series repo and v4 is one subdirectory; enter the wrong one and everything after is wrong.
git clone https://github.com/SkyworkAI/Matrix-Game.git
cd Matrix-Game/Matrix-Game-4
python3.12 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install torch==2.12.0 torchvision==0.27.0 --index-url https://download.pytorch.org/whl/cu132
python -m pip install -e '.[inference,server,download,test]'Three things matter. The venv keeps the environment inside the project, and Python 3.12 is a hard requirement. The torch/torchvision pair comes from the official CUDA 13.2 wheel index and must stay paired. And -e '.[inference,server,download,test]' installs four extras; skip one and the matrix-game subcommands may fail with a missing module. The README adds that the optimized path needs version-matched PyTorch/Triton and a compatible driver, that FlashAttention is optional, and that only rtx5090-sage needs SageAttention. Dependency details live in docs/installation.md.
3. Download the resources: weights and assets come separately
Weights, the fast codec, sink images and game assets live on Hugging Face; the repo holds only manifests. The expected layout is:
resources/
base/ # Shared umT5, tokenizer, Wan VAE, TAEHV
models/castle/ # model.safetensors, sink.png
models/ancient-egypt/ # model.safetensors, sink.png
models/racing/ # model.safetensors, sink.png
game/assets/ # Shooter assets and per-scene maps
racing/assets/ # City map, captions, routes and vehicle audioGame assets and model weights are two different manifests. Here is the README command, with the pinned repo id and revision:
matrix-game download --manifest releases/game-assets.json \
--repo-id Skywork/Matrix-Game-4.0 --repo-type model \
--revision 4419accdb7bb7881234c5914de8cd915266e0325 \
--scene ancient-egypt --resources resources
matrix-game download --manifest releases/models.json \
--repo-id Skywork/Matrix-Game-4.0 --repo-type model \
--revision 4419accdb7bb7881234c5914de8cd915266e0325 \
--scene ancient-egypt --resources resourcesReplace ancient-egypt with castle, racing or all to switch scenes; one server process supports only one scene model, so on-demand downloads save disk. The downloader verifies sizes and SHA256 against the pinned manifests, so an interrupted run can simply be restarted. The shared T5/tokenizer and Wan VAE are pulled automatically from a pinned official base-model revision, not duplicated here. To recheck an installed scene, use matrix-game verify with the same --manifest, --scene and --resources flags.
4. Offline rendering: confirm the model produces output
Once installation and downloads are done, do not rush to the browser. An offline render is the minimal validation because it decouples "can the model infer" from "network transport and browser decoding." The README suggests the fast path first: TAEHV encoding/decoding, one denoising step, a fixed scene prompt and the accelerated DiT runtime, selected with --preset realtime on A100.
matrix-game render --scene ancient-egypt --input lowpoly.mp4 \
--resources resources --preset realtime --prompt-mode fixed \
--output outputs/egyptThe input is a low-poly proxy stream, not real footage: the game engine owns world state, physics and input and emits a clean low-poly RGB stream. The output is rendered.mp4 plus a configuration report, and FPS and frame count are preserved; only the final incomplete four-frame block is padded internally, then trimmed. The three presets differ: realtime (TAEHV, one-step denoising, ring/fused DiT, CUDA graph replay) is for A100, RTX 5090 switches to rtx5090, and quality (Wan VAE, two denoising steps 1000,500, native DiT) is slower and is the default when --preset is omitted. That last point is the trap: omitting the preset silently selects the slowest configuration.
5. Play and record locally without loading a model
This step loads no model weights and needs no Python-side model dependencies, so use it to confirm the game, controls and recording pipeline before you touch the model.
bash scripts/build_game.sh
bash scripts/play.sh --scene ancient-egyptFor the two shooter scenes (Castle and Ancient Egypt), play.sh starts a 48 FPS / 2x simulation-time local demo mode, with no neural rendering and no simulated network delay. F9 toggles recording and Escape opens the menu. Use --scene castle for the other map, and set MATRIX_GAME_DATA_DIR to override the default resources/game. Racing is separate: bash scripts/build_racing.sh, then follow docs/racing.md; racing's 48 FPS recording mode uses normal 1x simulation time, unlike the shooters' 2x, and the browser demo also does not enable the shooters' local 2x mode, advancing simulation by 1 / --fps seconds per captured frame. A coding agent can also edit terrain, object placement, NPC behavior and game rules and re-test locally without loading model weights.
6. Browser demo: server and client are separate
The browser demo is a single-user WebRTC setup. Build the native game and install the media dependencies first, then open two terminals: one for MediaMTX, one for the model service.
mediamtx configs/mediamtx.ymlCUDA_VISIBLE_DEVICES=0 bash scripts/serve.sh \
--scene ancient-egypt --resources resources --preset realtime --fps 40Then open http://127.0.0.1:8025/ on the server, or forward the required ports over SSH as described in docs/online.md. On RTX 5090, replace --preset realtime with --preset rtx5090. To test controls, HUD, audio and transport without loading a model, add --reference-only, a handy switch for telling "is the model slow or is the network slow" apart. The README stresses that --fps 40 is a target capture cadence, not a throughput or latency guarantee: encoding, transport, buffering and browser decoding all add latency beyond model inference.
7. RTX 5090: two presets and optional SageAttention
After the standard installation and downloads, 5090 users start from --preset rtx5090. It reuses the same scene checkpoints and shared resources and needs no separate quantized checkpoint: the DiT block linear weights are converted to FP8 at load time with activations quantized during inference, while embeddings and the output head remain BF16.
Both 5090 presets select TAEHV, one-step denoising, fused kernels and CUDA graphs; they differ only in the self-attention backend:
| Preset | Self-attention | Additional setup |
|---|---|---|
rtx5090 | PyTorch SDPA | None beyond the standard installation |
rtx5090-sage | SageAttention for the full history window, SDPA while it fills | Patched build, below |
To use rtx5090-sage, build SageAttention 2.2.0 with the supplied CUDA-graph patch and CUDA 13.2, from Matrix-Game-4/ in the same Python environment as the model:
python -m pip install "nvidia-cuda-nvcc==13.2.*" "nvidia-nvvm==13.2.*" "nvidia-cuda-crt==13.2.*" "nvidia-cuda-cccl==13.2.*" setuptools wheel ninja
export CUDA_HOME="$(python -c 'import nvidia, os; print(os.path.join(nvidia.__path__[0], "cu13"))')"
mkdir -p ../cuda-link && ln -sf "$CUDA_HOME/lib/libcudart.so.13" ../cuda-link/libcudart.so
git clone https://github.com/thu-ml/SageAttention.git ../SageAttention
git -C ../SageAttention checkout eb615cf6cf4d221338033340ee2de1c37fbdba4a
git -C ../SageAttention apply "$PWD/matrix_game/inference/rtx5090_sage/sageattention.patch"
LIBRARY_PATH="$PWD/../cuda-link" MAX_JOBS=4 EXT_PARALLEL=2 python -m pip install --no-build-isolation ../SageAttentionThen replace --preset rtx5090 with --preset rtx5090-sage in either command above. No SageAttention build is needed for plain rtx5090. One note: the runtime warms up kernels and captures CUDA graphs before accepting a real session, so the first launch takes longer than steady-state rendering. Do not assume it has hung. A version for RTX 5080 and RTX 5070 is expected next week.
8. Acceptance criteria: what counts as "it works"
Two checkpoints. The browser demo path: you press a key and the picture responds, with an official end-to-end latency of about <150 ms, not independently reproduced. The offline render path: a low-poly video in, a finer rendered.mp4 out, with no network or browser involved and the cleanest acceptance test.
Three sets of figures must be written side by side; do not cherry-pick the best one.
- Official release figures: one RTX 5090, 480p at 60 FPS, <150 ms end-to-end latency, 83 FPS steady single-step denoising and 18.5 GiB peak VRAM. Not independently reproduced.
- The project page panel is currently a placeholder: 0 FPS / 0 ms / 0p / 0 GPU ("content will be updated at release").
- The repository README's self-measured figures (the hardest source): one A100-SXM4-80GB at 864 x 480, one denoising step plus TAEHV plus SDPA plus ring/fused DiT plus CUDA graphs, excluding startup and warmup: about 38-39 FPS for the fixed-prompt shooters, about 38.5 for racing fixed and 28.9 for racing dynamic.
The README notes those numbers are neither browser presentation FPS nor action-to-photon latency, and that the racing figures come from an earlier checkpoint with the same architecture. As with --fps 40, these are different quantities: model-processing throughput, pipeline throughput, presentation frame rate and end-to-end latency.
9. Six pitfalls to know in advance
- One process supports only one active session and one scene model. Do not expect castle and racing in one server process, or multi-user concurrency.
- It binds to loopback by default; do not expose it to the internet ("trusted single-user demo, not an authenticated public cloud-gaming service").
--fps 40is capture cadence, not a throughput or latency guarantee; encoding, transport, buffering and browser decoding all add latency.- The Windows entry is unvalidated and officially retained without feature-parity validation.
- Budget disk space, including the Hub cache; weights and assets download separately and the installed copy and cache add up.
- Two VRAM tiers: A100 80 GB for the reference route, RTX 5090 for the consumer route (5080/5070 pending).
Related reading
- LingBot-World 2.0 Local Small Model Deployment SOP
- Wan3.0 Hands-On SOP: The Full Pipeline from PPT to a 30-Second Finished Video
- Half the VRAM, Nothing Runs: Five Ways Out
FAQ
Q1: I do not have an A100. Can a consumer GPU run this?
A: Yes, via the RTX 5090 route: after the standard installation, use --preset rtx5090 (PyTorch SDPA, no extra build). The README also mentions a rtx5090-sage variant requiring a SageAttention 2.2.0 build, and RTX 5080 and 5070 support is expected next week. For earlier cards, the README gives no support statement.
Q2: What is the difference between --preset realtime and --preset quality?
A: realtime uses TAEHV, one-step denoising, ring/fused DiT and CUDA graphs and is the fast path on A100; quality uses Wan VAE, two denoising steps (1000,500) and native DiT and is slower. The key point: when --preset is omitted the default is quality, so "I did not write a preset" means the slowest option, not the fastest.
Q3: Why does play.sh work while the browser demo will not open?
A: The paths differ. play.sh loads no model and needs no Python-side dependencies. The browser demo additionally needs MediaMTX running, GStreamer and the media dependencies, and the server must be the same Linux host. Start with --reference-only to test controls, HUD, audio and transport without loading a model.
Q4: The project page says 60 FPS while the README says 38 FPS. Which do I trust? A: Write both and label both. The 60 FPS / <150 ms / 83 FPS / 18.5 GiB set is the official release figure, not independently reproduced; the 38-39 FPS set is the README's self-measurement on an A100-SXM4-80GB at 864 x 480, excluding startup and warmup. Do not treat either as browser presentation FPS.
Q5: Can I port-forward this to the internet for friends to play?
A: Not advisable. The README calls this a "trusted single-user demo," HTTP, RTSP and WebRTC bind to loopback by default, and there is no authentication. For remote use, forward the required ports over SSH (see docs/online.md).
Closing Thoughts
To recap: requirements (Linux + NVIDIA GPU + Python 3.12), installation inside Matrix-Game-4/, downloading weights and assets, an offline render, local play and recording, the browser demo, the 5090 presets, acceptance, and pitfall avoidance. The usual failure is never the command itself but three "default traps": commands must run in the subdirectory, omitting --preset selects the slowest tier, and --fps 40 is not a latency promise. Remember those three and the rest is mostly waiting for downloads and warmup. For everything else, read the companion open-source piece in this batch; the value of an SOP is saving the next person one evening.