Scenery SDK Overview

The Scenery SDK includes explanations and examples of the concepts and elements used to design scenery for Flight Simulator. In particular, this SDK both explains and provides a programmer's reference for the BGL graphics language; it also explains (and provides examples of) the BGL files that contain scenery. The key to understanding scenery design in Flight Simulator lies in understanding the general concepts and conventions used throughout the graphics system, and then building on those basics. If you're not familiar with BGL, the following list suggests a route through the Scenery SDK that progresses from the general concepts used throughout BGL to more specific details.

The other sections in the SDK are important, too. You'll find sections that include more advanced topics dealing with the specifics and subtleties of scenery design, such as the section Hazing, Shadows, and Special effects. You'll also find the BGL Language Reference; a great resource that you can refer to on an as-needed basis.

Important: The information included in the Scenery SDK is intended as a reference for programmers. It assumes familiarity with C programming language, Macro Assembler (MASM), and game development. The information is not supported by Microsoft Product Support.

The following sections describe the language, syntax, and types of math used throughout this SDK.

Use of Assembly Language and C Syntax

Simple assembly language syntax is used to define the arrangement of bytes and words of data within databases. Any MASM reference manual describes the meaning of this syntax.

C syntax is also used occasionally. The use of both C and assembly language syntax doesn’t require any proficient knowledge of x86, Pentium assembly language, C, or C++. These syntaxes are used to show how data structures are laid out to create graphics databases.

Hexadecimal notation is used extensively. Values that are in “hex” are indicated in assembly language format: 1234h and 0b7f2h. If a hex value begins with a letter value, a zero always precedes it.

Use of Integer and Fractional Math and its Notation

To make the best use of computer hardware, Flight Simulator represents values in integer format to use the processor’s integer math units. Although fast floating point math units make mathematical operations fast regardless or integer or floating point types, moving 1, 2, and 4-byte integer pieces around in memory and registers is still faster. Integers are used to represent both whole numbers and fractions.

Whole Number Integer Math

The smallest integer unit that is dealt with is the byte. In many instances, an integer byte is represented with the letter “i”. This value has a range of -128–127 if it is signed and 0–255 if it is unsigned.

An integer word consists of 2-bytes and is often referred to as an “ii” data type. This data type ranges from 0–65535 if it is unsigned and -32768–+32767 if it is signed.

Fractional Integer Math

Fractional values of less than one are dealt with by defining the values as fractional, using the integer processing units in the microprocessors.

Although a whole number integer word ranging from 0–65535 may seem like just “whole numbers," there is actually a binary point to the right of the least significant bit in the integer. The weights of the bits to the left of the binary point are 1, 2, 4, 8 and so on all the way up to bit 15, which is 32768.

Fractional numbers are created by putting bits to the right of the binary point. The first bit to the right has the weight of 1/2, the next 1/4, then 1/8, 1/16, 1/32, and so on. A fractional byte is represented by the letter “f”. This byte has a range of  .00h–.ffh or from 0–255/256 in increments of 1/256ths. A fractional word consists of 2 fractional bytes and is represented by “ff”.

Mixed Whole Number and Fractional Math

Integers are often made to represent both whole number and fractional parts. For example, a 32-bit integer can represent 16 bits whole number, and 16 bits fractional. The binary point is in the middle of the 32 bits. The notation for this type of number is, “ii.ff”.