Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

PropertyValue
Extension(s).gff, .utc, .uti, .utp, .ute, .utd, .dlg, .are, .ifo, etc.
Magic SignatureTarget type (e.g. UTC ) / V3.2
TypeGeneric Hierarchical Data
Rust ReferenceView 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::GffValue encapsulates 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. The rakata-formats implementation 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 OrderSection ComponentMemory Footprint / Quirk
Phase 1Root HeaderExactly 56 bytes (0x38).
Phase 2Struct Array12B × struct_count
Phase 3Field Array12B × field_count
Phase 4Label Array16B × label_count
Phase 5Field Data BlobArbitrary bounds constraint.
Phase 6Field IndicesDynamic array bounds.
Phase 7List IndicesDynamic 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.

ExtTypeCore Function
.areArea Static BlueprintDefines overarching static world properties (weather, day/night limits, physics constraints).
.dlgDialogueEncapsulates the conversation graph, branching logic, and cinematic execution sequences.
.gitGame Instance TemplateThe physical object manifest. Orchestrates exact placement, vector orientations, and template spawning.
.ifoModule InfoRoot environment metadata bridging modules together and orchestrating spawn states.
.utcCreatureInstantiates NPCs, stat-blocks, and character body configurations.
.utdDoorConfigures transitions, linked bounds, and structural barriers.
.uteEncounterOrchestrates dynamic boundary triggers and valid enemy spawning constraints.
.utiItemUnifies structural stats across weapons, armors, and consumables.
.utmStoreLimits merchant arrays and details markup/markdown behaviors.
.utpPlaceableStandardizes interactive storage boxes, unusable statues, and deployable traps.
.utsSoundConfigures local dynamic audio emitters and distance volume calculations.
.uttTriggerPlots physical interactive polygons tracking spatial events.
.utwWaypointAnchors spatial float positions for navigation grids and area transitions.