Inference code for a learned 3D world-state model and a separate RGB renderer. The demo runs locally with pretrained weights and a compact scene bundle. It does not require ViZDoom, a WAD file, a training dataset, or a cloud account.
Use Python 3.10 or newer and a PyTorch build appropriate for your device. Apple GPU execution requires a PyTorch build with MPS Conv3D support.
git clone https://github.com/MajorDavidZhang/PlayGen-2.git
cd PlayGen-2
python -m venv .venv
source .venv/bin/activate
pip install -e '.[fast]'The optional fast extra enables Numba raycasting. Omit it to use NumPy.
Download the pretrained weights from
GitHub Releases
and extract them in the repository root:
curl -fL --retry 3 -o playgen2-weights.zip \
https://github.com/MajorDavidZhang/PlayGen-2/releases/download/v0.1.0/playgen2-weights.zip
unzip -o playgen2-weights.zipModel files belong in weights/, beside the provided manifest and configuration
files. Scene files belong in assets/freedoom2_map01/.
No files are downloaded implicitly at runtime.
python -m playgen2.server --device autoOpen http://127.0.0.1:8090, select a spawn and initialization mode, then Reset and Run. W/S move, A/D turn, Space attacks, and E uses. Arrow keys and touch buttons are also supported. With no key pressed, the model receives noop. Pausing stops world updates; releasing controls does not pause time.
CUDA can use --device cuda --amp bf16. Use FP32 on MPS and CPU.
The renderer uses eight denoising steps by default; --sampling-steps 4
reduces the number of renderer calls. --layout-only runs without RGB weights.
Choose a different --port if 8090 is occupied.
- Global: load and lock the complete static map, including empty voxels. Player and entity updates remain model predictions.
- Local: initialize only the exported neighborhood. Subsequent terrain and entity discovery come from the model, not the full map asset.
Both modes use four-frame local entity/player histories. RGB history starts invalid and is generated autoregressively from projected depth and semantics. No source RGB frames or latent cache are required.
The scene is Freedoom2 MAP01 with six doorways permanently opened in occupancy. No ramps were added. This model treats terrain as static and does not simulate opening or closing doors. The original game engine is not used during rollout.
playgen2.session.Session owns world memory and renderer history. reset
selects a spawn, mode, and seed; advance(action) returns the generated view
and explicit entity/player state. The seven action IDs are defined in
playgen2.session.ACTION_NAMES. Each update represents three 35 Hz game tics.
The server serializes inference and supports one shared single-player session.
Assets use relative paths and SHA256 checksums. Weights are tensor-only
safetensors; scene archives contain only numeric arrays and are loaded
without pickle. Tensor names, architecture settings, and physical normalization
must remain consistent. Do not convert coordinate composition to BF16.
The demo has no telemetry or automatic recording. It binds to loopback by default and is not an authenticated public hosting service.
pip install -e '.[test]'
python -m pytest testsThe project's original code and pretrained model weights are released under
the Apache License 2.0. Third-party code and Freedoom-derived scene
assets retain their respective licenses; see THIRD_PARTY_NOTICES.md
and the licenses/ directory.