| DKI file format description | Index |
Section 10 format description
| Contents |
| General |
Dynamic object shapes are stored in BGL files in the section 10. In most cases, BGL files containing a section 10 do not have any other sections. Such files are called dynamic libraries in DynKit.
Dynamic libraries normally have the BGL file type of 1. The BGL file header contains a valid offset to the beginning of section 10, and also a 16-byte value stored in the memory location Value0..Value7. In DYNLIB.BGL, this 16-byte value consists of the first 8 bytes of ID strings used for individual object shapes, repeated twice. This scheme also works for custom-made dynamic libraries. Other values often result in dynamic objects not appearing. The LatMin/LatMax and LonMin/LonMax fields of the BGL header seem to have no effect.
The section 10 is not grouped into latitude ranges. It begins with the table of all object shapes defined in section 10. For each shape, the table contains a 32-bit section offset to it's data and it's 16-byte ID string. These ID strings are used by section 15 code to reference shapes from section 10. The table concludes with a 32-bit '0' value.
The section 10 table is followed by blocks of data defining individual object shapes. Each such block of data consists of a header record, followed by the SDL code that actually draws the shape. The header contains a few values of an unknown meaning and also a 16-bit value defining the size, in bytes, of the entire block of data. This means the size of the SDL code that draws a shape is limited to slightly less than 64K.
The SDL code is responsible for drawing the object, detecting collisions with your aircraft and setting the object extent for collision avoidance.
The SDL code runs in it's own address space for variables. This means most SDL instructions that access variables cannot access "global" scenery engine variables, like time of day or the crash code, but instead access "local" ones. Each dynamic object has it's own set of local variables. These include coordinates and orientation, gear status, timers, special flags and also 5 variables that can be set with section 15 commands. The default Boeing-727 in FS98 and several default objects in earlier versions of MSFS use these variables to select colors. Unlike other opcodes, the SetVar7E (aka SetGlobalVar) instruction sets a global variable even when used in section 10 code. It is useful to set the crash code.
The SDL code can only reliably access texture files that reside in the main texture directory of FS98. If you install a dynamic scenery into a scenery layer, texture files from that layer will still not always be accessible.
| Record formats |
Section table entry (20 bytes)
| Field | Offset | Type | Description |
| Offset | +0 | int32 | Section offset to the object shape header. |
| ID | +4 | ID_string16 | 16-byte ID string for the shape defined in this record. |
Object shape header (19 bytes)
| Field | Offset | Type | Description |
| Unknown1 | +0 | int32? | Always 1? |
| Unknown2 | +4 | int32? | Always 2? |
| Unknown3 | +8 | int32? | Always 3? |
| Unknown4 | +12 | int32? | Always 4? |
| Unknown5 | +16 | int8? | Always 064h? |
| Size | +17 | uint16? | The total size of this header and the SDL code that draws the object, in bytes. |
| Local variables |
For a list of variables local to dynamic objects, see the DynKit FSASM Support page.
| DKI file format description | Index |