Expand description
Parser for World of Warcraft WDL (World Detail Level) files.
This crate provides support for reading and writing WDL files used in World of Warcraft. WDL files store low-resolution versions of terrain used for distant terrain rendering and the world map interface.
§Overview
WDL files contain low-resolution heightmap data for entire continents, providing:
- 17x17 heightmap points per map tile (ADT)
- Hole information for terrain gaps
- Optional low-resolution world object placements
- Support for efficient distant terrain rendering
- Data for world map and minimap generation
§File Structure
WDL files use a chunk-based format similar to other WoW files:
- MVER: Version information (always first)
- MAOF: Map Area Offset table (64x64 grid of file offsets)
- MARE: Map Area heightmap data (17x17 outer + 16x16 inner heights)
- MAHO: Map Area hole data (16 uint16 bitmasks)
- MWMO/MWID/MODF: WMO placement data (pre-Legion)
- ML**: Model placement chunks (Legion+)
§Examples
use std::fs::File;
use std::io::BufReader;
use wow_wdl::parser::WdlParser;
// Open a WDL file
let file = File::open("path/to/file.wdl").unwrap();
let mut reader = BufReader::new(file);
// Parse the file
let parser = WdlParser::new();
let wdl_file = parser.parse(&mut reader).unwrap();
// Use the data
println!("WDL version: {}", wdl_file.version);
println!("Map tiles: {}", wdl_file.heightmap_tiles.len());
// Get heightmap for a specific tile
if let Some(tile) = wdl_file.heightmap_tiles.get(&(32, 32)) {
println!("Tile 32,32 has {} height values", tile.outer_values.len());
}§Version Conversion
use wow_wdl::parser::WdlParser;
use wow_wdl::version::WdlVersion;
use wow_wdl::conversion::convert_wdl_file;
use std::fs::File;
use std::io::{BufReader, BufWriter};
// Parse an existing file
let file = File::open("input.wdl").unwrap();
let mut reader = BufReader::new(file);
let parser = WdlParser::new();
let wdl_file = parser.parse(&mut reader).unwrap();
// Convert to Legion version
let legion_file = convert_wdl_file(&wdl_file, WdlVersion::Legion).unwrap();
// Save the converted file
let output = File::create("output.wdl").unwrap();
let mut writer = BufWriter::new(output);
let legion_parser = WdlParser::with_version(WdlVersion::Legion);
legion_parser.write(&mut writer, &legion_file).unwrap();See the examples directory for more detailed usage examples.
§wow-wdl
Parser for World of Warcraft WDL (World Detail Level) files - low-resolution terrain data for continents.
§Status
✅ Production Ready - Complete WDL parser with support for all WoW versions
§Overview
WDL files contain low-resolution heightmap data for entire WoW continents. They provide:
- Low-resolution terrain heights - 17x17 height points per ADT tile
- Terrain hole information - Which chunks have holes/gaps
- World object placements - Low-detail WMO positions (pre-Legion)
- Model placements - M2 and WMO positions (Legion+)
These files enable:
- Efficient rendering of distant terrain
- World map and minimap generation
- Level-of-detail (LoD) terrain switching
- Memory optimization by using low-detail data for distant areas
§Features
- ✅ Parse all WDL chunk types (MVER, MAOF, MARE, MAHO, etc.)
- ✅ Support for all WoW versions (Classic through Legion+)
- ✅ Height data extraction and interpolation
- ✅ Hole detection and manipulation
- ✅ World object placement data
- ✅ Version conversion between formats
- ✅ Validation and error handling
§Installation
Add to your Cargo.toml:
[dependencies]
wow-wdl = "0.3.0"Or use cargo add:
cargo add wow-wdl§Quick Start
use wow_wdl::parser::WdlParser;
use std::fs::File;
use std::io::BufReader;
// Load a WDL file
let file = File::open("World/Maps/Azeroth/Azeroth.wdl")?;
let mut reader = BufReader::new(file);
// Parse the file
let parser = WdlParser::new();
let wdl = parser.parse(&mut reader)?;
// Access heightmap data
if let Some(tile) = wdl.heightmap_tiles.get(&(32, 48)) {
println!("Tile (32,48) has {} height values", tile.outer_values.len());
}
// Check for holes
if let Some(holes) = wdl.holes_data.get(&(32, 48)) {
if holes.has_hole(8, 8) {
println!("Chunk (8,8) has a hole!");
}
}§File Format
WDL files use a chunk-based structure:
| Chunk | Description | Required |
|---|---|---|
| MVER | Version number | ✅ |
| MAOF | Map area offset table (64x64 grid) | ✅ |
| MARE | Map area heightmap data (545 heights per tile) | ✅ |
| MAHO | Map area hole bitmasks | ❌ |
| MWMO | WMO filename list | ❌ |
| MWID | WMO filename offsets | ❌ |
| MODF | WMO placement data | ❌ |
| ML* | Legion+ model chunks | ❌ |
§Supported Versions
- ✅ Classic (1.12.1) - Version 18
- ✅ The Burning Crusade (2.4.3) - Version 18
- ✅ Wrath of the Lich King (3.3.5a) - Version 18
- ✅ Cataclysm (4.3.4) - Version 18
- ✅ Mists of Pandaria (5.4.8) - Version 18
- ✅ Legion+ (7.0+) - Version 18 with ML** chunks
§Examples
§Height Interpolation
Height interpolation features are planned for future implementation:
These features will be available in a future version:
let height = wdl.get_height_at(1234.5, 5678.9)?;
let (dx, dy) = wdl.get_height_gradient(1234.5, 5678.9)?;§Hole Manipulation
// Check if a specific chunk has a hole
let has_hole = wdl.holes_data
.get(&(tile_x, tile_y))
.map(|h| h.has_hole(chunk_x, chunk_y))
.unwrap_or(false);
// Modify hole data
if let Some(holes) = wdl.holes_data.get_mut(&(32, 48)) {
holes.set_hole(8, 8, true); // Create a hole
holes.set_hole(9, 9, false); // Remove a hole
}§Version Conversion
use wow_wdl::version::WdlVersion;
use wow_wdl::conversion::convert_wdl_file;
use wow_wdl::parser::WdlParser;
use std::fs::File;
use std::io::BufWriter;
// Convert pre-Legion WDL to Legion format
let legion_wdl = convert_wdl_file(&wdl, WdlVersion::Legion)?;
// Save the converted file
let output = File::create("converted.wdl")?;
let mut writer = BufWriter::new(output);
WdlParser::with_version(WdlVersion::Legion)
.write(&mut writer, &legion_wdl)?;§Implementation Status
| Feature | Status | Notes |
|---|---|---|
| MVER parsing | ✅ | All versions supported |
| MAOF parsing | ✅ | 64x64 offset grid |
| MARE parsing | ✅ | 17x17 + 16x16 heights |
| MAHO parsing | ✅ | Hole bitmasks |
| WMO chunks | ✅ | Pre-Legion support |
| ML** chunks | ✅ | Legion+ support |
| Version conversion | ✅ | Between all formats |
| Data validation | ✅ | Comprehensive validation |
| Error handling | ✅ | Robust error types |
| Height interpolation | 🚧 | Planned |
| Coordinate conversion | 🚧 | Planned |
| Minimap generation | 🚧 | Planned |
§License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Re-exports§
pub use error::Result;pub use error::WdlError;pub use types::WdlFile;pub use version::WdlVersion;
Modules§
- conversion
- Version conversion functionality for WDL files
- error
- Error handling for WDL parsing
- parser
- Parser implementation for WDL files
- types
- Core types for the WDL file format
- validation
- Validation functions for WDL files
- version
- Defines version information for WDL files