deviant-syndrome / udmfio

Python UDMF Map Parser and Writer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UDMFIO UDMF Map Parser and Writer

Overview

This project provides utilities to parse and generate Universal Doom Map Format (UDMF) maps. UDMF is a human-readable representation of map data, widely recognized in modern DOOM mapping. The parsing of UDMF file is done using PLY parser, build according to the official UDMF specification. The binding of parsed data to Python classes is done for specification-standardised fields and ZDoom extensions.

Features

  • Parsing UDMF Maps: Quickly turn UDMF-formatted text into a structured representation using the parse_udmf function.

  • Writing UDMF Maps: Convert structured map data back into the UDMF text format for use in map editors or game engines.

  • Customizable bindings: The parser and writer are built in a way that lets you easily adapt or extend them for specific needs.

Usage

Parsing

from udmf_parser import parse_udmf

parsed_data = parse_udmf("TEXTMAP.lmp")
print(parsed_data)

Writing to file

from udmf_writer import write_udmf_map

write_udmf_map(parsed_data, "path_to_output_file.txt")

Customizing

The core functionality is built using classes and mixins, allowing for easy customization or extension. For instance, the UDMFMixin class provides a convenient way to convert any object to its UDMF string representation. Check out classes like UDMFLinedef, UDMFSidedef, etc., to see how this can be applied to specific DOOM map structures.

Testing

Extensive unit tests are provided to ensure the correct behavior of both the parser and the writer. To run the test

python -m unittest discover -s tests

License

0BSD

About

Python UDMF Map Parser and Writer

License:BSD Zero Clause License


Languages

Language:Python 97.6%Language:Shell 2.4%