- Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.Dismiss Notice
- DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.Dismiss Notice
- We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.Dismiss Notice
- The Yin & Yang theme is on for the 13th Music Contest. Participate and have a go at fun.Dismiss Notice
- The Highway to Hell has been laid open. Come along and participate in the 5th Special Effect Contest.Dismiss Notice
- Check out the Staff job openings thread.Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.
Discussion in 'World Editor Help Zone' started by Orcsbreath, Aug 31, 2018.
Filename extension | .mpq |
---|---|
Developed by | Mike O'Brien |
MPQ (Mo'PaQ, short for Mike O'Brien Pack, named after its creator[1]), is an archivingfile format used in several of Blizzard Entertainment's games.
MPQs used in Blizzard's games generally contain a game's data files, including graphics, sounds, and level data. The format's capabilities include compression, encryption, file segmentation, extensible file metadata, cryptographic signature and the ability to store multiple versions of the same file for internationalization and platform-specific differences. MPQ archives can use a variety of compression algorithms which may also be combined.
Mpq file parser in node trying to copy stormlib. Contribute to juvian/warcraft-3-mpq-parser development by creating an account on GitHub.
File indexing[edit]
In order to meet the requirements of speed generally demanded by a computer game, files are indexed in a hash table using a quick, low-collision hashing algorithm. The index of a specific file within the hash table is the hash of the lowercased filename modulo the size of the hash table, allowing for quick verification of a file's existence within the archive. If multiple files within the archive have the same hash, colliding entries will follow each other in increasing index order (forming a colliding hash cluster). In order to identify the exact entry for the requested file within a colliding hash cluster, each hash table entry stores 2 additional hashes of the lowercased filename, each using the same hashing algorithm but with a different seed value, as well as a locale code and platform code. The end of a colliding hash cluster is detected either by encountering an empty hash table entry or by traversing the entire hash table (including the modulo loopback) back to the initial hash table index.
Encryption[edit]
Both the block table (which contains information on where the file data is located in the archive) and the hash table used for file indexing are encrypted when stored. The encryption process which is used by default uses a known algorithm.
Revisions[edit]
The file header reserves space to contain format version data. Warcraft III ignores format version data of .mpq compliant files it loads and assumes all are version 1.
- Version 1 was used before World of Warcraft.
- Version 2 added an extended header to the format which contained data for an extended block table to allow for larger archive sizes.
Archive metadata[edit]
MPQ archives do not have specific structures to store metadata beyond what is absolutely necessary to access archived files. Instead, the convention is to use regular files whose filename is enclosed by parentheses.
Below are known metadata files.
![Warcraft War3.mpq Warcraft War3.mpq](http://media.moddb.com/cache/images/downloads/1/58/57495/thumb_620x2000/141.png)
- (listfile): Contains a list of the archive's files, one filename per line. May or may not be exhaustive.
- (signature): Contains the weak cryptographic signature of the archive. This type of signature is deprecated.
- (attributes): Contains extended file metadata. Currently known attributes are file creation date, CRC32 checksum and MD5 checksum.
Compression[edit]
In modern MPQ archives, each segment (or sector) of a file can be compressed using a combination of compression algorithms. A header byte is prepended to every compressed sector to indicate which compressions were used. The order in which those compressors are applied is hardcoded.
The following algorithms are currently in use by Blizzard games:
- PKZIP (licensed from PKWARE). The first compression algorithm available.[2]
- Huffman tree compression combined with ADPCM 4:1 compression (both introduced in StarCraft). Latter algorithm is lossy and only suitable for raw PCM input data.
- zlib (introduced in Warcraft III).
- bzip2 (introduced in World of Warcraft).
- LZMA (introduced in StarCraft II).
Since there was only one compression algorithm available when MPQs were first deployed in Diablo, those archives used a different archive file metadata flag to indicate compression and did not use a compression header byte.
Warcraft III cinematics[edit]
Cutscene cinematics with the MPQ extension are included with Warcraft III and, despite the file extension, are not actual MPQ files. Rather they are AVI files compressed with Blizzard's renamed MPEG-4codec, BLZ0 (which actually is DivX). These files are playable in ordinary media players, provided the proper codecs are installed. Nevertheless, World of Warcraft cinematics use the AVI extension.
Usage in gaming[edit]
Blizzard has utilized the MPQ file format for archiving game files in a number of their games, including:
- Diablo: Hellfire developed by Synergistic Software
- Lords of Magic developed by Sierra Entertainment
- World of Warcraft and its expansions up to Mists of Pandaria
Replacement: CASC[edit]
On April 3, 2014, with the beginning of alpha testing for World of Warcraft: Warlords of Draenor, Blizzard announced that they were testing a new proprietary file format dubbed CASC (Content Addressable Storage Container) to replace MPQ in World of Warcraft. Among the improvements touted for it include a reduction in file corruption by creating a self-maintaining system, improved in-game performance and faster patching. The CASC format was initially tested in the internal alpha for Heroes of the Storm, and later in the alpha and beta tests for Warlords of Draenor before it is implemented within the main game itself prior to the expansion's release. [3] Both StarCraft II and Diablo III were later changed to using CASC for their main data.
References[edit]
- ^'MPQ Archives - Overview'. www.zezula.net. Retrieved 2017-02-15.
- ^'Phillip Katz, Computer Software Pioneer, 37'. The New York Times. May 1, 2000. Retrieved 2011-07-14.
- ^Warlords of Draenor Alpha Testing Begins - World of Warcraft
Retrieved from 'https://en.wikipedia.org/w/index.php?title=MPQ_(file_format)&oldid=921974779'