MaLiang-Data / README.md
15y6u87's picture
Point links to YeyingLab after the repo transfer
9a01f8b verified
|
Raw History Blame Contribute Delete
11.9 kB
---
pretty_name: MaLiang Data
license: other
license_name: research-only
task_categories:
- image-to-video
size_categories:
- 1M<n<10M
tags:
- world-model
- video-generation
- action-conditioned
- semantic-map
- unreal-engine
- game
- webdataset
configs:
- config_name: preview
default: true
data_files:
- split: train
path: "preview/preview.parquet"
---
<div align="center">
# MaLiang: Painting Playable Game Worlds from Numbers
**The raw game recordings used to train MaLiang: 256 runs, 1.23 M labelled frames, 21.3 h**
[Zhiyang Deng](https://teawhite.cn/)<sup>1,2,\*</sup>, [Shushan Xu](https://github.com/sylvana20)<sup>1,3,\*</sup>, [Yeying Jin](https://github.com/jinyeying)<sup>1,2,♢</sup>
<sup>1</sup>Tencent, <sup>2</sup>National University of Singapore, <sup>3</sup>Nanyang Technological University
<sup>\*</sup>Equal contribution · <sup>♢</sup>Corresponding author and project leader
[**Project page**](https://sylvana20.github.io/maliang/) · [**Code**](https://github.com/YeyingLab/MaLiang) · [**Model**](https://huggingface.co/YeyingLab/MaLiang)
</div>
![MaLiang teaser](https://huggingface.co/datasets/YeyingLab/MaLiang-Data/resolve/main/assets/teaser.jpg)
MaLiang renders a playable game world directly from the game state: the game hands a video model one integer per pixel, and the model paints the world in real time. This repository holds the paired recordings the model is trained on. A bot plays boss fights in ten Unreal Engine scenes; every frame stores the rendered RGB, a pixel-aligned integer class map, a white-box render, a condition image, the player's action and per-frame camera and character metadata. The code repository turns them into the training cache (`code/gc25d/prep_v10.py`).
![Ten scenes, two looks](https://huggingface.co/datasets/YeyingLab/MaLiang-Data/resolve/main/assets/scenes.jpg)
## Quick look in the browser
The **Dataset Viewer** above shows the `preview` config: 100 frames (10 scenes × 2 subsets × 5 frames), each with the rendered frame, the integer map (coloured), the condition image, the white-box render and the keys held. No download needed.
## Subsets
| Subset | What it is | Runs | Frames | Game time | 81-frame clips | Size |
|---|---|---|---|---|---|---|
| `v10_real` | photoreal outdoor biomes, perspective telephoto camera | 116 | 556,800 | 9.67 h | 5,800 | 244 GB |
| `v9_stylized` | the ten scenes with a random rendering style per camera view (sketch, comic, pixel, toon and more) | 140 | 672,000 | 11.67 h | 7,000 | 239 GB |
| **total** | | **256** | **1,228,800** | **21.33 h** | **12,800** | **482 GB** |
Frames are 1280×704 at 16 fps of game time, stored as WebDataset tar shards of 1,600 frames (`data/<subset>/<scene>/<run>/frames-*.tar`) with per-run index files. `summary_v10.csv` lists every run, and `previews/` shows two clips of one run per scene. For MaLiang the recordings are cut into 11,955 training clips (1,893 with boss attack effects added) and 100 held-out test clips.
## Scenes
Every scene is recorded in both subsets; each run is one folder of three tar shards (about 2.4 GB) plus its index files.
| Case | Scene | Folder | Photoreal runs | Size | Stylised runs | Size |
|---|---|---|---|---|---|---|
| 01 | Sunlit Mediterranean Courtyard | `01_Sunlit_Mediterranean_Courtyard` | 12 | 28.2 GB | 15 | 28.1 GB |
| 02 | Autumn Woodland Shrine | `02_Autumn_Woodland_Shrine` | 12 | 27.1 GB | 15 | 40.1 GB |
| 03 | Desert Caravanserai | `03_Desert_Caravanserai` | 12 | 26.4 GB | 14 | 20.5 GB |
| 04 | Snowbound Mountain Outpost | `04_Snowbound_Mountain_Outpost` | 12 | 27.9 GB | 14 | 21.5 GB |
| 05 | Japanese Spring Sanctuary | `05_Japanese_Spring_Sanctuary` | 12 | 28.3 GB | 14 | 33.2 GB |
| 06 | Overgrown Tropical Water Temple | `06_Overgrown_Tropical_Water_Temple` | 12 | 27.3 GB | 14 | 28.2 GB |
| 07 | Steampunk Foundry District | `07_Steampunk_Foundry_District` | 11 | 24.9 GB | 14 | 22.0 GB |
| 08 | Gothic Cathedral Quarter | `08_Gothic_Cathedral_Quarter` | 11 | 25.4 GB | 14 | 22.1 GB |
| 09 | Dense Cyberpunk Neon District | `09_Dense_Cyberpunk_Neon_District` | 11 | 22.2 GB | 14 | 21.4 GB |
| 10 | Underwater Research Habitat | `10_Underwater_Research_Habitat` | 11 | 23.9 GB | 12 | 18.6 GB |
## Download
```bash
pip install -U huggingface_hub
# try it: one tar shard, 1,600 frames (about 0.9 GB)
hf download YeyingLab/MaLiang-Data data/v10_real/05_Japanese_Spring_Sanctuary/R10_s5501/frames-000000.tar --repo-type dataset --local-dir MaLiang-Data
# one run with its index files (about 2.4 GB)
hf download YeyingLab/MaLiang-Data --repo-type dataset --include "data/v10_real/05_Japanese_Spring_Sanctuary/R10_s5501/*" --local-dir MaLiang-Data
# one scene in both subsets (about 40–60 GB, see the table above)
hf download YeyingLab/MaLiang-Data --repo-type dataset --include "data/*/05_Japanese_Spring_Sanctuary/*" --local-dir MaLiang-Data
# one subset (about 240 GB)
hf download YeyingLab/MaLiang-Data --repo-type dataset --include "data/v10_real/*" --local-dir MaLiang-Data
# everything (about 482 GB)
hf download YeyingLab/MaLiang-Data --repo-type dataset --local-dir MaLiang-Data
```
No login is needed. Downloads resume if interrupted; add `--max-workers 16` for faster transfers.
## Getting started
1. **Look** at a few frames in the Dataset Viewer above.
2. **Download** one run (about 2.4 GB) with the command above.
3. **Read a clip**: the snippet in [Loading a clip](#loading-a-clip) returns the 81 RGB frames, integer maps, condition images and keys of one clip.
4. **Train**: download what you need and follow *Data* in the [code README](https://github.com/YeyingLab/MaLiang#-data) to build the training cache; the [model card](https://huggingface.co/YeyingLab/MaLiang) has the released checkpoints.
A Chinese guide is in [README.zh-CN.md](README.zh-CN.md)(中文说明).
## What each run contains
### Per-frame contents
Each frame is one WebDataset sample inside a tar shard; the key is the 6-digit frame index within its run.
| File in tar | Content |
|---|---|
| `{frame}.jpg` | RGB, 1280×704, JPEG (rendered at 2× and downsampled) |
| `{frame}.ids.png` | Semantic id map, single-channel uint8, lossless, pixel-aligned with the RGB; player / boss as capsules |
| `{frame}.whitebox.jpg` | Whitebox render: structural scene geometry plus the articulated character capsules |
| `{frame}.cond.png` | Condition image: semantic palette for the scene classes + player (blue) / boss (red) capsules shaded from the capsule segments |
| `{frame}.json` | Per-frame metadata: camera pose, `world_to_view`, `projection`, `world_to_clip`, `fov_x_deg` / `ortho_width_cm`, actors (role, state, health, position, velocity, bones with pixel positions), `action`, `episode`, `camera_variant`, look and character capsules |
### Semantic classes
| id | class | id | class | id | class |
|---|---|---|---|---|---|
| 0 | sky / background | 3 | architecture | 6 | prop |
| 1 | terrain (incl. grass, debris) | 4 | rock | 10 | player |
| 2 | paving (roads, floors) | 5 | vegetation (plants, trees, logs) | 11 | boss |
### Index files per run
```
data/<subset>/<scene>/<run>/frames-000000.tar frames 0–1599 (WebDataset shard)
data/<subset>/<scene>/<run>/frames-001600.tar frames 1600–3199
data/<subset>/<scene>/<run>/frames-003200.tar frames 3200–4799
data/<subset>/<scene>/<run>/index/
actions.npy (N,5) uint8 [w,a,s,d,attack]; row i = keys held from frame i to i+1
actions_block_0.25s.npy (N/4,5) one action prompt per 0.25 s (keys never change inside a block)
episodes.npy (N,) episode id
actions.csv per-frame actions, bot mode, player / boss state and HP, character model and scale
frames.jsonl compact per-frame metadata
clips_81.json the 50 cut-grid clips: start, end (exclusive), episode, camera_variant, look, look_name, events
clips_81_v9.json the capture's clip list (end inclusive)
events.json dynamic events of the run (v9_stylized only)
meta.json run statistics (looks, behaviour, characters, biome variants)
capture_result.json capture settings and the per-look log
scene_actors.json static-mesh inventory of the host scene
summary_v10.csv / summary_v10.json every run and the totals of both subsets
previews/ code/ preview reels (RGB | condition), capture and post-processing code
```
## Loading a clip
```python
import io, json, tarfile
import numpy as np
from PIL import Image
from huggingface_hub import hf_hub_download
REPO = "YeyingLab/MaLiang-Data"
subset, scene, run = "v10_real", "05_Japanese_Spring_Sanctuary", "R10_s5501"
get = lambda p: hf_hub_download(REPO, f"data/{subset}/{scene}/{run}/{p}", repo_type="dataset")
clips = json.load(open(get("index/clips_81.json")))
blocks = np.load(get("index/actions_block_0.25s.npy"))
c = clips[10]; s, e = c["start"], c["end"] # 81 frames, one look (c["look_name"])
def frames(lo, hi): # frames [lo, hi) from the 1,600-frame shards
out = {}
for shard in range(lo // 1600 * 1600, hi, 1600):
with tarfile.open(get(f"frames-{shard:06d}.tar")) as tf:
for m in tf:
key, ext = m.name.split(".", 1)
if lo <= int(key) < hi: out.setdefault(int(key), {})[ext] = tf.extractfile(m).read()
return [out[i] for i in range(lo, hi)]
clip = frames(s, e)
rgb = np.stack([np.asarray(Image.open(io.BytesIO(f["jpg"]))) for f in clip]) # (81,704,1280,3)
cond = np.stack([np.asarray(Image.open(io.BytesIO(f["cond.png"]))) for f in clip]) # condition images
ids = np.stack([np.asarray(Image.open(io.BytesIO(f["ids.png"]))) for f in clip]) # (81,704,1280) uint8 class ids
act = blocks[s // 4 : s // 4 + 20] # (20,5) one prompt per 0.25 s
```
## Notes
- **Capture.** Unreal Engine 5.8, the ten GameCrafter scenes, fixed-timestep simulation at 48 Hz with every third step saved (16 fps of game time). A bot plays through the player's own input path (W A S D + attack): it explores, seeks and fights the boss, dies and respawns as a new episode.
- **Clean clips.** Looks, cameras and episodes change only between clips, so no 81-frame clip contains a style, camera or episode switch (`clips_81.json`). Use the clip list rather than slicing runs freely.
- **Characters in the labels.** The player (class 10) and the boss (class 11), with their weapons, are drawn as articulated capsules; the capsule segments are stored per frame, so the condition can be redrawn by code without Unreal.
- **Labels follow the plain scene.** In the stylised subset styles, outlines and material swaps exist only in the RGB; the photoreal subset replaces set dressing and materials but keeps each scene's walkable ground and routes.
## License and third-party content
Research use only. The recordings combine content under different terms, and this release does not relicense any third-party content:
- **Unreal Engine** and the UE template content in the capture projects are Epic Games content, used under the Unreal Engine EULA.
- **Scenes** are the [GameCrafter](https://huggingface.co/datasets/teawhite/GameCrafter) worlds; their generated meshes and images follow their providers' terms.
- **Player and boss character models** follow the terms of their sources.
- **Photoreal biomes** (`v10_real`) re-scatter CC0 photo-scanned assets and materials from Poly Haven.
If you are a rights holder and want something removed, please open a discussion on this repository.
## Citation
```bibtex
@misc{maliang2026,
title = {MaLiang: Painting Playable Game Worlds from Numbers},
author = {Deng, Zhiyang and Xu, Shushan and Jin, Yeying},
year = {2026},
url = {https://github.com/YeyingLab/MaLiang}
}
```