Index  •  2DA  •  Effects  •  File Formats  •  Actions  •  Identifiers  •  Triggers  •  Appendices  •  Site Info  •  Legal

GAM file format

Applies to:
IWD2

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 ('V2.2')
0x0008 4 (dword) Game time (300 units == 1 hour)
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) Unknown
0x001e 2 (word) Weather bitfield
  • bit0: Rain
  • bit1: Snow
Higher bits determine the density and intensity of the weather
0x0020 4 (dword) Offset to NPC structs for party members
0x0024 4 (dword) Count of NPC structs for party members
0x0028 4 (dword)
Unknown
0x002c 4 (dword)
Unknown
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
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) Unknown
0x0068 4 (dword) Offset to familiar info
0x006c 4 (bytes) Saved location offset
0x0070 4 (dword) Saved location count
0x0074 4 (dword) Real game time
0x0078 60 (bytes) Unknown



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 Shield 1 (0xFFFF = none)
0x0090 2 (word) Index into slots.ids for Quick Weapon 2 (0xFFFF = none)
0x0092 2 (word) Index into slots.ids for Quick Shield 2 (0xFFFF = none)
0x0094 2 (word) Index into slots.ids for Quick Weapon 3 (0xFFFF = none)
0x0096 2 (word) Index into slots.ids for Quick Shield 3 (0xFFFF = none)
0x0098 2 (word) Index into slots.ids for Quick Weapon 4 (0xFFFF = none)
0x009a 2 (word) Index into slots.ids for Quick Shield 4 (0xFFFF = none)
0x009c 2 (word) Slot usable
0x009e 2 (word) Slot usable
0x00a0 2 (word) Slot usable
0x00a2 2 (word) Slot usable
0x00a4 2 (word) Slot usable
0x00a6 2 (word) Slot usable
0x00a8 2 (word) Slot usable
0x00aa 2 (word) Slot usable
0x00ac 8 (resref) Quick Spell 1 resouce
0x00b4 8 (resref) Quick Spell 2 resouce
0x00bc 8 (resref) Quick Spell 3 resouce
0x00c4 8 (resref) Quick Spell 4 resouce
0x00cc 8 (resref) Quick Spell 5 resouce
0x00d4 8 (resref) Quick Spell 6 resouce
0x00dc 8 (resref) Quick Spell 7 resouce
0x00e4 8 (resref) Quick Spell 8 resouce
0x00ec 8 (resref) Quick Spell 9 resouce
0x00f4 1 (byte) Quick spell 1 class
0x00f5 1 (byte) Quick spell 2 class
0x00f6 1 (byte) Quick spell 3 class
0x00f7 1 (byte) Quick spell 4 class
0x00f8 1 (byte) Quick spell 5 class
0x00f9 1 (byte) Quick spell 6 class
0x00fa 1 (byte) Quick spell 7 class
0x00fb 1 (byte) Quick spell 8 class
0x00fc 1 (byte) Quick spell 9 class
0x00fd 1 (byte) Unknown
0x00fe 2 (word) Index into slots.ids for Quick Item 1 (0xFFFF = none)
0x0100 2 (word) Index into slots.ids for Quick Item 2 (0xFFFF = none)
0x0102 2 (word) Index into slots.ids for Quick Item 3 (0xFFFF = none)
0x0104 2 (word) Slot usable
0x0106 2 (word) Slot usable
0x0108 2 (word) Slot usable
0x010a 8 (resref) Quick Innate 1
0x0112 8 (resref) Quick Innate 2
0x011a 8 (resref) Quick Innate 3
0x0122 8 (resref) Quick Innate 4
0x012a 8 (resref) Quick Innate 5
0x0132 8 (resref) Quick Innate 6
0x013a 8 (resref) Quick Innate 7
0x0142 8 (resref) Quick Innate 8
0x014a 8 (resref) Quick Innate 9
0x0152 8 (resref) Quick Song 1
0x015a 8 (resref) Quick Song 2
0x0162 8 (resref) Quick Song 3
0x016a 8 (resref) Quick Song 4
0x0172 8 (resref) Quick Song 5
0x017a 8 (resref) Quick Song 6
0x0182 8 (resref) Quick Song 7
0x018a 8 (resref) Quick Song 8
0x0192 8 (resref) Quick Song 9
0x019a 4 (dword) Quick Slot 1
0x019e 4 (dword) Quick Slot 2
0x01a2 4 (dword) Quick Slot 3
0x01a6 4 (dword) Quick Slot 4
0x01aa 4 (dword) Quick Slot 5
0x01ae 4 (dword) Quick Slot 6
0x01b2 4 (dword) Quick Slot 7
0x01b6 4 (dword) Quick Slot 8
0x01ba 4 (dword) Quick Slot 9
0x01be 32 (bytes) Character Name
0x01c2 4 (dword) Talkcount
0x01c6 116 bytes Character Stats for this character
0x023a 8 (resref) Soundset
0x0242 32 (char array) Voiceset
0x0262 4 (dword) Unknown
0x0266 4 (dword) Unknown
0x026a 4 (dword) Unknown
0x026e 4 (dword) Expertise (mutually exclusive with Power Attack)
0x0272 4 (dword) Power Attack (mutually exclusive with Expertise)
0x0276 4 (dword) Arterial Strike (mutually exclusive with Hamstring)
0x027a 4 (dword) Hamstring (mutually exclusive with Arterial strike)
0x027e 4 (dword) Rapid Shot
0x0282 4 (dword) Unknown
0x0286 3 (bytes) Unknown
0x0289 2 (word) Selected weapon slot
0x0281 153 (bytes) Unknown


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 2 (word) Party member (0 = Not in party, 1 = In party)
0x0012 1 (byte) First letter of CRE resref (changed to *)
0x0013 1 (byte) Unknown
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 8 (bytes) Unknown
0x0028 4 (dword) Variable value
0x002c 40 (bytes) Unknown


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 4 (dword) Current chapter number


The familiar (summoned by the Find Familiar spell) is dependent on the alignment of the caster. This section contains the mapping between caster alignment and the CRE file to summon. This section is blank by default, any meaningful information entered is used by the Find Familiar opcode (0x0c0)

Offset Size (data type) Description
0x0000 8 (resref) Lawful Good Familiar
0x0008 8 (resref) Lawful Neutral Familiar
0x0010 8 (resref) Lawful Evil Familiar
0x0018 8 (resref) Neutral Good Familiar
0x0020 8 (resref) Neutral Familiar
0x0028 8 (resref) Neutral Evil Familiar
0x0030 8 (resref) Chaotic Good Familiar
0x0038 8 (resref) Chaotic Neutral Familiar
0x0040 8 (resref) Chaotic Evil Familiar
0x0048 328 (bytes) Unknown