Generic Buildings

In early 2002, Microsoft released the SpecialEffects SDK. Included with the file that you can download from here, was a small utility named BGLPlacer which allows you to place not only effects, but stock library objects, windsocks and generic buildings. While there was plenty of information and examples reguarding the effects, there were no instructions in the SDK explaining how to use really the other features of BGLPlacer. Finally with the release of the FS2004 BGLComp SDK there are some clues. We now have a list of the Generic Building Textures and the codes. The list was released as an Excel spreadsheet, so those of us that have Excel can open it. If you don't have Excel, well I guess you are just SOL. So I decided I'd fix that situation with an HTML version and a comma delimited version so if you don't have Excel, you can have the information. The information in the spreadsheet gives the texture codes, fallback colors, day and night textures that are used and some comments. I will attempt to explain how to use the BGLPlacer tool to build generic buildings.

The texture images are located in your sims main texture directory. They all seem to be standard 8 bit bmp files so you can actually view them in Windows Explorer. They range in size from 128 x 128 to 32 x32 pixels. With the exception of the roof textures, they are "grouped" using a prefix that indicates the type of building, then either _tb_ for top and bottom or _w_ to indicate a window texture. Most have _lm versions for night time. The first thing you need to understand is how MS has divided things up. If you examine the spreadsheet you will see the codes in the first column. I believe that either embedded in the sim engine itself or some other file is a table that defines what the codes mean and how the images are cropped and mapped. The image below show how one of the sky_tb textures is divided up. The comments left and right seem misleading to me, I would have use lower half and upper half myself.

The first thing to do is open the sim and get a lat. and lon. for a place to place the building. I am going to us N35 W118 as it is fairly bare there. Jot them down. Exit the sim and open BGLPlacer. Next click on the Browse button and navigate to a working directory where you can save your soon to be made source csv file. Make it a reasonable name. I have this one named generic_bldgs.csv for this tutorial. Be sure you have BGLComp.exe either in this same directory or in a directory that is in your search path environment variable like C:\Windows or C:\Winnt. Next click on the Type drop down and select BUILDING. I enter my coords in the Lattitude box as N35* 0.0000 and the Longitude as W118* 0.0000. Besure you enter it in in this format of degrees and decimal minutes. Leave the other setting alone and set the Density setting to Very Sparse. Now for the Parameters section.

An aside here...if you do some checking on the construction of buildings in the real world, you will find that generally there is between 3 and 4 meters per floor or just under 10ft. to 13ft. Many have raised flooring and dropped ceilings to accomodate utilities such as electrical, plumbing, heating and air conditioning so the actual appearence, when you are in the building does not feel like there is so much space between the floors. It depends a lot on the age of the building, what its originally design purpose was and its location geographically as well as local building codes and restrictions. The same is true for homes. More modern and well insulated homes tend to have the 8 ft standard ceiling height. Older homes, before the days of airconditioning. might have 10 or 12 ft ceilings allowing the heat to rise above the living zone in the hot summer months. Heating was a bear in the winter, but you did have a furnace and could always put on more clothes but unless you were a nudist, most people would only shead just so much clothing. If you are interested in home styles, here is a good start. Back to the project at hand....

Set the SIZE_X=12

Set the SIZE_Y=12

Set the BOT_SIZE_Y=3

These two settings detirmine the Width and Depth of the building and must be in meters and fractional parts are not allowed. I am using these sizes to keep the building in scale with the texture. Since the first floor part of the image is 128 on the X axis and 32 pixels high, and I want my floor height to be 3 meters, the ratio is 4:1. (I have made a duplicate model in gMax for demonstration purposes.)

Next set the BOT_TEX=68

This is where you use the Generic Buildings Texture list as it has the codes.

Set the BOT_TEX_X= 256

Set the BOT_TEX_Z=12

This detirmines how much of the texture is applied across the front/back and back along the sides. If you put in 256 for the BOT_TEX_Z value then the side will look just like the front and in my opinion that just doesn't look right most of the time. Very few buildings look the same on all four sides at street level.

Here is how I figured out my value of 12. I opened the texture image in my image editing software and measured the distance of the solid piece of the wall at the left edge of the texture. This turned out to be 6 pixels wide, so since the full width setting would be 256 and the actual image is 128 pixels wide, then a setting of 12 uses those actual measured 6 pixels.


Next comes the window section.

Set the WIN_SIZE_Y=9

This is the height of the window section in meter and I am making it 3 floors so
3 x 3 = 9.

Set the WIN_TEX=48

Again the code from the list.

Set the WIN_TEX_X=256

Set the WIN_TEX_Y=192

Set the WIN_TEX_Z=256

The actual texture image I am using here has 4 rows of window in 4 columns. But I only need 3 rows for my 3 stories. So instead of using the full image I am cropping it in a way by using the value of 192. See? 0.75 x 256 = 192

For the top level.

Set the TOP_SIZE_Y=3

Set the TOP_TEX=68

Set the TOP_TEX_X=256

Set the TOP_TEX_Z=256

This works just like the bottom level except I am applying the full texture width to BOTH the front/back and sides.

Now for the roof.

Set the ROOF_SIZE_Y=0

Set the ROOF_TEX=25

Set the ROOF_TEX_X=256

Set the ROOF_TEX_Y=0

Set the ROOF_TEX_Z=256

You can make peaked roofs by changing the ROOF_SIZE_Y= setting. I haven't messed with that myself other than by mistake first time around and ended up the a pyrimid looking roof that I didn't care for at all..

Now click on the Add button and you should get a message that the object was successfully added.

Continue adding buildings if you have more coords for them by just changing the Parameters, changing texture codes and so on. If you make the building twice the width, SIZE_X=24, you would "tile" the texture by changing the BOT_TEX_X=256 to BOT_TEX_X=512.

To make the bgl file. you exit BGLPlacer and if you have BGLComp.exe in your working directory, simply drag and drop your csv file onto BGLComp.exe and it will spit the bgl file out with the same name as your source csv. If you put BGLComp.exe in your C:\Windows or C:\Winnt directory, simply open a command prompt window in the working folder and type at the prompt:

BGLComp.exe generic_bldgs.csv

Of course change the file name to what ever you named yours.

If you are going to be messing with it a lot, make yourself a batch file using notepad with the following in it

BGLComp.exe generic_bldgs.csv


then save it as something like compile_generic_bldgs.bat then when you to compile again, just double click on the batch file.

Once you have the bgl file made copy or move it to your Addon Scenery\Scenery directory and fire up the sim and check it out.

You can hand edit the the csv file using notepad, it is just a simple text file with fields that are separated by commas. Also if you exit BGLPlacer and come back to change something in your csv file, the old object is not removed or overwritten. The new object is simply appended to the end of the list. BGLPlacer does not actually read the contents of the csv file, just writes output to it.

What I have described above works for either FS2002 or FS2004.

If you want to use XML for FS2004 only, here is what the code for this same building would look like:

<?xml version="1.0" encoding="ISO-8859-1"?>
<FSData version="9.0" xmlns:xsi='' xsi:noNamespaceSchemaLocation="bglcomp.xsd">







It is compiled the same way as the csv file but because it is XML it is not backwardly compatible.