PAPI Lighting Tutorial

Well I created the file MakeMDL.cfg and pasted it into Gmax/gamepacks/FSX_GmaxGamePack/Plugins/ and reopened Gmax_FSX.

No luck, no .asm files in the directory where I exported the .mdl file :( I did a simple Export Selected, type .mdl (also tried All Formats) and left the settings in the small panel that came up at default.

I tried both Pakmak and Arno's versions (pasted in from thread).

Does it look as if I did the right thing?

klem
 
PakMac, do you mean that I can't create these PAPI light boxes for FSX or that there is a different method for FSX?

klem
 
You can create the PAPI boxes for FSX but you need to do it with the FS2002 or FS2004 gamepacks as they produce the asm files that you tweak.

Where as the FSX gamepack only produces the mdl file.

David
 
Thanks PakMac, I think I get it now.

I know this is like pulling teeth but just to be clear:

1. I downloaded the FS2004 gamepack and install it to a temporary folder (in which I got a FS2004 gmax shortcut, a gmax.ini, a plugin.ini and a /gamepacks/FS2004/ folder
2. I copy (only) the latter FS2004 folder into the actual GMAX gamepacks folder giving me two folders there now, the FS2004 and the FSX one. This folder also has an FS2004 gmax short cut in it.
3. I now run Gmax from that shortcut in the Gmax/gamepacks/FS2004/ gamepack folder.

Is that right?

(phew) !

klem
 
Well, it seems that was right, I have the .mdl, the .asm's, an XML and a .log.

Many thanks.

On to the next step :)

klem
 
Thanks PakMac, I think I get it now.

I know this is like pulling teeth but just to be clear:

1. I downloaded the FS2004 gamepack and install it to a temporary folder (in which I got a FS2004 gmax shortcut, a gmax.ini, a plugin.ini and a /gamepacks/FS2004/ folder
2. I copy (only) the latter FS2004 folder into the actual GMAX gamepacks folder giving me two folders there now, the FS2004 and the FSX one. This folder also has an FS2004 gmax short cut in it.
3. I now run Gmax from that shortcut in the Gmax/gamepacks/FS2004/ gamepack folder.

Is that right?

(phew) !

klem
You can copy the gmax shortcut to your desktop and rename it to something like GMAX_FS2004.


On to the next step :)

Best of luck, Klem
 
Hi PakMac

I ran into a problem with editing the _0.asm file. It wasn't as 'clean' as yours. Here is what it has in the part I am to edit.
================================
PAPI_04_064_MasterScale_2 label BGLCODE
BGL_FTAG "MasterUnitConve", 0.00 ; Node 2

; Node 2 - MasterUnitConversion transform:

BGL_SET_MATRIX_INDIRECT 12
BGL_FTAG "RotateAroundX", 0.00 ; Node 3

; Node 3 - RotateAroundX transform:
BGL_SET_MATRIX_INDIRECT 13
BGL_FTAG "PAPI_1W", 0.00 ; Node 5

; Node 5 - PAPI_1W transform:

BGL_SET_MATRIX_INDIRECT 14

IFMSK nolgt_1, dict_0_g_lightStates, LIGHT_NAV_MASK
BGL_LIGHT LIGHT_NAV, -0.025, 0.017, -0.000, 20, 0.60, 0.40, 0FFFDFDFDh, 0.000000, 0.000000, 1.000000 ; source poly num = 13
nolgt_1 label BGLCODE
BGL_FTAG "PAPI_1R", 0.00 ; Node 6

; Node 6 - PAPI_1R transform:

BGL_SET_MATRIX_INDIRECT 15

IFMSK nolgt_2, dict_0_g_lightStates, LIGHT_NAV_MASK
BGL_LIGHT LIGHT_NAV, -0.025, 0.017, -0.000, 20, 0.60, 0.40, 0FFFF0000h, 0.000000, 0.000000, 1.000000 ; source poly num = 14
nolgt_2 label BGLCODE
BGL_FTAG "PAPI_1R01", 0.00 ; Node 8

; Node 8 - PAPI_1R01 transform:

BGL_SET_MATRIX_INDIRECT 16

IFMSK nolgt_3, dict_0_g_lightStates, LIGHT_NAV_MASK
BGL_LIGHT LIGHT_NAV, -0.025, 0.017, -0.000, 20, 0.60, 0.40, 0FFFF0000h, 0.000000, 0.000000, 1.000000 ; source poly num = 903
nolgt_3 label BGLCODE
BGL_FTAG "PAPI_1W01", 0.00 ; Node 9

; Node 9 - PAPI_1W01 transform:

BGL_SET_MATRIX_INDIRECT 17

IFMSK nolgt_4, dict_0_g_lightStates, LIGHT_NAV_MASK
BGL_LIGHT LIGHT_NAV, -0.025, 0.017, -0.000, 20, 0.60, 0.40, 0FFFDFDFDh, 0.000000, 0.000000, 1.000000 ; source poly num = 904
nolgt_4 label BGLCODE
BGL_FTAG "PAPI_1R02", 0.00 ; Node 12

; Node 12 - PAPI_1R02 transform:

BGL_SET_MATRIX_INDIRECT 18

IFMSK nolgt_5, dict_0_g_lightStates, LIGHT_NAV_MASK
BGL_LIGHT LIGHT_NAV, -0.025, 0.017, -0.000, 20, 0.60, 0.40, 0FFFF0000h, 0.000000, 0.000000, 1.000000 ; source poly num = 1805
nolgt_5 label BGLCODE
BGL_FTAG "PAPI_1W02", 0.00 ; Node 13

; Node 13 - PAPI_1W02 transform:

BGL_SET_MATRIX_INDIRECT 19

IFMSK nolgt_6, dict_0_g_lightStates, LIGHT_NAV_MASK
BGL_LIGHT LIGHT_NAV, -0.025, 0.017, -0.000, 20, 0.60, 0.40, 0FFFDFDFDh, 0.000000, 0.000000, 1.000000 ; source poly num = 1806
nolgt_6 label BGLCODE
BGL_FTAG "PAPI_1R03", 0.00 ; Node 16

; Node 16 - PAPI_1R03 transform:

BGL_SET_MATRIX_INDIRECT 20

IFMSK nolgt_7, dict_0_g_lightStates, LIGHT_NAV_MASK
BGL_LIGHT LIGHT_NAV, -0.025, 0.017, -0.000, 20, 0.60, 0.40, 0FFFF0000h, 0.000000, 0.000000, 1.000000 ; source poly num = 2707
nolgt_7 label BGLCODE
BGL_FTAG "PAPI_1W03", 0.00 ; Node 17

; Node 17 - PAPI_1W03 transform:

BGL_SET_MATRIX_INDIRECT 21

IFMSK nolgt_8, dict_0_g_lightStates, LIGHT_NAV_MASK
BGL_LIGHT LIGHT_NAV, -0.025, 0.017, -0.000, 20, 0.60, 0.40, 0FFFDFDFDh, 0.000000, 0.000000, 1.000000 ; source poly num = 2708
nolgt_8 label BGLCODE
BGL_RETURN

=============================

and here is my best guess at editing it per the tutorial:

==============================
PAPI_04_064_MasterScale_2 label BGLCODE


BGL_FTAG "MasterUnitConve", 0.00 ; Node 2

; Node 2 - MasterUnitConversion transform:
BGL_SET_MATRIX_INDIRECT 12

BGL_FTAG "RotateAroundX", 0.00 ; Node 3

; Node 3 - RotateAroundX transform:
BGL_SET_MATRIX_INDIRECT 13

BGL_ZBIAS 1

SEPARATION_PLANE WrongSide, -29300, 0, -14672, 32768
SEPARATION_PLANE below1, 1398, 32737, 297, 32768

BGL_FTAG "PAPI_1W", 0.00 ; Node 5

; Node 5 - PAPI_1W transform:
BGL_SET_MATRIX_INDIRECT 14

BGL_LIGHT LIGHT_NAV, -0.025, 0.017, -0.000, 20, 0.60, 0.40, 0FFFDFDFDh, 0.000000, 0.000000, 1.000000 ; source poly num = 13
BGL_JUMP_32 above1

below1 label BGLCODE
BGL_FTAG "PAPI_1R", 0.00 ; Node 6

; Node 6 - PAPI_1R transform:
BGL_SET_MATRIX_INDIRECT 15

BGL_LIGHT LIGHT_NAV, -0.025, 0.017, -0.000, 20, 0.60, 0.40, 0FFFF0000h, 0.000000, 0.000000, 1.000000 ; source poly num = 14

above1 label BGLCODE

SEPARATION_PLANE below2, 1448, 32728, 725, 32768
BGL_FTAG "PAPI_1R01", 0.00 ; Node 8

; Node 8 - PAPI_1R01 transform:
BGL_SET_MATRIX_INDIRECT 16

BGL_LIGHT LIGHT_NAV, -0.025, 0.017, -0.000, 20, 0.60, 0.40, 0FFFF0000h, 0.000000, 0.000000, 1.000000 ; source poly num = 903
BGL_JUMP_32 above2

below2 label BGLCODE
BGL_FTAG "PAPI_1W01", 0.00 ; Node 9

; Node 9 - PAPI_1W01 transform:
BGL_SET_MATRIX_INDIRECT 17

BGL_LIGHT LIGHT_NAV, -0.025, 0.017, -0.000, 20, 0.60, 0.40, 0FFFDFDFDh, 0.000000, 0.000000, 1.000000 ; source poly num = 904

above2 label BGLCODE

SEPARATION_PLANE below3, 1619, 32718, 811, 32768

BGL_FTAG "PAPI_1R02", 0.00 ; Node 12

; Node 12 - PAPI_1R02 transform:

BGL_SET_MATRIX_INDIRECT 18

BGL_LIGHT LIGHT_NAV, -0.025, 0.017, -0.000, 20, 0.60, 0.40, 0FFFF0000h, 0.000000, 0.000000, 1.000000 ; source poly num = 1805
BGL_JUMP_32 above3

below3 label BGLCODE
BGL_FTAG "PAPI_1W02", 0.00 ; Node 13

; Node 13 - PAPI_1W02 transform:

BGL_SET_MATRIX_INDIRECT 19

BGL_LIGHT LIGHT_NAV, -0.025, 0.017, -0.000, 20, 0.60, 0.40, 0FFFDFDFDh, 0.000000, 0.000000, 1.000000 ; source poly num = 1806

above3 label BGLCODE

SEPARATION_PLANE below4, 1789, 32707, 896, 32768

BGL_FTAG "PAPI_1R03", 0.00 ; Node 16

; Node 16 - PAPI_1R03 transform:

BGL_SET_MATRIX_INDIRECT 20

BGL_LIGHT LIGHT_NAV, -0.025, 0.017, -0.000, 20, 0.60, 0.40, 0FFFF0000h, 0.000000, 0.000000, 1.000000 ; source poly num = 2707
BGL_JUMP_32 above4

below4 label BGLCODE
BGL_FTAG "PAPI_1W03", 0.00 ; Node 17

; Node 17 - PAPI_1W03 transform:

BGL_SET_MATRIX_INDIRECT 21

BGL_LIGHT LIGHT_NAV, -0.025, 0.017, -0.000, 20, 0.60, 0.40, 0FFFDFDFDh, 0.000000, 0.000000, 1.000000 ; source poly num = 2708
above4 label BGLCODE

WrongSide label BGLCODE

BGL_RETURN
========================================

So, first I am not sure if I got that right.

Second, I don't have BGL9.exe so I copied FSX's BGLComp.exe and Bglcomp.xsd to the folder containing .mdl, .asm etc. and ran it in a DOS window at the same location. It did not create a .bgl file. Also I read somewhere else that I should run bglcomp for the .xml file and it came up with errors:



..and here I am stabbing in the dark... ref the error messages the .xsd file does appear to define 'name':

=================================
.....
<xs:group name="grpFSDataChildren">
<xs:choice>
<xs:element name="Airport" type="ctAirport" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Marker" type="ctMarker" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Waypoint" type="ctWaypoint" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Boundary" type="ctBoundary" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Vor" type="ctVor" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Ndb" type="ctNdb" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="SceneryObject" type="ctSceneryObject" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="ExtrusionBridge" type="ctExtrusionBridge" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="ModelData" type="ctModelData" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Geopol" type="ctGeopol" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="ExclusionRectangle" type="ctExclusionRectangle" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="Reward" type="ctReward" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="TimeZone" type="ctTimeZone" minOccurs="0" maxOccurs="unbounded" />
</xs:choice>
</xs:group>
.........
======================================

... if that means anything.

Can you tell me if you see anything wrong here?

thanks

klem
 
Last edited:

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Hi Klem,

Go back to your modelling tool and export the object again. There is a lot of useless debugging code in your ASM code now.

Which tool did you use (I guess FSDS)? You need to make sure that optimize in MakeMDL is turned on.

If you are using FSDS better save the X file and ran it through MakeMDL manually.
 
Hi arno, thanks for the quick reply.

I exported from Gmax after running FS2004-gmax, i.e. gmax from the shortcut in the FS2004 gamepack with the config file set as KeepFiles = 1.

That gave me the _0.asm file I listed first in my previous post.

I can't find MakeMdl under my gmax folders including the gamepacks or under Microsoft Flight Simulator X folders or under Microsoft Flight Simulator X SDK folders.

As you can tell I am still at the bottom of the learning curve :eek:

klem
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Hi Klem,

If you are exporting with the FS2004 gamepack from GMax than the default settings should never give you code like this. Are you sure you only added the "Keep=1" line or are there more settings in your makemdl.cfg file?
 
Hi arno,

yes I had other lines in there (I still had all the lines in PakMac's file). I left only Keep=1 in and it cleaned it up. Unfortunately the .asm file won't compile per the PAPI Tutorial.

Using BGLC_9.exe I get fatal eror 'cannot open file PAPI_04_064.asm' (which is in the compiler directory along with all the other exported files including the edited _0.asm).

Using FSX's BGComp (all mdl asm xml files present there too), I get 'XML Parse fatal error....ERROR 1,1, Incorrect document syntax' (I can't see anything wrong having read the Compiler help file). Here is the xml file:
=====================================================
<?xml version="1.0" encoding="ISO-8859-1"?>
<FSData version="9.0" xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation="bglcomp.xsd">

<!-- Sample object placement. Remove comment markers to place object east of 34R at Sea Tac. -->
<!--
<SceneryObject lat="47 25.89" lon="-122 18.43" alt="0" pitch="0" bank="0" heading="0" altitudeIsAgl="TRUE" imageComplexity="NORMAL">
<LibraryObject name="E301DCC5407BF32A76575DAE8041BC55" scale="1.0" />
</SceneryObject>

-->

<!-- Inclusion of model data. Use the 'Name' of this object to place -->
<!-- it in other locations. -->
<ModelData name="E301DCC5407BF32A76575DAE8041BC55" sourceFile="PAPI_04_064.mdl" />
</FSData>
=======================================

by the way I read about the new GUIDs and can get the generator but at what stage do I use it and does it really not matter what GUID is generated (thinking of conflicts)?

thanks again

klem
 

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Hi,

Using BGLC_9.exe I get fatal eror 'cannot open file PAPI_04_064.asm' (which is in the compiler directory along with all the other exported files including the edited _0.asm).
By default the full path to the _0.asm file is in the main asm file. That means if you copy it to another folder, you will have to remove the path.

Using FSX's BGComp (all mdl asm xml files present there too), I get 'XML Parse fatal error....ERROR 1,1, Incorrect document syntax' (I can't see anything wrong having read the Compiler help file). Here is the xml file:
That's a FS2004 XML file, not one for FSX. So you need to use the Fs2004 BGLComp on it (the tweaked MDL is also a FS2004 MDL).

by the way I read about the new GUIDs and can get the generator but at what stage do I use it and does it really not matter what GUID is generated (thinking of conflicts)?
The new GUID format is for FSX only. For FS2004 it is safe to use the one GMax generated in the dummy XML file.
 
ok, getting there.

I have created CompilerFS9 and CompilerFSX folders under Add On Scenery and each contain their appropriate compiler files.

I moved my Gmax files to the CompilerFS9 folder and I edited the _0.asm path in .asm and created the .bgl successfully. I renamed the .bgl file to .mdl.

I have run Library Creator ver 2.02, set the path to the FS9 and FSX Compiler folders, created a klemFS9_lib.xml library in Add On Scenery, added my PAPI_04_064.mdl file from where it sits in the CompilerFS9 folder, saved the library and run File.... Compile Library BGL.

I get the following error message :(

EDIT: repasted the following file after double checking the above.

=========================
Microsoft (R) Flight Simulator BGL Compiler Version 8.00
Copyright (C) Microsoft Corp 1981-2002. All rights reserved.

Assembling: library_creator_xml_temp_compile.azm
library_creator_xml_temp_compile.xml(1) : error A2008: syntax error : FSData version="9.0" xsi:noNamespaceSchemaLocation="bglcomp.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
library_creator_xml_temp_compile.xml(2) : error A2008: syntax error : ModelData sourceFile="CompilerFS9\PAPI_04_064.mdl" name="DD6EDF460FF50D47BF6C45543AEFABFB" /
library_creator_xml_temp_compile.xml(3) : error A2008: syntax error : /FSData

===============================

here's my Library klemFS9.xml

===============================
<FSData version="9.0" xsi:noNamespaceSchemaLocation="bglcomp.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ModelData sourceFile="CompilerFS9\PAPI_04_064.mdl" name="DD6EDF460FF50D47BF6C45543AEFABFB" />
</FSData>
==============================

here's my Library Creator .xml

===============================
<Configuration>
<lastXML>C:\Program Files\Microsoft Games\Microsoft Flight Simulator X\Addon Scenery\klemFS9.xml</lastXML>
<bglCompPath4>C:\Program Files\Microsoft Games\Microsoft Flight Simulator X\Addon Scenery\CompilerFS9\BGLC_9.exe</bglCompPath4>
<bglCompPathX>C:\Program Files\Microsoft Games\Microsoft Flight Simulator X\Addon Scenery\CompilerFSX\BglComp.exe</bglCompPathX>
<relativePath>TRUE</relativePath>
<lastMDL>C:\Program Files\Microsoft Games\Microsoft Flight Simulator X\Addon Scenery\CompilerFS9\PAPI_04_064.mdl</lastMDL>
<bglFile xmlFile="C:\Program Files\Microsoft Games\Microsoft Flight Simulator X\Addon Scenery\klemFS9.xml">C:\Program Files\Microsoft Games\Microsoft Flight Simulator X\Addon Scenery\klemFS9.bgl</bglFile>
</Configuration>
=============================

Tried putting the library in the compiler folder and the .mdl file in the compiler and the Add On Scenery folders - same result.

Heeeeelp :)

klem
 
Last edited:

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Hi,

Sounds like something wrong with the XML file. Did you let Library Creator XML create it for you? Just create a new file and then add your MDL file to it. Then the code should be OK. That is better than loading your own XML that might contain some bugs already.
 
Hi arno,

I didn't write the .xml myself (are you crazy? :D ), I let the creator do it. I have run it through again with the same result. I made sure that the .mdl file was alone in the folder I took it from for the Library Creator (in case there was some conflict with it's old .xml)


Similar error to my earlier thread although the log seems to cut short the 'name':
=======================================
Microsoft (R) Flight Simulator BGL Compiler Version 8.00
Copyright (C) Microsoft Corp 1981-2002. All rights reserved.

Assembling: library_creator_xml_temp_compile.azm
library_creator_xml_temp_compile.xml(1) : error A2008: syntax error : FSData version="9.0" xsi:noNamespaceSchemaLocation="bglcomp.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
library_creator_xml_temp_compile.xml(2) : error A2071: initializer magnitude too large for specified size
library_creator_xml_temp_compile.xml(2) : error A2008: syntax error : ModelData sourceFile="C:\Program Files\Microsoft Games\Microsoft Flight Simulator X\Addon Scenery\CompilerFS9\PAPI_04_064.mdl" name="43CF5AF
library_creator_xml_temp_compile.xml(3) : error A2008: syntax error : /FSData
===============================

Should I worry that Library Creator asks for the path to FS2004 BGLComp.exe and I am using BGLC_9.exe ? It was the only FS2004 compiler I could find.

I am worried because the Library.xml reads:
<FSData version="9.0" xsi:noNamespaceSchemaLocation="bglcomp.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ModelData sourceFile="C:\Program Files\Microsoft Games\Microsoft Flight Simulator X\Addon Scenery\CompilerFS9\PAPI_04_064.mdl" name="43CF5AF86260E54E8D841B33498F8EE9" />
</FSData>

Note the reference to bglcomp.xsd which didn't come with BGLC_9.exe (unlike FSX's BglComp.exe)


klem
 
Last edited:

arno

Administrator
Staff member
FSDevConf team
Resource contributor
Hi,

Should I worry that Library Creator asks for the path to FS2004 BGLComp.exe and I am using BGLC_9.exe ? It was the only FS2004 compiler I could find.
Yes, that's it :). BGLC_9 is to compile ASM files to MDL. You need to use BGLComp to compile the XML to BGL. These two tools are not the same!
 
Thanks arno,

I have now found fs2004_sdk_bglcomp2_setup.exe and will install that tonight.

I'm thinking of writing a book on my experiences of creating objects for FSX. It will probably never be printed because of the number of trees it would use. :) Actually I will summarise this all for my own use in future.

I don't want to tempt fate but it looks as though I am on the last leg of the trail now. I'd like to thank you, PakMac, Scruffyduck and all the others for your patience.

klem
 
Sorry to retuirn to this. I have created the PAPI 4 light system (named PAPI_04_064)and basically it works. Still not sutre the elevation planes are correct (been using the excel spreadsheet generator) but I will play with that.

2 questions:

1. The boxes appear as black although they are red in gmax. I am using FS2004-Gmax and there were no SF2004 export options to select colour or material for export so I assume they are automatic and the export options are only in FSX-Gmax. Any idea why they come out black (I've exported the .mdl, edited elevation planes, BGLC9'd a new .mdl, imported to my FS2004lib and compiled it, all twice, no change). Similar thing with no options for setting GUID and Friendly name, is that right?

2. When I attach my library FS2004lib.bgl to ADE the contents (only the PAPI_04_064) shows as FS2004lib.bgl_001 not PAPI_04_064. Is that what I should expect? It places and shows ok.

Thanks for your help,

klem
 
Top