MDL language documentation: Difference between revisions

From FreeAllegiance Wiki
Jump to navigationJump to search
m (Replaced with MDL Docs)
 
(12 intermediate revisions by 4 users not shown)
Line 1: Line 1:
{{Template:Stub}}
[[Allegiance]] engine uses its own files format. The main format is the MDL format, of which two flavors exists:
==Allegiance MDL Language Documentation==
* plain text MDL (mdl text format), and
* compiled MDL (mdl format).


===Introduction===
Both formats are supported and use the same extension (.mdl). Visual inspection of the file is required to determine the format used. There is no known tool to convert compiled mdl in plaintext mdl.
Allegiance engine uses its own files format. The main format is the MDL format which can be either plain text (mdl text format) or compiled (mdl format). Both formats are supported by the client (allegiance.exe) and they use the same extension (.mdl). Thus, inspection of the file is required to determine the used format.


The mdl text format uses a form of definition language to define objects.  
The mdl text format uses a form of definition language to define objects. This is what a common piece of MDL code looks like:


Sample (sample1.mdl):
use "effect";
frame = ModifiableNumber(1);
object = ImportXFile("artifact.x", frame);


[code]use "effect";
This sample uses an external .x file but the mdl language is complete enough to define meshes without using another file format (see samples/bgrnd03.mdl for a mdl only textured object) The mdl language scope goes beyond 3D models. It's used to defined most aspects of the game including 3D, sounds and UI panels.


frame = ModifiableNumber(1);


object = ImportXFile("artifact.x", frame); [/code]
== MDL textual language ==
 
The sample uses an external .x file but the mdl language is complete enough to define meshes without using another file format (see samples/bgrnd03.mdl for a mdl only textured object) The mdl language scope goes beyond 3D models. It's used to defined most aspects of the game including 3D, sounds and UI panels. The mdl language reference is currently in a first-alpha version. It should be a joint community effort; if you discover any ambiguities, or downright faults, please post on the boards or PM Ksero to improve the document.
 
===On the MDL textual language===


====Syntax====
====Syntax====
As mentioned, MDL is a declarative, case-sensitive language. Most statements take the form
As mentioned, MDL is a declarative, case-sensitive language. Most statements take the following form:


[code]identifier = function( parameter1, parameter2);[/code]
identifier = function(parameter1, parameter2);


A semi-colon should end every statement, which can span multiple text lines. MDL is a loosely typed language. You don’t need to specify the types of variables.
* MDL is a loosely typed language. You don’t need to specify the types of variables.
* A semi-colon should end every statement, which can span multiple text lines.
* Integer constants can be written in two ways: normally ({{tt|11}}) or as hex ({{tt|0x0B}}).
* String constants are written like: {{tt|“foostring”}}
* Boolean constants have two possible values, {{tt|true}} and {{tt|false}}.
* Comments are preceded by {{tt|//}}.


*Integer constants can be written in two ways: normally (11) or as hex (0x0B).
There is a single built-in operator, the bitwise or operator {{tt|{{bar}}}}. For example, {{tt|0x01 {{bar}} 0x02}} evaluates to {{tt|0x03}}.
*String constants are written like: “foostring”
*Boolean constants have two possible values
**true
**false


Comments are preceded by //
{{Note|Even though the native Number-type is a floating-point number, it is converted (cast) to a 32-bit integer when performing the bitwise operation.}}


There is a single built-in operator, the bitwise Or operator "|"
Example:
[code](0x01 | 0x02)[/code]
Evaluates to 0x03. Note that even though the native Number-type is a floating-point number, it is converted (cast) to a 32-bit integer when performing the bitwise operation.


====Namespaces====
====Namespaces====
Namespaces are a central concept in MDL. Every MDL file is a namespace, whether textual or binary. To be able to use variables, constants and functions from another file or namespace, simply state
Namespaces are a central concept in MDL. Every MDL file is a namespace, whether textual or binary. For example, to be able to use variables, constants and functions from another file or namespace called "filename.mdl", you would use the following:


[code]use "filename"[/code]
use "filename";


where filename does not have the .mdl-extension. All use-declarations must be located at the beginning of the MDL-file. Importing a namespace like this naturally imports any other namespace that is use-d in the imported namespace.
All use-declarations must be located at the beginning of the MDL-file. Importing a namespace like this naturally imports any other namespace that is use-d in the imported namespace.
The Allegiance engine also exports about 650 functions and constants into different namespaces. These are listed on the worksheet "From C++ exported to MDL", giving the parameters and a short note on the purpose / syntax. These exports can roughly be sorted into


*Object creation functions ("constructors").
The Allegiance engine also exports about 650 functions and constants into different namespaces. These are listed on the worksheet "From C++ exported to MDL", giving the parameters and a short note on the purpose / syntax. These exports can roughly be sorted into the following categories:


Example:
* '''Object creating functions''' ("constructors"), like {{tt|ButtonPane(Image background, Number FacesFlag, bool toggles)}}
* '''Global constants''', like {{tt|pi}}, {{tt|white}}, {{tt|black}} and key constants like {{tt|CommandVoteYes}}, {{tt|CommandDropChaff}}
* '''Built-in windows''', like the inventory, or the team window (F6) exporting data to be shown to their specific namespace.


[code]ButtonPane(Image background, Number FacesFlag, bool toggles)[/code]
In return, they expect certain controls, buttons to be specified in the MDL-file, so they can be imported back to the engine.
 
creates and returns a ButtonPane object.
 
*Global constants like pi, white, black and key constants like CommandVoteYes, CommandDropChaff
*Specific windows (like the inventory, or the team window (F6) exporting data to be shown to their specific namespace.  


In return, they expect certain controls, buttons to be specified in the MDL-file, so they can be imported back to the engine.
Some exports are seemingly only used in binary .mdl 3d models, e.g. {{tt|LightsGeo}} and {{tt|FrameData}}. Note that the exported namespaces are organized in a somewhat unintuitive hierarchy of imports / use-statements.


Some exports are seemingly only used in binary .mdl 3d models, e.g. LightsGeo and FrameData. Note that the exported namespaces are organized in a somewhat unintuitive hierarchy of imports / use-statements.


====Structs====
====Structs====
Line 70: Line 58:
The syntax is:
The syntax is:


[code]Struct structname extends parentstruct {
Struct structname extends parentstruct {
identifier1 : type1;
  identifier1 : type1;
identifier2 : type2;
  identifier2 : type2;
list3 : [type3];
  list3 : [type3];
};[/code]
};


Defining a struct allows you to use the structname as a constructor / function that creates and returns an object.  
Defining a struct allows you to use the structname as a constructor / function that creates and returns an object.  


Following the above example:
Here's an example:
 
variableidentifier = structname(type1object, type2object, [type3obj1, type3obj2, type3obj3])


[code]variableidentifier = structname(type1object, type2object, [type3obj1, type3obj2, type3obj3])[/code]


====Lists====
====Lists====
Line 87: Line 76:
Lists in general take the form
Lists in general take the form


[code]Identifier = [item1, item2, item3];[/code]
Identifier = [item1, item2, item3];


Note: In a function-call, an empty list evaluates to “no parameter”. Therefore, it can be inserted as an argument, without affecting the call. For example:
{{Note|In a function call, an empty list is simply discarded. The calls {{tt|Add(5,3,[],[])}} and {{tt|Add(5,3)}} are equivalent.}}


[code]Add(5,3,[],[])[/code]


is equivalent to
====Tuples====
In lists and variable definitions, each expression can actually contain several expressions (which may be of different types), effectively becoming a kind of unnamed struct. This is called a pair, or more precisely a tuple -- this construct can contain any number of expressions.


[code]Add(5,3)[/code]
Assigning a pair to an identifier / variable looks like:


====Pairs====
Identifier = (item1, item2, item3);
In lists and variable definitions, each expression can actually contain several expressions (which may be of different types), effectively becoming a kind of unnamed struct. This is called a pair, even though the pair may contain more that two expressions. Assigning a pair to an identifier / variable looks like:


[code]Identifier = (item1, item2, item3);[/code]
Using tuples in a list then becomes


Using pairs in a list then becomes
Identifier = [
              (item11, item12),
              (item21, item22),
              (item31, item32)
              ];


[code]Identifier = [
Tuples are extensively used at the bottom of dialog.mdl as follows:
(item11, item12),
(item21, item22),
(item31, item32)];[/code]


For example, at the end of dialog.mdl is a list of all the different in-flight dialogs and overlays. Each entry is:
(image, side, off point, on point, transition time, consoles modes, undetectable)


[code](image, side, off point, on point, transition time, consoles modes, undetectable)[/code]


Example entries:
====<tt>let ... in</tt>====
 
[code](ChatCompositionImage, SideBottom, Point( -170,  -78), Point(-150,  148), .5, 65663, false),
(PaneImage(InvestmentsPane, false, true), SideCenter, Point( -192, 2000), Point(-192, -240), .5, 512, false),[/code]
 
====let ... in====
The let-construct allows you to write a number of temporary definitions, and evaluate one expression in the context of these definitions. This allows for temporarily redefining an identifier for a certain expression and making a non-global assignment (perhaps to split up a long expression into several lines?). It is never used in the .mdl-files shipped with the game. The syntax is:
The let-construct allows you to write a number of temporary definitions, and evaluate one expression in the context of these definitions. This allows for temporarily redefining an identifier for a certain expression and making a non-global assignment (perhaps to split up a long expression into several lines?). It is never used in the .mdl-files shipped with the game. The syntax is:


[code]Identifier = let <definitions> in <expression>;[/code]
Identifier = let <definitions> in <expression>;


Example:
For example, the following assigns {{tt|11}} to {{tt|Identifier}}:


[code]Identifier = let
Identifier = let Foo = 5;
Foo = 5;
                  Bar = 6;
Bar = 6;
              in Add(Foo,Bar);
in Add(Foo,Bar);[/code]


This assigns the value 11 to the identifier "Identifier".
===== In practice =====
Following is a commented real life example: AutoDownloadDialog.mdl


===Tutorial – A simple, commented MDL-file===
[codebox]use "effect"; // import effect namespace for widgets/controls
Listing of AutoDownloadDialog.mdl:
 
[code]use "effect"; // import effect namespace for widgets/controls
use "font"; // import fonts
use "font"; // import fonts
use "gamepanes"; // import more Panes/widgets/controls
use "gamepanes"; // import more Panes/widgets/controls
Line 150: Line 130:
//
//


AutoDownloadAbortButton = ButtonPane(ImportImage("btnautodownloadabortbmp", true), ButtonNormal, false);
// Create a button
//Creates a button. Argument one is the button image, returned by ImportImage. Second is a flag about the behaviour of the button. Third is whether the button should have a state (toggle switch)
AutoDownloadAbortButton = ButtonPane(
                                    ImportImage("btnautodownloadabortbmp", true), //with an image,
                                    ButtonNormal,                                 //a behavior
                                    false                                         //no toggle behavior
                                    );


AutoDownloadCurrentFileStringPane = StringPane("", Color(1, 1, 1), Point(220, 13), JustifyRight, smallFont);
// Create a bunch of strings. The engine will take care of those.
// Creates an empty StringPane (in win32 “Label”). Imported by the engine, which sets the text properly
AutoDownloadCurrentFileStringPane = StringPane(
AutoDownloadApproxMinutes = StringPane("", Color(1, 1, 1), Point(120, 13), JustifyLeft, smallFont);
                                              "",             //with some content
//Another empty StringPane.
                                              Color(1, 1, 1), //a color (?)
                                              Point(220, 13), //a position
                                              JustifyRight,   //a justification
                                              smallFont       //a font
                                              );
AutoDownloadApproxMinutes = StringPane(
                                      "",             // do not worry
                                      Color(1, 1, 1), // about parameters
                                      Point(120, 13), // just yet, however.
                                      JustifyLeft,   // That's documented
                                      smallFont       // elsewhere :)
                                      );  


AutoDownloadTopBarStringPane = StringPane("Retrieving File List", Color(1, 1, 1), Point(150, 13), JustifyLeft, smallFont);
AutoDownloadTopBarStringPane = StringPane(
                                          "Retrieving File List", // Did you know...
                                          Color(1, 1, 1),         // a single typo will make Allegiance crash.
                                          Point(150, 13),         // You can find an MDL syntax
                                          JustifyLeft,           // checker in Cortex's blog.
                                          smallFont               // Mind the commas!
                                        );
// all kinds of indentation, tabulations and (half-done) formatting are found in the code.
// The above has been pretty printed for the purposes of this guide, but we'll stop doing this now
// to dip you in the atmosphere :D
 
// more of the same
AutoDownloadMidBarStringPane = StringPane("Analyzing Local Version", Color(1, 1, 1), Point(150, 13), JustifyLeft, smallFont);
AutoDownloadMidBarStringPane = StringPane("Analyzing Local Version", Color(1, 1, 1), Point(150, 13), JustifyLeft, smallFont);
AutoDownloadLowBarStringPane = StringPane("Downloading Updated Files", Color(1, 1, 1), Point(150, 13), JustifyLeft, smallFont);
AutoDownloadLowBarStringPane = StringPane("Downloading Updated Files", Color(1, 1, 1), Point(150, 13), JustifyLeft, smallFont);




// Create the progress bars
FileListGaugePane =
FileListGaugePane =
GaugePane(
GaugePane(
     ImportImage("autodownloadgaugebmp", false),
     ImportImage("autodownloadgaugebmp", false), // with an image
     FileListPercentDone,
     FileListPercentDone,                       // a progress (which is fed by the engine)
     Color(1, 0, 0),
     Color(1, 0, 0),                             // a "marker" color
     Color(0, 1, 0)
     Color(0, 1, 0)                             // and a "background" color
);
);


Line 186: Line 193:
     Color(0, 1, 0)
     Color(0, 1, 0)
);
);
//GaugePane is a progress-bar. First argument is the image, as it should appear when it’s 100% done. The second argument, the PercentDone-variables are the only exports to “autodownloaddialogdata”. They will be updated by the engine as the update progresses. Third is the “Flash”-color, which I suppose is used as a “marker”. Lastly we have the “empty”-color,
 


//
//
// AutoDownload Dialog
// AutoDownload Dialog
//
//
//We finally create the dialog


AutoDownloadDialog =
AutoDownloadDialog =
         (
         (
             ImagePane(
             ImagePane(
                 ImportImage("autodownloaddialogbmp", false),
                 ImportImage("autodownloaddialogbmp", false),               //with a background
                 [
                 [                                                           //and a list of panes
                     (AutoDownloadCurrentFileStringPane,    Point(195,185)),
                     (AutoDownloadCurrentFileStringPane,    Point(195,185)), //with more position parameters
                     (AutoDownloadApproxMinutes,            Point(100,185)),
                     (AutoDownloadApproxMinutes,            Point(100,185)),
                     (FileListGaugePane,                    Point(91,68)),
                     (FileListGaugePane,                    Point(91,68)),
Line 208: Line 217:
                 ]
                 ]
             )
             )
         );[/code]
         );


This ImagePane-object is imported back to the engine.
// This ImagePane-object is imported back to the engine.


===Tools===
[/codebox]
====[[MDLC]] – the mdl compiler====
Options:


[code]mdlc -optimize input output[/code]
==Tools==


used with 3d-models in .mdl-format. Removes diffuse/specular/emissive color information and consolidates texture information. Precalculates certain transforms etc... in one word: optimizes
====[[MDLC]] the mdl compiler====
 
''input'' the file (without .mdl ending) to optimize
 
''output'' destination filename, without .mdl ending
 
[code]mdlc -compressanim xframes yframes input output[/code]
 
applies a form of RLE (Run Length Encoding) to an animation (presumably a .bmp with the frames stored side-by-side in rows and columns). I haven't seen it used...
 
''xframes'' the number of animation frames in one row
''yframes'' the number of animation frames in one column
''input'' the filename of the .bmp to compress
''output'' the destination filename. .mdl ending is automatically added.
 
[code]mdlc -convert input output[/code]
 
converts a .bmp to bmp.mdl
 
''input'' filename of source bitmap
''output'' destination filename (without .mdl ending)
 
[code]mdlc -info input[/code]
 
prints some information about the model (how many triangles each LOD has)
 
''input'' the name of a .mdl-file (without .mdl-ending) describing a 3d-model with level-of-detail information
 
[code]mdlc -genheader input output[/code]
 
Generates c++ code for handling any structs defined in a .mdl-file.
 
''input'' the .mdl (without .mdl-ending) that contains struct definitions.
''output'' filename for writing the code to
 
[code]mdlc input output.mdl[/code]


converts ASCII .mdl to binary .mdl
The MDL compiler offers a numbers of features, each with its own syntax. Here's a list of accepted MDLC syntaxes:


''input'' source filename without .mdl ending
# <pre>mdlc -convert input output.mdl</pre>
''output'' destination filename with .mdl ending
#;{{tt|-convert}}
#: converts ASCII .mdl to binary .mdl
#;{{tt|input}}
#: source filename without .mdl ending
#;{{tt|output.mdl}}
#: destination filename '''with''' .mdl ending
#<pre>mdlc -optimize input output</pre>
#;{{tt|-optimize}}
#:optimize 3d-models in .mdl-format. Removes diffuse/specular/emissive color information and consolidates texture information. Precalculates certain transforms, etc... in one word: optimizes.
#;{{tt|input}}
#:the file (stripped of its .mdl extension) to optimize
#;{{tt|output}}
#:destination filename, without .mdl ending
#<pre>mdlc -compressanim xframes yframes input output</pre>
#;{{tt|-compressanim}}
#: applies a form of RLE (Run Length Encoding) to an animation (presumably a .bmp with the frames stored side-by-side in rows and columns).
#;{{tt|xframes}}
#: the number of animation frames in one row
#;{{tt|yframes}}
#: the number of animation frames in one column
#;{{tt|input}}
#: the filename of the .bmp to compress
#;{{tt|output}}
#: the destination filename, without the .mdl extension
# <pre>mdlc -convert input output</pre>
#;{{tt|-convert}}
#: converts a .bmp to bmp.mdl
#;{{tt|input}}
#: filename of source bitmap
#;{{tt|output}}
#: destination filename (without .mdl ending)
# <pre>mdlc -info input</pre>
#;{{tt|-info}}
#: prints some information about the model (how many triangles each LOD has)
#;{{tt|input}}
#: the name of a .mdl-file (without .mdl-ending) describing a 3d-model with level-of-detail information
# <pre>mdlc -genheader input output</pre>
#;{{tt|genheader}}
#: Generates c++ code for handling any structs defined in a .mdl-file.
#;{{tt|input}}
#: the .mdl (without .mdl-ending) that contains struct definitions.
#;{{tt|output}}
#: filename for writing the code to


===History===
== External Links ==  
v1.3 – 5/25/2005 – Ksero – further updates (thanks Cortex!)
* [http://henrik.heimbuerger.de/files/alleg/var/MDL%20Language%20Documentation.zip Ksero's Excellent MDL Language Documentation] A Zip-file including the complete MDL language reference.
v1.2 – 4/17/2005 – Ksero – branched off of KGJV’s draft.
v1.0 - 3/21/2004 - KGJV/Kirth Gersen - rough draft / preliminary work


{{Category:Development}} {{Category:Guides}} {{Category:Stub}}
[[Category:Art Development]][[category:Development]][[category:MDL]]

Latest revision as of 04:15, 10 March 2012

Allegiance engine uses its own files format. The main format is the MDL format, of which two flavors exists:

  • plain text MDL (mdl text format), and
  • compiled MDL (mdl format).

Both formats are supported and use the same extension (.mdl). Visual inspection of the file is required to determine the format used. There is no known tool to convert compiled mdl in plaintext mdl.

The mdl text format uses a form of definition language to define objects. This is what a common piece of MDL code looks like:

use "effect"; 

frame = ModifiableNumber(1); 

object = ImportXFile("artifact.x", frame);

This sample uses an external .x file but the mdl language is complete enough to define meshes without using another file format (see samples/bgrnd03.mdl for a mdl only textured object) The mdl language scope goes beyond 3D models. It's used to defined most aspects of the game including 3D, sounds and UI panels.


MDL textual language

Syntax

As mentioned, MDL is a declarative, case-sensitive language. Most statements take the following form:

identifier = function(parameter1, parameter2);
  • MDL is a loosely typed language. You don’t need to specify the types of variables.
  • A semi-colon should end every statement, which can span multiple text lines.
  • Integer constants can be written in two ways: normally (11) or as hex (0x0B).
  • String constants are written like: “foostring”
  • Boolean constants have two possible values, true and false.
  • Comments are preceded by //.

There is a single built-in operator, the bitwise or operator |. For example, 0x01 | 0x02 evaluates to 0x03.


Info.png
Note Even though the native Number-type is a floating-point number, it is converted (cast) to a 32-bit integer when performing the bitwise operation.


Namespaces

Namespaces are a central concept in MDL. Every MDL file is a namespace, whether textual or binary. For example, to be able to use variables, constants and functions from another file or namespace called "filename.mdl", you would use the following:

use "filename";

All use-declarations must be located at the beginning of the MDL-file. Importing a namespace like this naturally imports any other namespace that is use-d in the imported namespace.

The Allegiance engine also exports about 650 functions and constants into different namespaces. These are listed on the worksheet "From C++ exported to MDL", giving the parameters and a short note on the purpose / syntax. These exports can roughly be sorted into the following categories:

  • Object creating functions ("constructors"), like ButtonPane(Image background, Number FacesFlag, bool toggles)
  • Global constants, like pi, white, black and key constants like CommandVoteYes, CommandDropChaff
  • Built-in windows, like the inventory, or the team window (F6) exporting data to be shown to their specific namespace.

In return, they expect certain controls, buttons to be specified in the MDL-file, so they can be imported back to the engine.

Some exports are seemingly only used in binary .mdl 3d models, e.g. LightsGeo and FrameData. Note that the exported namespaces are organized in a somewhat unintuitive hierarchy of imports / use-statements.


Structs

Structs are used once in the artwork shipped with Allegiance, in quickchatheader.mdl. They are also an exception to the loose typing. In a struct, you need to define the types that it contains. To be able to use the struct in c++-code, use the mdlc utility to generate an appropriate header. You can also use the keyword “extends” to use inheritance (also used in the same file).

The syntax is:

Struct structname extends parentstruct {
  identifier1 : type1;
  identifier2 : type2;
  list3 : [type3];
};

Defining a struct allows you to use the structname as a constructor / function that creates and returns an object.

Here's an example:

variableidentifier = structname(type1object, type2object, [type3obj1, type3obj2, type3obj3])


Lists

Some functions can take a variable number of arguments. A window can have several controls, a QuickChatMenu can have several entries. In this case, a list is used as an argument.

Lists in general take the form

Identifier = [item1, item2, item3];


Info.png
Note In a function call, an empty list is simply discarded. The calls Add(5,3,[],[]) and Add(5,3) are equivalent.


Tuples

In lists and variable definitions, each expression can actually contain several expressions (which may be of different types), effectively becoming a kind of unnamed struct. This is called a pair, or more precisely a tuple -- this construct can contain any number of expressions.

Assigning a pair to an identifier / variable looks like:

Identifier = (item1, item2, item3);

Using tuples in a list then becomes

Identifier = [
              (item11, item12),
              (item21, item22),
              (item31, item32)
             ];

Tuples are extensively used at the bottom of dialog.mdl as follows:

(image, side, off point, on point, transition time, consoles modes, undetectable)


let ... in

The let-construct allows you to write a number of temporary definitions, and evaluate one expression in the context of these definitions. This allows for temporarily redefining an identifier for a certain expression and making a non-global assignment (perhaps to split up a long expression into several lines?). It is never used in the .mdl-files shipped with the game. The syntax is:

Identifier = let <definitions> in <expression>;

For example, the following assigns 11 to Identifier:

Identifier = let Foo = 5;
                 Bar = 6;
             in Add(Foo,Bar);
In practice

Following is a commented real life example: AutoDownloadDialog.mdl

[codebox]use "effect"; // import effect namespace for widgets/controls use "font"; // import fonts use "gamepanes"; // import more Panes/widgets/controls use "autodownloaddialogdata"; //import data specific for this dialog

///////////////////////////////////////////////////////////////////////////// // // AutoDownload Dialog // /////////////////////////////////////////////////////////////////////////////

// // Guts //

// Create a button AutoDownloadAbortButton = ButtonPane(

                                    ImportImage("btnautodownloadabortbmp", true), //with an image,
                                    ButtonNormal,                                 //a behavior
                                    false                                         //no toggle behavior 
                                   ); 

// Create a bunch of strings. The engine will take care of those. AutoDownloadCurrentFileStringPane = StringPane(

                                              "",             //with some content
                                              Color(1, 1, 1), //a color (?)
                                              Point(220, 13), //a position
                                              JustifyRight,   //a justification
                                              smallFont       //a font
                                             ); 

AutoDownloadApproxMinutes = StringPane(

                                      "",             // do not worry
                                      Color(1, 1, 1), // about parameters
                                      Point(120, 13), // just yet, however.
                                      JustifyLeft,    // That's documented
                                      smallFont       // elsewhere :)
                                     ); 

AutoDownloadTopBarStringPane = StringPane(

                                         "Retrieving File List", // Did you know...
                                         Color(1, 1, 1),         // a single typo will make Allegiance crash.
                                         Point(150, 13),         // You can find an MDL syntax 
                                         JustifyLeft,            // checker in Cortex's blog.
                                         smallFont               // Mind the commas!
                                        );

// all kinds of indentation, tabulations and (half-done) formatting are found in the code. // The above has been pretty printed for the purposes of this guide, but we'll stop doing this now // to dip you in the atmosphere :D

// more of the same AutoDownloadMidBarStringPane = StringPane("Analyzing Local Version", Color(1, 1, 1), Point(150, 13), JustifyLeft, smallFont); AutoDownloadLowBarStringPane = StringPane("Downloading Updated Files", Color(1, 1, 1), Point(150, 13), JustifyLeft, smallFont);


// Create the progress bars FileListGaugePane = GaugePane(

   ImportImage("autodownloadgaugebmp", false), // with an image
   FileListPercentDone,                        // a progress (which is fed by the engine)
   Color(1, 0, 0),                             // a "marker" color
   Color(0, 1, 0)                              // and a "background" color

);

VerifyGaugePane = GaugePane(

   ImportImage("autodownloadgaugebmp", false),
   VerifyPercentDone,
   Color(1, 0, 0),
   Color(0, 1, 0)

);

DownloadGaugePane = GaugePane(

   ImportImage("autodownloadgaugebmp", false),
   DownloadPercentDone,
   Color(1, 0, 0),
   Color(0, 1, 0)

);


// // AutoDownload Dialog //

//We finally create the dialog

AutoDownloadDialog =

       (
           ImagePane(
               ImportImage("autodownloaddialogbmp", false),                //with a background
               [                                                           //and a list of panes
                   (AutoDownloadCurrentFileStringPane,    Point(195,185)), //with more position parameters
                   (AutoDownloadApproxMinutes,            Point(100,185)),
                   (FileListGaugePane,                    Point(91,68)),
                   (VerifyGaugePane,                      Point(91,113)),
                   (DownloadGaugePane,                    Point(91,158)),
                   (AutoDownloadAbortButton,              Point(210,200)),
                   (AutoDownloadTopBarStringPane,         Point(100,51)),
                   (AutoDownloadMidBarStringPane,         Point(100,96)),
                   (AutoDownloadLowBarStringPane,         Point(100,140))
               ]
           )
       );

// This ImagePane-object is imported back to the engine.

[/codebox]

Tools

MDLC – the mdl compiler

The MDL compiler offers a numbers of features, each with its own syntax. Here's a list of accepted MDLC syntaxes:

  1. mdlc -convert input output.mdl
    -convert
    converts ASCII .mdl to binary .mdl
    input
    source filename without .mdl ending
    output.mdl
    destination filename with .mdl ending
  2. mdlc -optimize input output
    -optimize
    optimize 3d-models in .mdl-format. Removes diffuse/specular/emissive color information and consolidates texture information. Precalculates certain transforms, etc... in one word: optimizes.
    input
    the file (stripped of its .mdl extension) to optimize
    output
    destination filename, without .mdl ending
  3. mdlc -compressanim xframes yframes input output
    -compressanim
    applies a form of RLE (Run Length Encoding) to an animation (presumably a .bmp with the frames stored side-by-side in rows and columns).
    xframes
    the number of animation frames in one row
    yframes
    the number of animation frames in one column
    input
    the filename of the .bmp to compress
    output
    the destination filename, without the .mdl extension
  4. mdlc -convert input output
    -convert
    converts a .bmp to bmp.mdl
    input
    filename of source bitmap
    output
    destination filename (without .mdl ending)
  5. mdlc -info input
    -info
    prints some information about the model (how many triangles each LOD has)
    input
    the name of a .mdl-file (without .mdl-ending) describing a 3d-model with level-of-detail information
  6. mdlc -genheader input output
    genheader
    Generates c++ code for handling any structs defined in a .mdl-file.
    input
    the .mdl (without .mdl-ending) that contains struct definitions.
    output
    filename for writing the code to

External Links