GAM file format

Applies to:
BG1, BG1: TotS, IWD, IWD:HoW, IWD: TotL, PST

General Description
This file format is used to hold game information in save games. The GAM file does not store area, creature or item information, instead, it stores information on the party members and the global variables which affect party members.

Detailed Description


Offset Size (datatype) Description
0x0000 4 (char array) Signature ('GAME')
0x0004 4 (char array) Version ('V1.1')
0x0008 4 (dword) Game time (300 units == 1 hour). 7 hours (2100 units) ahead time displayed in game.
0x000c 2 (word) Selected Formation
0x000e 2 (word) Formation button 1
0x0010 2 (word) Formation button 2
0x0012 2 (word) Formation button 3
0x0014 2 (word) Formation button 4
0x0016 2 (word) Formation button 5
0x0018 4 (dword) Party gold
0x001c 2 (word) Count of NPC structs for party members (excluding Protagonist)
0x001e 2 (word) Weather bitfield
  • bit0: Rain
  • bit1: Snow
  • bit2: Light Rain
  • bit3: Medium Rain
  • bit4: Light Wind
  • bit5: Medium Wind
  • bit6: Rare Lightning
  • bit7: Lightning
  • bit8: Storm Increasing
0x0020 4 (dword) Offset to NPC structs for party members
0x0024 4 (dword) Count of NPC structs for party members (including Protagonist)
0x0028 4 (dword)
Offset to party inventory
0x002c 4 (dword)
Count of party inventory
0x0030 4 (dword) Offset to NPC structs for non-party members.
0x0034 4 (dword) Count of NPC structs for non-party members.
0x0038 4 (dword) Offset to GLOBAL namespace variables
0x003c 4 (dword) Count of GLOBAL namespace variables
0x0040 8 (resref) Main area
0x0048 4 (dword) Unknown
0x004c 4 (dword) Count of journal entries
0x0050 4 (dword) Offset to journal entries
The following entries apply only to BG1 and IWD:
0x0054 4 (dword) Party Reputation (*10)
0x0058 8 (resref) Current area
0x0060 4 (dword) GUI flags
  • bit 0: (0) Party AI disabled / (1) Party AI enabled
  • bit 1: Text window size*
  • bit 2: Text window size*
  • bit 3: Unknown
  • bit 4: (0) Show GUI / (1) Hide GUI
  • bit 5: (0) Show options panel / (1) Hide options panel
  • bit 6: (0) Show portraits panel / (1) Hide portraits panel
  • bit 7: (0) Hide automap notes / (1) Show automap notes
* These bits control the text window size. The bits relate to the size as follows:
  •   00 = Small
  •   01 = Medium
  •   10 = Unused
  •   11 = Large
NB. Not all engines use all bits
0x0064 4 (dword) Save version (BG1 only):
  • 0: BG1 without TotSC
  • 1: BG1 + TotSC
0x0068 76 (bytes) Unknown
The following entries apply only to PST:
0x0054 4 (dword) Offset to Modron Maze struct
0x0058 4 (dword) Party Reputation (*10)
0x0058 8 (resref) Current area
0x0064 4 (dword) Offset to Kill variables
0x0068 4 (dword) Count of Kill variables
0x006c 4 (dword) Offset to Bestiary structure
0x0070 8 (resref) Current area 2
0x0078 64 (bytes) Unused



Offset Size (datatype) Description
0x0000 2 (word) Character selection
  • 0 = Not selected
  • 1 = Selected
  • 0x8000 = Dead
0x0002 2 (word) Party order (0x0-0x5 = PlayerXFill, 0xFFFF = not in party)
0x0004 4 (dword) Offset (from start of file) to CRE resource data for this character
0x0008 4 (dword) Size of CRE resource data for this character
0x000c 8 (bytes) Character Name
0x0014 4 (dword) Character orientation
0x0018 8 (resref) Characters current area
0x0020 2 (word) Character X coordinate
0x0022 2 (word) Character Y coordinate
0x0024 2 (word) Viewing rectangle X coordinate
0x0026 2 (word) Viewing rectangle Y coordinate
0x0028 2 (word) Modal action
0x002a 2 (word) Happiness
0x002c 4 (dword) NumTimesInteracted NPC count (unused)
0x0030 4 (dword) NumTimesInteracted NPC count (unused)
0x0034 4 (dword) NumTimesInteracted NPC count (unused)
0x0038 4 (dword) NumTimesInteracted NPC count (unused)
0x003c 4 (dword) NumTimesInteracted NPC count (unused)
0x0040 4 (dword) NumTimesInteracted NPC count (unused)
0x0044 4 (dword) NumTimesInteracted NPC count (unused)
0x0048 4 (dword) NumTimesInteracted NPC count (unused)
0x004c 4 (dword) NumTimesInteracted NPC count (unused)
0x0050 4 (dword) NumTimesInteracted NPC count (unused)
0x0054 4 (dword) NumTimesInteracted NPC count (unused)
0x0058 4 (dword) NumTimesInteracted NPC count (unused)
0x005c 4 (dword) NumTimesInteracted NPC count (unused)
0x0060 4 (dword) NumTimesInteracted NPC count (unused)
0x0064 4 (dword) NumTimesInteracted NPC count (unused)
0x0068 4 (dword) NumTimesInteracted NPC count (unused)
0x006c 4 (dword) NumTimesInteracted NPC count (unused)
0x0070 4 (dword) NumTimesInteracted NPC count (unused)
0x0074 4 (dword) NumTimesInteracted NPC count (unused)
0x0078 4 (dword) NumTimesInteracted NPC count (unused)
0x007c 4 (dword) NumTimesInteracted NPC count (unused)
0x0080 4 (dword) NumTimesInteracted NPC count (unused)
0x0084 4 (dword) NumTimesInteracted NPC count (unused)
0x0088 4 (dword) NumTimesInteracted NPC count (unused)
0x008c 2 (word) Index into slots.ids for Quick Weapon 1 (0xFFFF = none)
0x008e 2 (word) Index into slots.ids for Quick Weapon 2 (0xFFFF = none)
0x0090 2 (word) Index into slots.ids for Quick Weapon 3 (0xFFFF = none)
0x0092 2 (word) Index into slots.ids for Quick Weapon 4 (0xFFFF = none)
0x0094 2 (word) Quick weapon slot 1 ability (0/1/2 or -1 disabled)
0x0096 2 (word) Quick weapon slot 2 ability (0/1/2 or -1 disabled)
0x0098 2 (word) Quick weapon slot 3 ability (0/1/2 or -1 disabled)
0x009a 2 (word) Quick weapon slot 4 ability (0/1/2 or -1 disabled)
0x009c 8 (resref) Quick Spell 1 resouce
0x00a4 8 (resref) Quick Spell 2 resouce
0x00ac 8 (resref) Quick Spell 3 resouce
0x00b4 2 (word) Index into slots.ids for Quick Item 1 (0xFFFF = none)
0x00b6 2 (word) Index into slots.ids for Quick Item 2 (0xFFFF = none)
0x00b8 2 (word) Index into slots.ids for Quick Item 3 (0xFFFF = none)
0x00ba 2 (word) Quick item slot 1 ability (0/1/2 or -1 disabled)
0x00bc 2 (word) Quick item slot 1 ability (0/1/2 or -1 disabled)
0x00be 2 (word) Quick item slot 1 ability (0/1/2 or -1 disabled)
0x00c0 32 (bytes) Name
0x00e0 4 (dword) Talkcount
0x00e4 116 bytes Character Stats for this character
0x0158 8 (resref) Voice Set (filename prefix)
0x0160 32 (char array) Path to Voice Set folder (IWD only)


Offset Size (data type) Description
0x0000 4 (strref) "Most powerful vanquished" - Name
0x0004 4 (dword) "Most powerful vanquished" - XP Reward
0x0008 4 (dword) Time in party (1/15 seconds)
0x000c 4 (dword) Time Joined (1/15 seconds)
0x0010 1 (byte) Party member (0 = Not in party, 1 = In party)
0x0011 2 (word) Unused
0x0013 1 (byte) First letter of CRE resref (changed to *)
0x0014 4 (dword) Kills - XP Gained (chapter)
0x0018 4 (dword) Kills - Number (chapter)
0x001c 4 (dword) Kills - XP (game)
0x0020 4 (dword) Kills - number (game)
0x0024 4*8 (resref array) Favourite spells
0x0044 4*2 (word array) Favourite spell count
0x004c 4*8 (resref array) Favourite weapons
0x006c 4*2 (word) Favourite weapon time (time equipped in combat - 1/15 seconds)


Offset Size (data type) Description
0x0000 32 (char array) Variable name
0x0020 2 (type) Type
  • bit 0: int
  • bit 1: float
  • bit 2: script name
  • bit 3: resref
  • bit 4: strref
  • bit 5: dword
0x0022 2 (word) Ref value
0x0024 4 (dword) Dword value
0x0028 4 (dword) Int value
0x002c 8 (double) Double value
0x0034 32 (char array) Script name value


This section stores the strref, chapter and time for any entry added to the journal.

Offset Size (data type) Description
0x0000 4 (strref) Journal text
0x0004 4 (dword) Time (seconds)
0x0008 1 (byte) Current chapter number
0x0009 1 (byte) Read by character x
0x000a 1 (byte) Journal section
  • bit 0: Quests
  • bit 1: Competed quest
  • bit 2: Journal Info
NB. If no bits are set, the entry is a user-note
0x000b 1 (byte) Location flag (0x1F = external TOT/TOH, 0xFF = internal TLK)


The maze structure defines the layout of all areas, including special areas such as foyer, engine room or wizard room. It is 6B8h (1720) bytes long.

Offset Size (data type) Description
0x0000 64 * 26 (array of structs) A 8 x 8 grid of Modron Maze Entries
0x0680 4 (dword) # rows of areas (always 8)
0x0684 4 (dword) # columns of areas (always 8)
0x0688 4 (dword) Wizard room position X
0x068c 4 (dword) Wizard room position Y
0x0690 4 (dword) Nordom's room position X
0x0694 4 (dword) Nordom's room position Y
0x0698 4 (dword) Foyer position X
0x069c 4 (dword) Foyer position Y
0x06a0 4 (dword) Engine room position X
0x06a4 4 (dword) Engine room position Y
0x06a8 4 (dword) Total number of traps
0x06ac 4 (dword) Maze initialized (0: no, 1: yes)
0x06b0 4 (dword) Foyer maze blocker made (0: no, 1: yes)
0x06b4 4 (dword) Foyer engine blocker made (0: no, 1: yes)


Each modron maze entry defines the layout of traps and available exits for a single area of the maze. They have 1ah (26) bytes.

Offset Size (data type) Description
0x0000 4 (dword) Used (0: No, 1: Yes)
0x0004 4 (dword) Accessible (0: No, 1: Yes)
0x0008 4 (dword) Is valid (0: No, 1: Yes)
0x000c 4 (dword) Is trapped (0: No, 1: Yes)
0x0010 4 (dword) Trap type
  • 0: Trap A
  • 1: Trap B
  • 2: Trap C
0x0014 2 (word) Exits available at
  • Bit 0: East
  • Bit 1: West
  • Bit 2: North
  • Bit 3: South
0x0016 4 (dword) Populated (0: No, 1: Yes)


Offset Size (data type) Description
0x0000 260 * 1 (bytes) Indicates whether the creature represented by the specific byte value is available in the bestiary (1) or not (0).