MaLiang: Painting Playable Game Worlds from Numbers
Project page · Code · Training data
A game hands a video model one integer per pixel, and the model paints the world, live. MaLiang renders a game
world directly from the game state: the state is rasterised into a per-pixel uint8 integer class map
(terrain, buildings, vegetation, the player's and the boss's body parts, attack effects) and added to a
Wan2.2-TI2V-5B video diffusion transformer through a 9.4M-parameter class-pooling encoder. There is no rendered
proxy video and no visual encoder of the state, so game rules edit the map and the model paints the result.
A three-stage distillation (teacher forcing → consistency distillation → DMD) turns the bidirectional teacher
into a causal four-step student that streams at 22 frames per second on one GPU.
| Repository | Content | Size |
|---|---|---|
15y6u87/MaLiang (this repo) |
the five checkpoints of the paper and models.sha256 |
5 × 10 GB |
15y6u87/MaLiang-Data |
the raw game recordings the model is trained on: RGB, integer class map, whitebox, condition image, actions and per-frame metadata; 256 runs, 1,228,800 frames, 21.3 h | 482 GB |
YeyingLab/MaLiang |
training, distillation, inference and evaluation code |
All checkpoints are bf16 safetensors, vocab=parts_fx, 832×480.
| File | Role | Used by |
|---|---|---|
fxcond_v1_stage3_ema_step500.safetensors |
Deployed causal student, 4 steps (stage-3 DMD, EMA, step 500); the real-time model of the paper | gcdistill/eval_rollout.py, sample_user.py |
sft_fxcond_v1_step-10667.safetensors |
Bidirectional teacher, 10,667 SFT steps; the starting point and the DMD teacher of the distillation | sample.py, distillation stages 1 and 3 |
abl_color_vae_step-5000.safetensors |
Interface ablation ①: colour-coded video encoded by the Wan VAE | experiments/abl/ |
abl_color_light_step-5000.safetensors |
Interface ablation ②: colour-coded video through a light encoder of the same cost as ours | experiments/abl/ |
abl_v3_ids_step-5000.safetensors |
Interface ablation ③/④: integer map, step-5000 snapshot of the teacher run (same budget as ① and ②) | experiments/abl/ |
parts_fx)Seven static scene classes (sky/background, terrain, paving, architecture, rock, vegetation, prop), the body
parts of the player and of the boss, four boss attack-effect classes (light and heavy attacks of two bosses), and
255 for unknown. The exact table is in the code (code/gc25d/model.py).
pip install -U huggingface_hub
hf download 15y6u87/MaLiang --local-dir models
cd models && sha256sum -c models.sha256 && cd ..
Install the code as described in the GitHub README, download
Wan-AI/Wan2.2-TI2V-5B into models/Wan2.2-TI2V-5B, then render your own first frame and integer maps with the
real-time student:
python code/gc25d/sample_user.py \
--ckpt models/fxcond_v1_stage3_ema_step500.safetensors \
--first_frame first.png --ids ids.npz --prompts prompts.json \
--out outputs/user_demo --name demo --steps 50
ids.npz holds a uint8 array of shape [81, 480, 832] in the parts_fx vocabulary; --export_clip <clip_id>
exports a prepared clip's first frame, maps and prompts as a template. A long streaming rollout on held-out clips:
python code/gc25d/gcdistill/eval_rollout.py \
--ckpt models/fxcond_v1_stage3_ema_step500.safetensors \
--data_root data/gc25d_v10_fxcond --text_table assets/text_table_gc25d.pt \
--n_clips 10 --chain_cells 241 --vae tae --out outputs/deploy_eval
15y6u87/MaLiang-Data to
data/recordings, then build the training cache with code/gc25d/prep_v10.py (VAE latents, integer maps and
metadata per 81-frame clip; see the code README → Data).Wan-AI/Wan2.2-TI2V-5B.scripts/train_sft.sh, 10,667 steps, global batch 16, lr=1e-5, cond_lr=1e-4
→ sft_fxcond_v1_step-10667.gcdistill/run_stage{1,2,3}.sh: teacher forcing 8,000 steps → consistency distillation
8,000 steps → DMD 500 steps → fxcond_v1_stage3_ema_step500.experiments/.The teacher is trained with DeepSpeed ZeRO-2 on 8 GPUs; distillation stage 3 uses FSDP. Inference runs on one GPU with room for the 5B DiT in bf16. With the TAEHV decoder and a 17-cell KV window the four-step student streams in real time on one GPU.
Apache-2.0, the same as the code. The base model Wan2.2-TI2V-5B and the third-party components used by the code
keep their own licences. The training data has its own card and attribution in
15y6u87/MaLiang-Data.
A BibTeX entry will be added once the paper is public.
sft_fxcond_v1_step-10667.safetensors 10 GBabl_v3_ids_step-5000.safetensors 10 GBfxcond_v1_stage3_ema_step500.safetensors 10 GBabl_color_light_step-5000.safetensors 10 GBabl_color_vae_step-5000.safetensors 10 GBWan-AI/Wan2.2-TI2V-5B