GFF (Generic File Format)
The Generic File Format (GFF) is BioWare’s core binary serialization format, functioning like a binary JSON object or XML tree. It holds arbitrarily nested structures, typed fields, and lists, powering UI layouts, character sheets, dialogues, and area descriptions.
At a Glance
| Property | Value |
|---|---|
| Extension(s) | .gff, .utc, .uti, .utp, .ute, .utd, .dlg, .are, .ifo, etc. |
| Magic Signature | Target type (e.g. UTC ) / V3.2 |
| Type | Generic Hierarchical Data |
| Rust Reference | View rakata_formats::Gff in Rustdocs |
Data Model Structure
The rakata-formats crate gracefully abstracts the GFF struct/field/list indexing graph into a user-friendly memory model (rakata_formats::Gff).
- Typestate Wrapping: GFF natively supports discrete types (e.g.,
BYTE,SHORT,VOID,STRUCT,LIST).rakata_formats::GffValueencapsulates these identically, shielding developers from raw byte layouts and indirect arrays. - Data Deduplication: Unlike standard web JSON, GFF binaries limit all field labels to 16 characters and deduplicate them via a contiguous
LabelTable. Therakata-formatsimplementation mimics this memory layout exactly during serialization, guaranteeing structurally deterministic binaries natively acceptable by the engine!
Engine Audits & Decompilation
Binary: swkotor.exe
Serialization Architecture (WriteGFFFile)
Derived from 0x00413030 / 0x004113d0.
The engine allocates the output buffer entirely in-memory and serializes exactly 7 contiguous sections in an absolutely strict order. No inter-section padding or reserved alignment bytes are inserted anywhere natively. Each section’s byte-offset is dynamically snapshotted into the 56-byte header, operating as the canonical write path utilized for save games and area extraction.
| Phasing Order | Section Component | Memory Footprint / Quirk |
|---|---|---|
| Phase 1 | Root Header | Exactly 56 bytes (0x38). |
| Phase 2 | Struct Array | 12B × struct_count |
| Phase 3 | Field Array | 12B × field_count |
| Phase 4 | Label Array | 16B × label_count |
| Phase 5 | Field Data Blob | Arbitrary bounds constraint. |
| Phase 6 | Field Indices | Dynamic array bounds. |
| Phase 7 | List Indices | Dynamic array bounds. |
Warning
Because BioWare enforces fixed 16-byte elements inside the Label arrays, any label that exceeds 16 characters is strictly truncated by the engine array bounds.
Engine Blueprints: Specialized GFF Containers
While the gff.md reference explains the layout of raw GFF nodes, the engine frequently uses GFF as a structural wrapper to serialize completely deterministic entities known as Blueprints. These blueprints operate as the strict layouts defining creatures, dialogue trees, placeables, and area parameters.
Because rakata-lint provides deep behavioral validation over these blueprints natively, we have comprehensively audited how the K1 GOG executable (swkotor.exe) maps these layouts into active memory via its Load*FromGFF functions.
The Blueprint Engine Audits
The audits listed in this section’s navigation bar are formal, decompilation-backed blueprints cataloging KOTOR’s physical constraints. They document the exact fields, load phrasing, and engine rule evaluations that supersede any generic structural validity.
If a field exists in GFF but breaks the engine, our Linter rules will flag it using these documentation audits as the source of truth.
| Ext | Type | Core Function |
|---|---|---|
.are | Area Static Blueprint | Defines overarching static world properties (weather, day/night limits, physics constraints). |
.dlg | Dialogue | Encapsulates the conversation graph, branching logic, and cinematic execution sequences. |
.git | Game Instance Template | The physical object manifest. Orchestrates exact placement, vector orientations, and template spawning. |
.ifo | Module Info | Root environment metadata bridging modules together and orchestrating spawn states. |
.utc | Creature | Instantiates NPCs, stat-blocks, and character body configurations. |
.utd | Door | Configures transitions, linked bounds, and structural barriers. |
.ute | Encounter | Orchestrates dynamic boundary triggers and valid enemy spawning constraints. |
.uti | Item | Unifies structural stats across weapons, armors, and consumables. |
.utm | Store | Limits merchant arrays and details markup/markdown behaviors. |
.utp | Placeable | Standardizes interactive storage boxes, unusable statues, and deployable traps. |
.uts | Sound | Configures local dynamic audio emitters and distance volume calculations. |
.utt | Trigger | Plots physical interactive polygons tracking spatial events. |
.utw | Waypoint | Anchors spatial float positions for navigation grids and area transitions. |