• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Exporting Custom Models

Status
Not open for further replies.
Level 5
Joined
Jan 25, 2012
Messages
109
Hi everyone,

I want to learn how to export .MDL custom models for Warcraft 3 maps (a step by step tutorial would be neat!). I know there's an mdl imp/exp plugin for 3dmax (the program I use) but for some reason when I tried to export my models they don't work or never load in game, not even in war3viewer. Is there another plugin or 3dmax version I should use?

I have created some Transformers models for another game but I would love to release them as model resources for warcraft 3.

Thanks.
 
There are two formats to keep an eye out for with Warcraft III. The MDL format was historically only used as a text-based format inside Blizzard offices when the game was first invented. I don't know if you have ever used "git" or other source control technologies, but when you are editing files that are readable in Notepad or a text editor then it's easier to track when portions of the file change, and track who changed them.

So inside the office before Blizzard pushes "release" on the Warcraft III game, their 3D models are stored in this text-based MDL format. But, around the year 2002 or 2003 when Blizzard was releasing the Warcraft III game, they needed the release version to run faster so the models were compressed into a binary format given the extension MDX. The MDX and MDL formats mirror each other in what fields they can have and what they can store, but the MDX format is compressed binary and so we would expect it to have higher performance when loading in-game.

As it happened, when the Warcraft III Beta in the early days of 2001 or 2002 was getting publicly tested, some guy found out that the piece of code used in the in-office internal build pipeline for Warcraft III to convert the "MDL" format in the office for tracking developer workflow changes... was exposed in the beta game DLLs. So, this guy YobGul made a hacked version of the Warcraft 3 DLLs that could run Blizzard's own converter between MDX and MDL and that spawned many years of custom programs claiming to support them both. Somewhere between 2003-2005 to encourage modding, Blizzard also released their own 3ds max plugin that they had used to create the Warcraft III assets originally, along with a PDF guide on how the formats work. Their plugin is able to export both MDX and MDL but was intended for Discreet 3ds Max version 4.N where N is some number that I forget. I haven't the faintest idea how someone would obtain that version of 3ds Max today, nor how they would use it. As I understand, it was from before Autodesk bought out the Discreet company.

So, whatever plugin you were using is probably hand-written by game fans who were reading MDL spit out by these modified official tools. Given no guide on how the MDL format works, the people writing your plugin probably made a series of mistakes in their understanding of the format. The MDL extension files have become notoriously inconsistent between programs, especially with the advent of Reforged and its own new changes to the MDL and MDX formats.

In my experience, getting the Warcraft III Map Editor to accept the MDL files is a royal pain. Back when I used to do that, there was some bug where the models would only work if they were already placed on a unit in the world when the Warcraft III game started playing the map. I think it might be some bizarre artifact of the MDL loader because of how it isn't used in Warcraft III in production.

So, with that in mind, this was a very long-winded way for me to tell you that I personally think that you should convert your MDL files into the MDX binary compressed format before trying to load them into the Warcraft III game or its editor. I do this always, all the time, in all cases when modding Warcraft III. By doing that, I don't have to worry about possible quirks in the Warcraft III game's MDL loader -- and more importantly, I don't have to worry about software bugs in the fan-made programs that I use to produce MDL files, because usually if I convert to MDL and back using the same fanmade software, then even if it had a mistake in its formatting it would probably at least be internally consistent (in most cases). For example, often times if I would save a model to MDL format with the War3ModelEditor that had a particle effect in it, then open and save it back to MDX with some other converter, often times the Length and Width of the particle effect would be flipped and it would become visually broken. But if I converted to MDL using the War3ModelEditor and then converted back to MDX using the War3ModelEditor, even if it used the name Length to refer to Width and the name Width to refer to Length, it was still internally consistent so the model ends up working.

Are you able to open your MDL files in Notepad and confirm that they have the correct MDL format header for Warcraft III? This should look something like the following (with the possibility of some comment like //Model saved on 2022-08-09 or something before the Version block):

Reforged Patch 1.32:
Code:
Version {
    FormatVersion 1000,
}

Legacy Warcraft III Versions (all versions if your menu is not Reforged):
Code:
Version {
    FormatVersion 800,
}

Reforged Patch 1.33 PTR (probably not used yet):
Code:
Version {
    FormatVersion 1100,
}

If your MDL file does not start with this form when you look at it in Notepad, then it might be using the extension MDL that an independent author (separate from Warcraft III) invented. Given that "MDL" is what we get if we take the vowels out of "Model", I believe this is possible.
From wikipedia, they say "MDL" may mean:
So, if your exporter was using any of these other game system's formats, then the file would be named "MDL" but would have nothing to do with Warcraft III. Having the "FormatVersion" tag at the top would tell you that the file is intended for use with Warcraft III. In particular, although I noted above how different game versions use different MDL versions, actually us War3 modders here on the Hive bothered Blizzard during the development of Reforged Beta and got them to make Reforged engine able to load the assets from the 2002 Warcraft III game. So, because of that, Reforged game can load assets in a format other than its own. By extension, this means that if you use FormatVersion 800 for your file, then all versions of Warcraft III generally in use today should accept it. So, that's probably what you want to do if you're just getting started.

If you got this far thinking, "Yeah I already know all of that" then it means you have a program that is creating a Warcraft III MDL file but the file is invalid somehow. Helping you debug what is wrong with your program, or what is wrong with how you are using it, is probably beyond the scope of what I can write in this reply. But a decent rule of thumb to try is to drag and drop the model into this Hive webpage that has a "sanity checker" for warcraft 3 models and will spit out file errors. Usually errors that are yellow and green are things that might be an error, and I have been annoyed sometimes with that because sometimes the green stuff just literally does not even matter. But if you see like some orange or red "errors" and "severe" alerts popping up when this page parses your model, the likelihood that the detected error overlaps or is related to why Warcraft III would not load the file is generally going to be fairly high:

Also, the above page accepts "drag and drop" for both MDL and also MDX formats. So, unlike the Warcraft III world editor (which I would personally not import an MDL into just to avoid issues) this parser should probably be fine with MDL files that are not yet compressed into an MDX file.
 
Last edited:
Status
Not open for further replies.
Top