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.

NameFile TypeNotes
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.erfThese 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.

NameFile TypeNwscript constantObjectToJson CompatibleNotes
Area.areRESTYPE_AREYesArea files are created in the toolset and store the area layout, script information, lighting information etc.
Combined Area Format.cafRESTYPE_CAFYesCombined 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.dlgRESTYPE_DLGYesDialogue files, a branching tree of text choices for players to interact with, that may run scripts.
Faction.facRESTYPE_FACYesThe faction information stored in the module file.
Generic File Format.gffRESTYPE_GFFYes

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.gicRESTYPE_GICYesArea 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.gitRESTYPE_GITYesArea 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.guiRESTYPE_GUIYesGraphical 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.ifoRESTYPE_IFOYesModule 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.itpRESTYPE_ITPYesItem Template Palette - used primarily in the toolset and DM client to spawn new stuff. 
Journal.jrlRESTYPE_JRLYesJournal file - can define quests and journal entries. 
Blueprint Files



Creature.utcRESTYPE_UTCYes
Door.utdRESTYPE_UTDYes
Encounter.uteRESTYPE_UTEYes
Item.utiRESTYPE_UTIYes
Merchant (Store).utmRESTYPE_UTMYes
Placeable.utpRESTYPE_UTPYes
Sound.utsRESTYPE_UTSYes
Trigger.uttRESTYPE_UTTYes
Waypoint.utwRESTYPE_UTWYes

Data Limits

This is the most useful information for many basic edits.

Data TypeNWN Explorer NameSize (in bytes)Value LimitsDescriptionNotes
BYTEUINT810 to 255Unsigned single byteSmallest unit to store so also used for booleans
WORDUINT1620 to 65535Unsigned integerUINT16 in Explorer
DWORDUINT3240 to 4294967296Unsigned integer
DWORD64UNIT6480 to roughly 18E18Unsigned integer
CHARINT81-128 - 127Single character signed integer
SHORTINT162-32768 to 32767Signed integer
INTINT324-2147483648 to 2147483647Signed integer
INT64INT328Roughly -9E18 to +9E18Signed integer
FLOATFLOAT4Variable see WikipediaFloating point value
DOUBLE
8Variable see WikipediaDouble-precision floating point value
CExoLocString
variablen/a

Localized string. Contains a StringRef DWORD, and a number of CExoStrings, each having their own language ID.


CExoStringSTRINGvariablen/aNon-localized stringCommonly used in the toolset (ie user set per-module)
CResRefRESREF1616 characters

Filename of a game resource. Max length is 16 characters. Unused characters are nulls.


VOID / Binary
variablen/aVariable-length arbitrary dataUsed to store things like sqlite data on BICs or Modules/Saves
StructENTRYvariablen/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
ListLISTvariablen/aA list of Structs.
  • No labels