Skip to main content

Python library to read, write, and analyse id Software WAD files

Project description

wadlib

CI

Python 3.12+ library and CLI toolkit for reading, writing, and analysing id Software WAD files — Doom, Doom II, Heretic, Hexen, Strife, and source-port mods (ZDoom, GZDoom, PK3, UDMF).

Full documentation →


Installation

pip install wadlib

For FUSE filesystem mounting:

pip install "wadlib[fuse]"

For development:

git clone https://github.com/rembish/wadlib
cd wadlib
make install   # creates .venv, installs with dev + release deps

Quick start

from wadlib import WadFile

# Open a single WAD
with WadFile("DOOM2.WAD") as wad:
    print(wad.wad_type)        # WadType.IWAD
    print(len(wad.maps))       # 32
    print(wad.maps[0])         # MAP01

# Layer a PWAD on top — PWAD lumps shadow base-WAD lumps by name
with WadFile.open("DOOM2.WAD", "SIGIL_II.WAD") as wad:
    for m in wad.maps:
        print(m, "—", len(m.things), "things")
from wadlib import WadArchive

# Read
with WadArchive("DOOM2.WAD") as wad:
    print(wad.namelist())
    data = wad.read("PLAYPAL")

# Append — modify in place (last-wins semantics match Doom engine)
with WadArchive("mod.wad", "a") as wad:
    wad.replace("PLAYPAL", new_palette)
    wad.writestr("NEWLUMP", data)

# Write — create from scratch with namespace markers
with WadArchive("patch.wad", "w") as wad:
    wad.writemarker("F_START")
    wad.writestr("MYFLOOR", flat_bytes)
    wad.writemarker("F_END")
# CLI
wadcli --wad DOOM2.WAD info
wadcli --wad DOOM2.WAD list maps
wadcli --wad DOOM2.WAD export map MAP01 map01.png
wadcli --wad DOOM2.WAD export sound DSPISTOL pistol.wav
wadcli --wad DOOM2.WAD check

For the full API, CLI reference, and how-to guides see the documentation site.


Stability and coverage

Area Status Notes
Classic WAD reading Stable All binary lumps: maps, textures, flats, sprites, sounds, music, palettes
WAD writing / round-trip Stable WadWriter, WadArchive; all binary types support to_bytes()
Map inspection Stable Vanilla + Hexen map lumps; UDMF full read/write; ZNODES compressed BSP
Textures / compositing Stable TEXTURE1/2, PNAMES, ZDoom TEXTURES text format; TextureCompositor
Audio Stable DMX, MUS → MIDI, OGG/MP3/MIDI detection; WAV ↔ DMX, MIDI ↔ MUS
CLI (wadcli) Stable Export, diff, check, list, render, complevel, convert
PK3 / ZIP support Beta Read, write, WAD↔PK3; PK3-embedded WAD maps
FUSE mount (wadmount) Beta Virtual WAD filesystem; OS/libfuse dependent
UDMF maps Beta Full parse/serialize; namespace-specific validation started
ZMAPINFO Beta Maps, episodes, clusters, defaultmap; round-trip serialiser
DECORATE Beta Actors, flags, inheritance, #include, replaces; no ZScript
ANIMDEFS Beta Parse; AnimDef.resolve_frames() maps numeric pic indices to lump names
Compatibility analysis Beta detect_complevel, check_downgrade, convert_complevel
LANGUAGE / SNDINFO / SNDSEQ Beta Parsed for metadata; no engine-runtime semantics
ZScript / ACS execution Not supported Out of scope

Supported games

Game IWAD Notes
Doom / Ultimate Doom DOOM.WAD E1M1–E4M9
Doom II DOOM2.WAD MAP01–MAP32
Heretic HERETIC.WAD FONTA/FONTB, Heretic thing catalog
Hexen HEXEN.WAD Hexen map format, SNDSEQ, MAPINFO, ANIMDEFS
Strife STRIFE1.WAD All 262 thing types; DIALOGUE/SCRIPTxx conversations
Source-port PWADs .wad / .pk3 ZMAPINFO, ANIMDEFS, DEHACKED custom things

Examples

The examples/ directory contains runnable scripts for common workflows:

File Description
01_inspect_wad.py Map list, asset counts, source-port lumps detected
02_extract_assets.py Export sprites, flats, and wall textures as PNG
03_build_pwad.py Build a minimal PWAD from scratch and round-trip validate
04_pwad_stack.py Load an IWAD + PWADs via ResourceResolver, collision report
05_audio_conversion.py Extract DMX → WAV, MUS → MIDI; import back
06_texture_audit.py Find unused textures/flats, per-map breakdown
07_diagnostics.py Structured analyze() report; compatibility downgrade check
08_zdoom_mod_info.py ZMAPINFO, DECORATE actors, LANGUAGE strings
09_wad_diff.py What a PWAD changes vs. the base — added, removed, changed lumps
10_render_maps.py Render overhead map views as PNG with floor textures

Requirements

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wadlib-0.4.5.tar.gz (291.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wadlib-0.4.5-py3-none-any.whl (214.4 kB view details)

Uploaded Python 3

File details

Details for the file wadlib-0.4.5.tar.gz.

File metadata

  • Download URL: wadlib-0.4.5.tar.gz
  • Upload date:
  • Size: 291.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for wadlib-0.4.5.tar.gz
Algorithm Hash digest
SHA256 e5697b5e63699ff26ecf9d70b3a17998e80583a23d05ec9b7599a42fa89980f3
MD5 4d9ae864707b1c51e29137ed8819299e
BLAKE2b-256 57ea6e52df94258f7587b1101f2b29c9f302885c796227387c079e003e951889

See more details on using hashes here.

File details

Details for the file wadlib-0.4.5-py3-none-any.whl.

File metadata

  • Download URL: wadlib-0.4.5-py3-none-any.whl
  • Upload date:
  • Size: 214.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for wadlib-0.4.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ef94ed0a88d7e6b47f15fb004c7df4916d26d9bccce56fab3649d796d3566c31
MD5 4f138fcb147748d9c18249a2100d88fc
BLAKE2b-256 84a5125c859960c85154c171fa87c3ebcd5c9fb2353fa6c8e17aa0ea2b78c5d1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page