GFF files are the "Generic File Format" of Neverwinter Nights. A binary encoded file with a basic structure, it contains all the blueprints, area instanced information, even saved games contents.
Editors
The game comes with a very basic Windows only GFF editor, good for simple changes. In NWN:EE it is located in Neverwinter Nights\util\win32\GFFEditor.exe
There is the tool TlkEdit2 (2da/tlk/gff/erf Editor) on the vault, this runs in Java so is more cross compatible and may be easier to use.
Then you can decompile the files into JSON using the neverwinter-nim tooling. This is good for mass changes or uploading to a code repository.
Editing GFF Files
There may be references on other wiki pages to editing GFF files directly - the toolset either doesn't support specific changes (eg; higher numbers than the toolset shows) or doesn't support the changes full stop even if the game recognises them (eg; setting a NPC familiar type).
To edit the modules GFF files first open it so it extracts the contents to the Documents\Neverwinter Nights\modules\temp0 folder. Then find the file you wish to edit in your editor of choice (or copy it elsewhere, then copy it back). Once edited save the module and it'll package up the file without question.
Editing it later in the toolset may change the GFF fields back to some default or remove them entirely - so be warned changes made using a GFF editor may be undone at any moment.
Editing GFF with nwscript
You can convert most GFF formats to Json with ObjectToJson and back from Json to GFF formats with JsonToObject. Limitations here are the bigger fields like DWORD or DWORD64.
File Format Specifications
You can read most of the generic information in the GFF format specification Bioware made with a rundown of how it operates in the PDF.
Here is some cribbed information for ease of access.
File Formats and Types
Encapsulated Resource Containers
These are all "erf" as per the naming "Encapsulated Resource Container" but there are variants as per below. All of them are openable in nwhak.exe and other tools and the contents extracted - more or less.
| Name | File Type | Notes |
|---|---|---|
| Module | .mod .nwm | Modules are specifically ones with a module.ifo file and other relevant information for loading a module. Nowadays in EE all kinds of file formats can be added here, but this is serverside only so things like models, textures, tileset information or clientside 2da files should be instead added to hakpacks for distributing to players. nwm is a special kind of module meant for the developer to use, so they can be (mostly) patched. Primarily it means the save games associated with them do not save the entire module state only part of it so the rest is loaded from the module file and therefore can change between saves. |
| Hakpack | .hak | Hakpacks have sets of files in them, such as models, textures, 2da files, etc. They can additionally host files usually just found in the module, such as scripts or blueprints, but these are not then editable in the toolset itself and if duplicated in the module may cause some oddities (see Content Load Order for specifics). |
| Erf file | .erf | These are generic containers of files primarily used to transport some data between modules. You can export an erf from the toolset made up of a set of file, and import it into another module (a similar thing can occur if copying raw files from the temp0 directories although exporting does sanitise some things like faction IDs for objects). |
| Save game | .sav | Save games come in two kinds, the basic kind for most modded content contains essentially the entire module file, plus relevant changes and real-time information (such as actions, spells, effects, players). The second is the kind for nwm files and these contain only the changes and real time information with the rest loaded from the nwm file. |
GFF File Types
These are the kinds of files store in a .mod or .hak that are GFF files. note that some of them are specific to EE. See also nwnlexicon RESTYPE. All of these work with ObjectToJson.
Note soundset files (SFF) are not really GFF they're a bit weird. See the file format specifications for those.
| Name | File Type | Nwscript constant | ObjectToJson Compatible | Notes |
|---|---|---|---|---|
| Area | .are | RESTYPE_ARE | Yes | Area files are created in the toolset and store the area layout, script information, lighting information etc. |
| Combined Area Format | .caf | RESTYPE_CAF | Yes | Combined Area Format, used for TemplateToJson, consisting of a combined ARE, GIT and GIC all in one. Can be used in hakpacks to load an area using JsonToObject. |
| Dialogue | .dlg | RESTYPE_DLG | Yes | Dialogue files, a branching tree of text choices for players to interact with, that may run scripts. |
| Faction | .fac | RESTYPE_FAC | Yes | The faction information stored in the module file. |
| Generic File Format | .gff | RESTYPE_GFF | Yes | Generic File Format. Most of the files in this list are of a GFF type, but none will be named "file.gff". The toolset will use these in ERF files as a "ExportInfo.gff" file. The game engine uses this format for temporary engine files not written to disk, as well as in the generic StoreCampaignObject and related functions but again, hidden since the object stored will be retrieved correctly due to the GFF headers. |
| Area Instanced Contents | .gic | RESTYPE_GIC | Yes | Area file instanced content; eg: placed monsters and placeables in the area. Part of the CAF format if you want to have a easier way to save all area info in one, see above. |
| Area Instanced Comments | .git | RESTYPE_GIT | Yes | Area file instanced comments. While used in the toolset primarily, technically the game needs them to be present when using CopyArea etc. but the game doesn't really display them anywhere. Part of the CAF format if you want to have a easier way to save all area info in one, see above. |
| Graphical User Interface | .gui | RESTYPE_GUI | Yes | Graphical User Interface files, essentially containing some of the config and layout for the mostly hardcoded GUI (the events/buttons etc. have hardcoded ID's). |
| Module Information | .ifo | RESTYPE_IFO | Yes | Module Information files - ie module.ifo is stored in the .mod of a module and defines the name/start location/default module scripts etc. |
| Template Palette | .itp | RESTYPE_ITP | Yes | Item Template Palette - used primarily in the toolset and DM client to spawn new stuff. |
| Journal | .jrl | RESTYPE_JRL | Yes | Journal file - can define quests and journal entries. |
| Blueprint Files | ||||
| Creature | .utc | RESTYPE_UTC | Yes | |
| Door | .utd | RESTYPE_UTD | Yes | |
| Encounter | .ute | RESTYPE_UTE | Yes | |
| Item | .uti | RESTYPE_UTI | Yes | |
| Merchant (Store) | .utm | RESTYPE_UTM | Yes | |
| Placeable | .utp | RESTYPE_UTP | Yes | |
| Sound | .uts | RESTYPE_UTS | Yes | |
| Trigger | .utt | RESTYPE_UTT | Yes | |
| Waypoint | .utw | RESTYPE_UTW | Yes |
Data Limits
This is the most useful information for many basic edits.
| Data Type | NWN Explorer Name | Size (in bytes) | Value Limits | Description | Notes |
|---|---|---|---|---|---|
| BYTE | UINT8 | 1 | 0 to 255 | Unsigned single byte | Smallest unit to store so also used for booleans |
| WORD | UINT16 | 2 | 0 to 65535 | Unsigned integer | UINT16 in Explorer |
| DWORD | UINT32 | 4 | 0 to 4294967296 | Unsigned integer | |
| DWORD64 | UNIT64 | 8 | 0 to roughly 18E18 | Unsigned integer | |
| CHAR | INT8 | 1 | -128 - 127 | Single character signed integer | |
| SHORT | INT16 | 2 | -32768 to 32767 | Signed integer | |
| INT | INT32 | 4 | -2147483648 to 2147483647 | Signed integer | |
| INT64 | INT32 | 8 | Roughly -9E18 to +9E18 | Signed integer | |
| FLOAT | FLOAT | 4 | Variable see Wikipedia | Floating point value | |
| DOUBLE | 8 | Variable see Wikipedia | Double-precision floating point value | ||
| CExoLocString | variable | n/a | Localized string. Contains a StringRef DWORD, and a number of CExoStrings, each having their own language ID. | ||
| CExoString | STRING | variable | n/a | Non-localized string | Commonly used in the toolset (ie user set per-module) |
| CResRef | RESREF | 16 | 16 characters | Filename of a game resource. Max length is 16 characters. Unused characters are nulls. | |
| VOID / Binary | variable | n/a | Variable-length arbitrary data | Used to store things like sqlite data on BICs or Modules/Saves | |
| Struct | ENTRY | variable | n/a | A complex data type that can contain any number of any of the other data types, including other Structs. | Used to lay out data in the GFF, eg; level data in a BIC |
| List | LIST | variable | n/a | A list of Structs. |