Introduction |
From WoWDev
Contents |
The World of World of Warcraft
(sorry)
WoW separates the larger bits of its game content into worlds. Every time a loading screen appears in the game, you are being transferred into a new world. This is how instanced and regular maps are separated as well. Once in a world, there are three fundamental elements to be displayed:
- Terrain
- World map objects - these include caves, buildings, cities and dungeons
- Models - these are trees, rocks and miscellaneous objects
Additionally, there are other (important) cosmetic elements such as sky and water.
A world is broken up into larger sections which I call Map Tiles - up to a 64x64 grid of these can be present in a world. It is also possible for a world to not have map tiles at all - this means that there is no terrain and only a World Map Object (WMO) - this is the case with a lot of instanced dungeons.
A map tile consists of 256 chunks - a 16x16 grid, to be exact. WMOs and models are loaded on a per-tile basis. The division into chunks is a good thing because it provides easily identifiable larger blocks that can be hidden if they aren't visible.
WMOs consist of one or more WMO groups - a bridge might be only one group while the city of Stormwind has about 300; usually one for every building and one for every indoor area. Dungeons are also a combination of groups.
Both map tiles and WMOs can have a list of models/doodads to include.
A note on file paths
File paths are specified relative to the root of the MPQ archives. Different types of files are located in different archives, like terrain.mpq for the terrain and texture.mpq for - surprise! - textures. MPQ files use \ as the path delimiter.
When referencing a file, I will only specify the filename and path, as the interfaces to MPQ files support the loading of a name from several open files. (including patches - a patch.mpq loaded at a higher priority can override some of the files at load time)
A note on coordinate systems
Internally, WoW stores coordinates in at least 3 different systems of reference. (sigh) I will use one coordinate system in the game world: The X axis points east, the Y axis points up, and the Z axis points south. (0,0,0) is the northwest (top-left) corner of the map. Coordinates for map tiles are specified by an (X,Z) pair of integers possibly ranging from (0,0) to (63,63). Coordinates for objects in the world are floating-point numbers - each map tile is square with a 533.33333 units long side, so x and z coordinates may range from 0.0 to about 34133.3333. Y coordinates are typically between -600 (deep sea) and 1500 to 2000 (the tallest points, rough estimate).
The coordinate system WoW uses in the protocol, is as follows: x and y signify the position on the map, z the height (points up). A midpoint is set at the center of the map at (the southeast of) tile x,y (32,32). This is the reference point (0,0,0). All coordinates are stored relative to this. This means that the northwest corner of the map is at (31,31)*533.3333f=(17066,17066), and the southeast one is at (-32,-32)*533.3333f=(-17066,-17066).
Worlds and Terrain
A world is specified by a .wdt file:
World\Maps\MapName\MapName.wdt
A WDT file will list the map tiles that exist in the world, or specify a WMO file's path to load. If there are map tiles, these can be loaded individually from
World\Maps\MapName\MapName_X_Z.adt
Where X and Z are the coordinates for the particular map tile.
Additionally, a low-res version of the entire heightmap is available in
World\Maps\MapName\MapName.wdl
This is probably used for the rough terrain WoW displays in the far background; "behind" the fog but in front of the sky dome. Currently, WoWmapview uses it to draw a minimap.
Map objects and models
After the heightmap data of the terrain come the polygon-mesh objects. There are two types of these: WMOs and models.
WMO files are in their own directory, with a root file and several group files.
World\wmo\path\WMOName.wmo
World\wmo\path\WMOName_NNN.wmo
Models come in .m2 files, even though they are referenced as .mdx or .mdl files in other places. The extension needs to be rewritten to .m2 to get the proper file name. Model files are found in various paths, so they have no common root path.
The same model format is used for objects in the world, monsters, characters and the items/armor/etc. that the players wear - this maxes it a somewhat complex format. Additionally, it doesn't have the great property of having well-defined chunks within the file - all of the previous formats were like that. This means that the reverse engineering of m2 files are far from complete, animation doesn't work at all, and there may be further glitches.
Other data
Data for the sky dome's colors and possibly global lighting can be found in
World\Maps\MapName\lights.lit
The file isn't completely understood yet.
Water properties are stored in a bunch of .WLW and .WLQ files in the same directory as the world, although all are in misc.mpq. So far I haven't found references to these file names anywhere else - another strange thing is that the two files appear to contain approximately the same data. I'm still trying to make sense of it. This is what we currently know about these files WLW WLQ.
Client Database (.dbc) files store a variety of information, mostly names for things like areas and maps. They have a uniform structure but store different kinds of data.
Textures
Textures, referenced by most of the above files, are stored in texture.mpq (and, some in interface.mpq) in their own .blp format. Most of the textures are stored with DXT1 or DXT3/DXT5 compression, depending on the requirements for an alpha channel. There are also a few uncompressed textures.

