View Full Version : Creating a library BGL
I'm familiar with using FSRegen to create a library bgl containing several objects which are called by API macros FSRegen creates for each object which you then place in your scenery design program.
But I'm a little confused as to how this works with XML/MDL objects. I can create a library BGL with Library Creator XML, but how do you call the individual objects within the library from your design program?
Sorry, but I'm being a bit think here (probably) :confused:
19 Jul 2006, 10:58
Individual objects are called using XML code. There is a piece of code used to define things like co-ordinates, scale, heading etc. This is compiled into a bgl library using bglcomp. You can do this by hand but if you have a lot of objects then it is easier to use a scenery design program to do the hard work of generating the xml and compiling it. There are a lot of programs which can do that - Object Placer XML from here, RWY12, SBuilder or Scenery Maker. If you have used Library Creator then I would suggest using Object Placer XML as your starting point if your current scenery design program can't handle mdl based objects. FSSC and Airport for Windows 2.60 can't, but SceneGenX can along with the programs I have mentioned above which are all freeware.
Thanks for the reply, but I'm an idiot :o
My scenery design program (FSArchitect) does allow me to place mdls, and of course it compiles the whole thing down to a single BGL. Therefore I don't need a seperate library bgl to call my cars from.
I have no idea what I was thinking.
19 Jul 2006, 15:14
Well the odd memory lapse is allowed :)
Sometimes it is better to use a seperate object library. Because when you combine the MDL file and the placement in the same BGL file, the objects become geo-locked. That means that you can not place them at others parts of the world. So for more general objects, it is better to put the MDL objects in a library and only call the GUID of the object in the other file.
Thanks Arno and Scruffyduck,
I was going to come back to this topic because I wasn't really sure if I'd come up with the right solution myself.
To be quite honest, I again seem to have an understanding gap.
With FSRegen I import the .asm files (say 10 of them) and output one .asm and 10 small APIs. The single .asm is compiled into a library BGL using BGLCOMP and, in my scenery design progam i place macro objects to which i assign on of the APIs; a bus, a car etc. So, when I'm done I have a BGL compiled by my scenery design program for the main objects and another that FSRegen created containing my library of cars.
I still don't really understand how this is done with XML (sorry). What exactly does Object Placer XML do? If I understand right, I allocate a library I've previously created using Lib Creator XML and then start up FS with FSUIPC installed to position the objects. But what does Object placer XML output, another XML file?, seperate XML files for each object?, a BGL? And what do you do with this file once its created, can, for example, SceneGenX use it to position library objects as I descibed above, or can't this be done with the XML/MDL format?
Thanks in advance.
23 Jul 2006, 11:20
I am sure that Arno can give a better reply than I, but here goes.
A program like Library Creator takes a set of mdl files - these contain the actual code to create and display the object - they are not created using xml. To create a library of objects you need tol generate some xml - you can do it by hand but something like LC makes it a lot easier. This code uses a particular xml definition (ModelData) which stores a unique ID for the object (GUID), and the name of the mdl sourcefile. A bit of xml is generated for each mdl file you are adding. Compile this xml with bglcomp.exe (which is the compiler used for this and for scenery object placement) and you get a library file which contains the ID and also the actual mdl data as well.
To place these objects you still use xml code but it is a different 'Element'. This one is called a SceneryObject. This time the xml contains the information about object placement - i.e lat/lon/altitude and other stuff such as pitch and bank (if you want the object tilted). It also contains a reference to the object - this time it is the GUID and the scale that you want the object to appear. Again you can create a single xml source file with lots of objects and it is again compiles with bglcomp. This time though you get a scenery bgl file and that is used by FS to display the objects where and how you want them to. Object Placer XML does this to save you writing the code by hand.
Now when FS runs it reads the placement data and uses the GUID to find the object in the library and display it for you.
The two files are both bgl files and you can't tell them apart unless you look inside them and understand the file formats.
Finally you can combine the two elements - for example put the object (using ModelData xml code) and the placement (using SceneryObject xml code) in the same file. The effect of this is that you get one bgl file containing the placement and object. In this case you can get a geographically fixed object that can only appear in one place - there are quite a few of these in the MS default libraries.
Geo-locked objects are often created directly using GMax or FSDS3.
Dunno if that helps or makes it worse :)
We are talking about two different techniques here that work about the same.
You are talking about FsRegen and API macros. This is the Fs2002 way of making an object library out of GMax objects. As you describe you load the ASM files into FsRegen and it creates a new ASM for you that can be compiled into a library BGL file. (Btw, this is done with BGLC not with BGLComp). FsRegen can then create API macros for you that call the objects using their GUID (this is an unique indentification number for the object). You can then use these API macros in normal design programs. So in the end you have two BGL files, one for your library and one that does the placement.
What Jon and I have been describing is the Fs2004 way of doing it. API macros are gone, as the object placement is now done with XML code. From GMax you get the MDL files for the object and these are compiled into a library BGL file using a XML source file. Then you need to place the objects as well, this is done with a different XML file, that calls the GUIDs of the objects, like the old API macros also did. This XML file is compiled into a second BGL file again, for the placement.
The tools we mention are mainly GUI's to create the XML file for you. Library Creator XML for example makes it easier to make the object library, while ObPlacer makes it easier to create the XML placement file.
If the project you are working on is mix of old (API) and new style (XML) objects, it is also possible to let Library Creator XML generate some API macros that call the objects from the XML style library. But in general it is prefered to use the XML code for the placement as well.
I hope this makes it a little more clear,
Thanks a lot both of you,
Yes thats a lot clearer Arno, I think I know where I'm going with this now.
I'll let you know when i've done some experimenting, which i supose is the best way to figure things out in the end.
Thanks again for taking the time to explain it.
vBulletin® v3.8.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.