How cff29546/pzmap2dzi works
Major Components
• Command-Line Interface & Entry Points: The main entry points are in files like main.py and the various run*.bat scripts. These load configuration files from the conf directory (especially conf/conf.yaml) and kick off the rendering process.
• Configuration Management: The “conf” directory holds configuration files (mod maps, default settings, versioning) that determine input paths (e.g., for the game data) and output paths.
• Core Rendering Engine: The bulk of the logic resides in the pzmap2dzi package, where modules such as render.py, render_impl (with submodules for base, objects, zombie, etc.), geometry, scheduling, and shared_memory_image define the different aspects of the rendering process. This is where multi-threading and shared memory acceleration are implemented.
• Auxiliary Scripts and Tools: Under scripts/ you see ancillary Python scripts (such as generating example configs, collecting mod map data, tile checks, etc.) that support or extend the core functionality.
• Testing Framework: The test directory contains well-defined test cases and batch scripts to validate the functionality.
• HTML Viewer & Server: The html directory holds the viewer files (pzmap.html, pzmap.js, openseadragon integration) and related batch/server files (server.py, run_server.bat). These work together to display the Deep Zoom output and offer interactive features such as mod map overlays, grid toggling, and layer switching.
Relationships & Data Flow
• Input Flow: The system starts with configuration settings (conf/conf.yaml) and command-line arguments or bat files that define what outputs to generate (different views, overlays, etc.). These settings then trigger the main.py which invokes pzmap2dzi’s modules.
• Core Processing: Within pzmap2dzi, modules communicate to perform tasks – for example, the cell, geometry, and scheduling modules work together to partition the map and schedule rendering tasks across threads. Render modules (render.py and the render_impl package) process the graphical data including details like basements, overlays (zombie heatmap, foraging zones, etc.), and i18n.
• Output Flow: Once rendered, map data is written to the output directory (also configured in conf), which includes the HTML folder that supports interactive map viewing via a local server. The HTML viewer fetches these Deep Zoom tiles through directional paths and server communication (handled by server.py and associated bat files).
• Additional Tools: The mod support (adding mod maps, internationalization) and trimming functionality are extra sub-components interacting with core processing and viewer components.
Architectural Patterns & Principles
• Separation of Concerns: The design keeps configuration, rendering logic, and client viewing separate. The pzmap2dzi library focuses solely on processing while the html component handles the front end.
• Modular Design: The densely organized file tree (with dedicated directories for core logic, configuration, scripts, tests, and HTML) emphasizes a modular design. Each module (for tasks like geometry, scheduling, shared memory, specific modul mapping implementations) encapsulates its functionality.
• Scalability with Multi-threading: The rendering processes are designed to scale with additional threads and shared memory, critical for handling enormous output sizes.
• Extensibility: With separate directories for docs, mod maps, and i18n support, the project naturally supports extensions and customizations.