• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

FS2004 Object Libraries

Messages
537
Country
canada
Hi, All

This is an old thing, but please induldge me.

Using Abacus' FS Action! Scenery demo I created a fuel truck going around a rectangle. Actually, I can make it go anywhere. For the "path" (as FS Action! calls the track of the vehicle), I created a video in FS2000.

I installed the resulting bgl in my FS2004 and, to my surprise, there was the fuel truck going around.

I then changed the fuel truck to a sail boat, and the sail boat appears in my FS2004 going around the apron.

I then de-compiled both bgl file with Bglanalyze to look at the sca (yes, I know, that is going way back), and found the only difference between the two was in the "Pattern( blah, blah blah ), where one number was different. from 0FE10 (truck) to 0FE0F (boat).

Now... these are objects from a FS95(!!!) library. As far as I know I didin't install such library in my FS2004. I looked at all the added scenery I have, and I couldn't find anything that looked like a FS95 or FS98 library.

So... My question is:

Does anyone know whether FS2004 carries those objects in its guts, and what is the name of the library file?

Many Thanks,

Fern
 
I have found a fuel truck in generic.bgl which is in ..\Scenery\Generic\scenery, plus some boats in ..\Scenery\Vehicles\Vehicles.bgl

If you have ADE9x installed, look in the FS9\Thumbs folder.

David
 
Dynamic Library

Hi, Dave and all

I think I found it, it is DYNLIB.bgl, which IS in the FS 2004, and it is still in its early SCASM form.

All I have to do now is to see if I can add objects to it.

I know, I know, FSX already has vehicles, but I am deeply intrigued by "Dynamic Scenery".

Thanks, I will probably have a couple of other questions on this subject soon.

Fern
 
Library - API macro objects

OK, a change in the question.

How can I make a library of API macro objects?

I have Library Creator, but that is for xml. I looked for a API macro library creator and couldn't find one. Any hints?

Thanks very much.

Fern
 
Hi Fern.

Dynamic object libraries can be made fairly easily with SCASM:

Code:
Header( 1  N90.0 S90.0 E179.9999 W179.9999 )
LatRange(  S90.0  N90.0 )

ObjID( 00C2CDA9 A9E100AA 596711D0 B1A18300 )
LibObj( 
	[COLOR="SeaGreen"]PWR   100
	SIZE  0
	SCALE 1024.000
	TYPE  2[/COLOR]
	NAME   "mc519_dyn"	)
	[COLOR="RoyalBlue"]Include[/COLOR]( veh_mc519[COLOR="Red"]_0[/COLOR].sca )
EndObj

You could make a library with 2 objects:

Code:
Header( 1  N90.0 S90.0 E179.9999 W179.9999 )
LatRange(  S90.0  N90.0 )

ObjID( 00C2CDA9 A9E100AA 596711D0 B1A18300 )
LibObj( 
	PWR   100
	SIZE  0
	SCALE 1024.000
	TYPE  2
	NAME   "mc519_dyn"	)
	Include( veh_mc519_0.sca )
EndObj

ObjID( 0D88AB2FE 4C075073 466C5C8E 0B586A5E1 )
LibObj( 
	PWR   100
	SIZE  0
	SCALE 1024.000
	TYPE  2
	NAME   "mc250_dyn"	)
	Include( veh_mc250_0.sca )
EndObj

Scasm docs say leave the power, size, scale and type as above.

The only changes between objects are the GUID number ( you need to generate one, and SCASM wants a zero leading the hex letters to designate them as numbers ). And, of course, the model data needs to be different... I use a separate SCASM file to hold the model data and 'include' it.

You can use a GUID generator to choose a GUID number.

To get the model data, I use some trickery.

Gmax produces an .asm file and a _0.asm file for FS2002 code.

You can also use Arno's ModelConverterX to produce an .x file that can be dropped onto FS2002 MakeMDL to also make an .asm and _0.asm file set.

In the above example, I used a CFS2 vehicle library in ModelConverterX, choose a vehicle, exported the veh_mc519.x file, and dropped that file onto FS2002's MakeMDL to get the veh_mc519.asm and the veh_mc519_0.asm files. The veh_mc519_0.asm is the one I want.

I then dropped the veh_mc519_0.asm onto BGLC_9 and got veh_mc519_0.mdl, and changed the extension to get veh_mc519_0.bgl.

This is a 'raw' model file, and I want to include this in my SCASM library. To do this, I need to convert the binary data into a format that SCASM can read. I use a .NET program "raw2sca.exe" to do this, by dropping the veh_mc519_0.bgl file onto raw2sca. This gives me the SCASM file "veh_mc519_0.sca" that is 'included' in the first dynamic library code example.

_0.asm -> _0.mdl -> _0.bgl ->_0.sca

It reads much harder than it is...

The first example I named MyDynLibrary.sca, and it produces MyDynLibrary.bgl when compiled with SCASM. And I believe it's a 'real' dynamic object.

If you try this process, let me know if it works to make library objects for you.

raw2sca.zip

EDITED++++++++++

In the above code, I don't know why SCASM docs say to leave the SCALE as 1024... I should think it would be SCALE 0.5 to account for the scale of the included _0 data. So you might need to change that.

ALSO:

Check out the Wiki article:

Dynamic_object_creation

Dick
 
Last edited:
Library creation

Hi, Dick

Thanks for the hints. I know I am very close, please be patient.

Did everything you said, step by step and was almost successful, except for the very ending, the SCASM compiling. Let me explain: (and thanks for your patience and help)

1. Did the API to .x with Arno's Model Converter X 1.2, importing the API and exporting as .x (for FSX?!), and it worked.

2. Dropped the ffffff.x (let me call it that for this discussion) onto mkmdl.exe (I have mdl commander, but I know that the original is renamed "mkmdl.exe"), Options to keep files, and generated the ffffff.asm, ffffff_0.asm and ffffff.mdl.

3. Dropped ffffff_o.asm onto BGLC_9, AND THIS PRODUCED A BGL, NOT AN MDL LIKE YOU MENTIONED, BUT IT WAS JUST A MATTER OF CHANGING THE EXTENSION, SO I DIDN'T WORRY. Besides, it continued to work from there.

4. Got "raw2sca.exe" from the link you gave, dropped my ffffff_0.bgl onto it, and it GAVE ME the ffffff_0.sca.

Here I have to guess a little to do the next step.

5. First, I looked into my fffff_0.sca and found it rather not like the sca of an API macro, it is a long list of entries. But there is more about this a bit further down.

6. Then I copied your example of library, changed the name of the object and the name of the file, and left the same GUID because I wasn't worried about that part, not yet.

7. I wasn't sure about the part

Include( veh_mc519_0.sca )

, so I left it like that (with the file name replaced, of course), and placed the ffffff_0.sca and the this file of yours in the SCASM folder.

8. Now it gets no-good. I dropped my library file onto SCASM.exe and it did generate the bgl, but with only a few bites. I suspected something was wrong and de-compiled the bgl to find that the

Include( ffffff_0.sca )

was there untouched, nothing "included", certainly not the sca containing my object.

So, I went back to the folder where I placed raw2sca, because I saw some of your files in there. One of them was your object.sca. I opened it with Notepad and it was a long list of Dbx followed by (xxx). I looked at my object and it looked pretty much the same, except that was longer.

9. I, then, copied your two files

MyDynLibrary.sca and veh_mc519_0.sca

into my SCASM 2.96 folder, dropped the MyDynLibrary.sca on top of scasm.exe, and it didn't generate a proper library either, only a 1 K deal.

Please read the next step.

10 I then de-compiled the MyDynLibrary.BGL that is in the RawtoSca folder, and it is perfect.

SO...

If I manage to generat the object sca from raw2sca and I am using your library sca with the proper name file inside de ( file_name_here.sca), do you have any idea why SCASM isn't generating a proper library?

Am I missing a step between the raw2sca and the scasm compilation?

(By the way, I tried both using BGLC_9.exe and BGLC.exe with identical sca files resulting for the object.)

Thanks, Dick

Fern
 
Last step seems missing

Hi, Dick

Well, I revewed all my steps and I am pretty sure I understood what you were trying to do and that I did everything correctly.

Right at the end is where it misfires.

I get the two files (my library and my raw-to-sca macro).

Then I place both inside my SCASM folder, drop the library onto scasm.exe, it does generate a bgl, but it is "empty", no macro.

I am attaching a zip with my library (never mind the GUID, for now), and the result of the raw2sca with the macro (via Arno's Converter) if you want to have a look.

Help!

Thanks

Fern
 

Attachments

SCASM doesn't like drag'n'drop.

I right-click on 'Library01.sca', and select 'Open With', and then find a SCASM location and choose it. That should compile the file without opening a DOS window, and having to type it in by hand.

Dick
 
Compiling the library

Hi, Dick

I knew that, and actually I have compiled a few times, not only mine but yours, too. It compiles without a "problem", that isn't the issue.

The issue I am having is that, even though it compiles, it generates an "empy" library, and it doesn't consider the object at all, the "TruckHighway_0.sca", that I created using the method you described.

I sent the zip so you could have a look at what that TruckHighway_0.sca" looks like, and it doesn't look anything like a macro object... And, by the way, neither does your object, veh_mc519_0.sca, which is also a long list of "Dbx" lines.

Also, do you know anything about DOD, Dynamic Object Designer, a freeware tool?

Thanks.

Fern
 
Last edited:
Hi Fern.

When using raw2sca, what you are doing is translating each byte of a bgl to Dbx() statements. The title raw2sca, reminds me to only translate the compiled _0.asm, as it's to be 'included' into a SCASM Library framework.

_0.asm -> _0.bgl ( the raw, headerless BGL file ), ->_0.sca

++++++++++++++++++

Here's 2 objects in a SCASM Dynamic Library:

escndyno.png


Code:
Header( 1 90 -90 -180 180 )
LatRange( S90 N90 )

;First Object
ObjId( DD0000B0 0AB345AE A9000000 00000D33 ) 
LibObj( PWR 100 SIZE 0 SCALE [COLOR="Red"]1024[/COLOR] TYPE [COLOR="Red"]2[/COLOR] NAME "RedBall" ) 
ShadowPosInd( 0 )
ReScale( :_ShadowFail_RedBall 0 0 [COLOR="Red"]0.5[/COLOR] )
ShadowCallVI( :_Draw_RedBall 18 )
:_ShadowFail_RedBall
RefPoint( nsi :_Fail_RedBall 0 )
ReScale( :_Fail_RedBall 0 0 [COLOR="Red"]0.5[/COLOR] )
PBHCall( :_Draw_RedBall 18 )
SetVar(  2C 25 )
:_Fail_RedBall
Return
:_Draw_RedBall
Include( RedBall_0.sca )
EndObj

;Second Object
ObjId( DD0000B1 0AB345AE A9000000 00000D33 ) 
LibObj( PWR 100 SIZE 0 SCALE [COLOR="Red"]1024[/COLOR] TYPE [COLOR="Red"]2[/COLOR] NAME "veh_mc519" ) 
ShadowPosInd( 0 )
ReScale( :_ShadowFail_veh_mc519 0 0 [COLOR="Red"]0.5[/COLOR] )
ShadowCallVI( :_Draw_veh_mc519 18 )
:_ShadowFail_veh_mc519
RefPoint( nsi :_Fail_veh_mc519 0 )
ReScale( :_Fail_veh_mc519 0 0 [COLOR="Red"]0.5[/COLOR] )
PBHCall( :_Draw_veh_mc519 18 )
SetVar(  2C 25 )
:_Fail_veh_mc519
Return
:_Draw_veh_mc519
Include( veh_mc519_0.sca )
EndObj

;refpoint = base - 1.95 meters

Here's how I placed them at ESCN:

Code:
Set( Area15mx 32 )
Header( 1  N59:12:41  N59:07:18  E018:00:15   E017:49:44  )
LatRange( N59:07:18 N59:12:41 )

; Dynamic Scenery section

Area15(  N59:12:41  N59:07:18  E018:00:15   E017:49:44 )
LatRef( N59:10 )
    
	CallDLibObj( :DYN01 3 3 DD0000B0 0AB345AE A9000000 00000D33  )
	CallDLibObj( :DYN02 3 3 DD0000B1 0AB345AE A9000000 00000D33  )
Exit

:DYN01   ;
          SetPos( 59.1819863712876 17.9191718173713 53.9453125  )
          Heading( 243.6614  )
          ACS( 1 )  ; crash control= OFF
          Hold ( 5 )
          Sleep

:DYN02   ;
          SetPos( 59.1823315066744 17.9199408767334 53.9453125  )
          Heading( 243.6614  )
          ACS( 1 )  ; crash control= OFF
          Hold ( 5 )
          Sleep
          
End15



Set ( Logfile 1 )

++++++++++++++++++++++++++++++++++++

There are 2 decent paths to getting the _0.asm file for use with raw2sca:

Use the FS2002 Gmax.
Use Arno's ModelConverterX.

In some respects, it's just easier to use ModelConverterX, as it will allow you to use his Transform Object / Move Object button to move the object -1.95 meters in the z axis. That will place the object on the ground ( assuming the old refpoint was the base of the object ). This is due to an error in the Dynamic Scenery code within the sim that floats the objects in the air.

You can export the x file, then drop it onto FS2002 MakeMDL, and ( by selecting the Keep Files under the Options tab ) save the asm files. Then use raw2sca to eventually get a Library file.

In the above code, note the ReScale has 0.5 in it, which is the FS2002 MakeMDL default for scaling. The Library header uses SCALE 1024, and TYPE 2 for all Dynamic objects.

I used TCalc2004 to find lat, long and elevations for the placement. The big ball is made in Gmax, and the army vehicle is from CFS2 veh.bgl, and x-files by ModelConverterX.

You may notice I am avoiding using a BGL decompiler. Much better to use ModelConverterX, and then get the ASM code via MakeMDL. Arno's done a great job with ModelConverterX's decompilation, and it's geared towards object modeling.

BGLAnalyze and SCDIS both can introduce errors in code. If ModelConverterX has errors, it won't decompile the object at all, so no errors are passed on, and it's x file output, when run through FS2002 MakeMDL to get an asm file, will always have the 0.5 scale.

Dick
 
Last edited:
Library doesn't form

Hi, Dick

Thanks very much. Unfortunately, it didn't help. I followed your first set of instruction to the letter several times, taking care to make sure I wasn't just repeating the same mistake, in case I was making one.

Actually, I printed your instructions and went step by step, so I wouldn't have to change screens.

I did use Arno's ModelConverterX, and all looked good all the way to the raw2sca. It did crate the sca file. But when I compile that with SCASM, the library that it forms (it does generate a bgl) has nothing in it.

Can't win them all.

Thanks

Fern
 
Well...

I compiled your Library01.sca ( which 'includes' the TruckHighway_0.sca Dbx statements), and it compiled OK. You can't drag'n'drop SCA files. Use a DOS command line, or make a batch file:

Scasm Library01.sca

The end result is a file size of 41KB.

Dick
 
Compiling my sca file

Gee, Dick

I just tried to compile my TruckHighway_0.sca again with SCASM 2.96, using the DOS command, it compiles with 0 (zero) errors and still produces an empty bgl...

I also tried the other SCASM versions I have, same result.

It did give me a warning, saying

Warning! No header command in source file!

Then

Status compilation status: error(s) 0

I checked yours (vehh_mc519_0.sca) and it doesn't have a header either.

Any more hints?

Thanks!

Fern
 
You don't want to compile TruckHighway_0.sca

You want to compile Library01.sca.

Make sure Library01.sca and TruckHighway_0.sca are in the same windows folder as scasm, and compile Library01.sca. Library01.sca includes the binary data (TruckHighway_0.sca) needed to build the object. It combines the sca files into a Library BGL.

Dick
 
Library worked

I'll be darned. It worked, Dick!

Thanks for that one, painful for you as it was, hahahahahahahaha. Sorry about that.

Now, for the next step.

The objects in other libraries that work as dynamic objects look rather ordinary, worse than the stuff I create. So...

Do you know what is special about dynamic objects?

Thanks

Fern
 
Back
Top