MDL File Format

From HIVE
Revision as of 06:47, 17 February 2018 by 172.18.0.9 (talk)
Jump to navigation Jump to search


MDL is the text file format of Warcraft 3 3D models (for the binary format, see MDX_File_Format).

Preface/About

Unlike the MDX binary format, the MDL format is badly supported by fan-made tools because the Warcraft III game engine usually will not load imported MDL models unless they are present in use on a unit physically placed on the map at game start. Since very few users are aware that the game is even capable of loading and displaying an imported MDL model, support with fan tools is limited. The format generally was used for manual user edits when Warcraft III modeling had less available fan-made tools, and only in the first few years after the game was released. Even then, most users edited MDL files only with the intention of then converting the MDL file to an MDX before using it.

There is almost no fan-made tool capable of parsing the entire MDL specification and converting it to an MDX to this day other than YobGul's File Converter which uses the native game.dll from Warcraft III to convert the model with Blizzard's own code. Many tools approximate, such as Magos's War3 Model Editor or MDLX Converter, but will suffer data loss on models with multiple TVertex chunks in one Geoset, ParticleEmitter2's that emit Team Glow using the ReplaceableId fields, certain Light intensity values, and other such obscurities.

Comments

Comments use a double forward slash, and are of the form:

// This is a comment

Most converters will automatically insert a comment on each node's ParentId X, field, noting the name of the node's parent for user reference.

Below are a list of tool-specific, known automatically generated comments.

Matrix Eater (fanmade MDX -> MDL conversion)

//This model was converted from MDX by ogre-lord's Java MDX API and Retera's Java MDL API

Matrix Eater (save timestamp)

// Saved by Retera's MDL Toolkit on Fri Feb 16 20:18:29 EST 2018

Magos War3 Model Editor (fanmade MDX -> MDL conversion, save timestamp)

//+-----------------------------------------------------------------------------
//| Footman.mdl
//| Generated by War3 Model Editor v1.07
//| Friday, February 16 2018 20:22:40
//| http://www.magosx.com
//+-----------------------------------------------------------------------------

MDLX Converter (fanmade MDX -> MDL conversion)

// Converted Fri Jan 22 23:02:40 2016
// MdlxConv Version Jun 29 2010.

YobGul's War3FileConverter (MDX -> MDL using game.dll, timestamp)

// MDLFile version	Jun 27 2002 20:34:57
// Exported on Sun Aug 31 10:33:18 2008

MdlVis

//Modified with MdlVis.

Version Block

This block is presumably used to indicate version. Since Warcraft III's model formatting has not changed much in about 15 years, almost all models ever observed will be version 800.

The block usually looks like this:

Version {
	FormatVersion 800,
}

Extents

Insofar as the MDL is concerned, in places where Extents may be listed, either a BoundsRadius or a MinimumExtent and MaximumExtent pair may be given, or both. Specifics on which is actually accepted should include knowledge of the binary MDX, of which this format is an approximate, since it is illogical to include or exclude extents information where the binary will actually encode a value in all cases.

Many user tools seem to add BoundsRadius 0 as though this encodes a special magic value, but this is not true of all tools.

Examples

No bounds radius:

	MinimumExtent { -398.074, -378.684, -70.7763 },
	MaximumExtent { 365.174, 399.203, 1040.87 },

With bounds radius:

		MinimumExtent { -160.357, -173.089, -53.7329 },
		MaximumExtent { 172.467, 160.42, 197.855 },
		BoundsRadius 239.729,

Model Block

This block denotes the model's name, number of each type of chunk, blend time, and bounds/extents. Typically most MDL parsers will ignore the chunk counts here to allow users to add more manually without having to update the listed total count. For example, a model might have NumGeosets 3, but it is preferable to load any number of Geoset blocks, so that a user can add more without consequence.

So, significant fields for a parser here include BlendTime, and the extents. For parsing Extents, see the Extents section.

Example

Model "HeroBladeMaster" {
	NumGeosets 9,
	NumGeosetAnims 6,
	NumHelpers 7,
	NumBones 52,
	NumAttachments 9,
	NumParticleEmitters2 2,
	NumRibbonEmitters 1,
	NumEvents 14,
	BlendTime 150,
	MinimumExtent { -398.0740051269531, -378.6839904785156, -70.77629852294922 },
	MaximumExtent { 365.17401123046875, 399.2030029296875, 1040.8699951171875 },
	BoundsRadius 0,
}

Sequences Block