Introduction to ASM tweaking

From FSDeveloper Wiki
(Redirected from ASM tweaking)
Jump to: navigation, search

So you have designed something with GMax or FSDS3, but your desires are outreaching the capabilities of MakeMDL? And now you have come across some tips that describes how you can tweak the ASM source code to get the result you want, but you have no idea where to start with ASM source code tweaking. Then this article should be enough to get you going.

Please note that ASM source code tweaking is only possible when you are compiling using MakeMDL. That means only when you make scenery using the FS2002 or FS2004 SDK. In FSX MakeMDL is replaced by XtoMDL and it no longer allows this kind of tweaking.

Does MakeMDL produce source code then?

If you have only used MakeMDL to create a BGL or MDL file for you directly from the modelling tools, you might be a bit surprised to hear that it can also create a source code file for you. But it certainly can do so if you ask it to! Normally this source code file is only created temporarily and removed when the compilation of the BGL or MDL has finished. But you can also keep this source file and that gives you the ability to tweak your object beyond the limitations of MakeMDL. How to keep the source code files is different for the version of MakeMDL you are using.

How to keep the source file [Fs2002]

For the Fs2002 gamepack it is rather simple to keep the source files. Just make sure you have the latest version of MakeMDL for Fs2002 installed. Now you will see that the options screen during the export also has an option "Keep files". This will make sure that the source files are saved in the same folder as the BGL or MDL file you created.

How to keep the source file [Fs2004]

For the Fs2004 gamepack things are a little more complicated. Microsoft has tried to hide the options screen from us, so we can not access it directly anymore. But there are still ways to save the source files.

The easiest way is to make a configuration file for MakeMDL. This configuration file should be placed in the same folder as the MakeMDL executable. If you write a line "Keep=1" (without the quotes) in this file the source files will also be saved. So your makemdl.cfg could look like this:


Another option is to use MDLCommander. After you have installed MDLCommander as explained in the documentation, you will get the options screen again on export. Selecting the "Keep files" option will save the source files again in the folder where you created your MDL file.

Cool, now I have the source files, but...

MakeMDL has now created two ASM files for you. But why two and what can I do with them?

You can open these source files with any text editor, for example with Notepad. What you will see then is just a lot of commands that define your object. If you open the source with a program like Word, please be sure that you save it as plain text afterwards.

As you have seen MakeMDL made two source files for you, myfile.asm and myfile_0.asm. What is contained in these two files? In theory the myfile_0.asm file contains all the actual (or should I say interesting) code of your object. So the vertices, materials, textures, polygons, animations, etc. The myfile.asm contains "only" the basic framework that allows you to place the object or that adds the crash detection to it. Most changes will thus be made to the myfile_0.asm file.

How to get a new BGL/MDL file

After you have made the changes you want to the source files, the final step is to create a new BGL or MDL file. To do this you will need a compiler that converts the ASM source code into a BGL or MDL file for FS again.

For Fs2002 you need to use BGLC for this. BGLC is the compiler that Microsoft supplied for creating scenery files (BGL), BGLC stands for BGL Compiler.

For Fs2004 Microsoft has not provided an updated version of BGLC, but an updated version has been made by Richard Ludowise (rhumbaflappy), you will need to download BGLC_9 to be able to compile your new MDL file.

Now that you have the tools, the next step is to actually compile. Here you again have a couple of options.

You can do it in the Windows style. That means that you select your source file and then drop it onto the icon of the BGLC/BGLC_9 compiler. A new BGL/MDL file will then be created. You only need to compile the myfile.asm file, the myfile_0.asm file is automatically included. In the case of BGLC_9 it could be that a BGL file is created, but you will have to rename it to MDL. If you try to load it as a BGL file, FS will certainly crash.

The other option, and I prefer this one, is to use the command prompt (DOS). To compile a file you would have to type something like this:

bglc myfile.asm
bglc_9 -mdl scenery.asm

Note that I added the option -mdl for BGLC_9, as that will automatically set the extension to MDL. To make use of the command prompt really easy, you could also put the folder that contains BGLC and/or BGLC_9 to your path, then you can call it from any folder you wish.

After you have compiled the new files you can use them just like any other BGL or MDL file that has been created by your modelling program directly. So have fun tweaking your work!