AREA file
Description
This file format describes the content of an area, rather than its visual
representation. It contains the list of actors, items, entrances and exits,
spawn points, and other assorted area-associated info. Essentially, this
format is all about how the characters interact with the area and how the area
responds, whereas the WED file is all about how
the area appears graphically.
Overall structure
Note: The order of the sections in an AREA file do actually vary. In many files the sections are always found in a particular order. In AREA files, the same resource in its normal state and in its "post-save" state will have the different sections in different orders. The sections here, then, are stored in the order in which they are referenced in the header.
| Offset | Size (datatype) | Description |
| 0x0000 | 4 (char array) | Signature ('AREA') |
| 0x0004 | 4 (char array) | Version ('V1.0') |
| 0x0008 | 8 (resref) | It is unknown precisely what the function of this ResRef is. It may, according to the documents inherited from the original BGFFHP, express some sort of data dependency -- i.e. express that this area requires data from another area. Or it may be used to determine when the resources for this should be unloaded. (For instance, if you are in area X, and you enter a building contained in area X, it should not unload the data for area X, since the long reload times for entering and leaving a building would be an annoyance.) Or possibly the resref of the WED file corresopnding to this file. |
| 0x0010 | 4 (dword) | Unknown; however, this field is called m_lastSaved in the BG source. |
| 0x0014 | 4 (dword) | (usually 3) |
| 0x0018 | 8 (resref) | Resref of the area to the North of this area. |
| 0x0020 | 4 (dword) | (usually 3) |
| 0x0024 | 8 (resref) | Resref of the area to the West of this area. |
| 0x002c | 4 (dword) | (usually 3) |
| 0x0030 | 8 (resref) | Resref of the area to the South of this area. |
| 0x0038 | 4 (dword) | (usually 3) |
| 0x003c | 8 (resref) | Resref of the area to the East of this area. |
| 0x0044 | 4 (dword) | Unknown |
| 0x0048 | 4 (dword) | Flags:- bit 0: Outdoor
- bit 1: day/night
- bit 2: weather
- bit 3: city
- bit 4: forest
- bit 5: dungeon
- bit 6: extended night
|
| 0x004a | 2 (word) | Rain probability |
| 0x004c | 2 (word) | Snow probability |
| 0x004e | 2 (word) | Fog probability |
| 0x0050 | 2 (word) | Lightning probability |
| 0x0052 | 2 (word) | Unknown |
| 0x0054 | 4 (dword) | Offset of actors (i.e. creatures and NPCs). |
| 0x0058 | 2 (word) | Count of actors in this area (i.e. creatures and NPCs). |
| 0x005a | 2 (word) | Count of info points, trigger points, and exits in this area. |
| 0x005c | 4 (dword) | Offset of info points, trigger points, and exits. |
| 0x0060 | 4 (dword) | Offset of spawn points. |
| 0x0064 | 4 (dword) | Count of spawn points. |
| 0x0068 | 4 (dword) | Offset of entrances. |
| 0x006c | 4 (dword) | Count of entrances. |
| 0x0070 | 4 (dword) | Offset of containers. |
| 0x0074 | 2 (word) | Count of containers. |
| 0x0076 | 2 (word) | Count of items. |
| 0x0078 | 4 (dword) | Offset of items. |
| 0x007c | 4 (dword) | Offset of vertices. |
| 0x0080 | 2 (word) | Count of vertices. |
| 0x0082 | 2 (word) | Count of ambients (i.e. ambient sounds). |
| 0x0084 | 4 (dword) | Offset of ambients. |
| 0x0088 | 4 (dword) | Offset of variables. |
| 0x008c | 4 (dword) | Count of variables. |
| 0x0090 | 4 (dword) | Unknown |
| 0x0094 | 8 (resref) | Script file corresponding to this area |
| 0x009c | 4 (dword) | "Explored" bitmask size |
| 0x00a0 | 4 (dword) | Offset to "explored" bitmask |
| 0x00a4 | 4 (dword) | Count of doors in this area |
| 0x00a8 | 4 (dword) | Offset to doors structures. |
| 0x00ac | 4 (dword) | Count of animations in this area. |
| 0x00b0 | 4 (dword) | Offset to animation structures. |
| 0x00b4 | 4 (dword) | Tiled object count |
| 0x00b8 | 4 (dword) | Tiled objects offset |
| 0x00bc | 4*2 (dword) | Offsets to ??? unknown sections, only found in savegames |
| 0x00c4 | 4 (dword) | offset of the automap note section, if any |
| 0x00c8 | 4 (dword) | number of entries in the automap note section |
| 0x00cc | 4*20 (dword) | Unknown |
| Offset | Size (datatype) | Description |
| 0x0000 | 32 (char array) | Name of this actor (this is the full name, as would appear, for instance, as a label in a dialog, or in a tooltip.) |
| 0x0020 | 4 (point) | Current position of this actor within the area. |
| 0x0024 | 4 (point) | Current destination of this actor within the area. |
| 0x0028 | 4 (dword) | Visible flag (i.e. 1 iff actor is "present", 0 if actor is not "present") |
| 0x002c | 4 (dword) | Unknown (usually 0) |
| 0x0030 | 4 (dword) | Unknown (actor type?) No apparent effect in game. |
| 0x0034 | 4 (dword) | Unknown (usually 0) |
| 0x0038 | 4 (dword) | Unknown (usually negative) |
| 0x003c | 4 (dword) | Unknown |
| 0x0040 | 4 (dword) | Unknown (usually negative) |
| 0x0044 | 4 (dword) | Unknown (usually 0) |
| 0x0048 | 8 (resref) | Resref of a dialog file associated with this creature. Presumably this is so that a creature can have their own dialog overridden in specific areas? |
| 0x0050 | 8 (resref) | Resref of a script file ("override" script?). As in the CRE file, there appear to be 5 slots for scripts, not all of which need be occupied. |
| 0x0058 | 8 (resref) | Resref of a script file ("class" script?) |
| 0x0060 | 8 (resref) | Resref of a script file ("race" script?) |
| 0x0068 | 8 (resref) | Resref of a script file ("general" script?) |
| 0x0070 | 8 (resref) | Resref of a script file ("default" script?) |
| 0x0078 | 8 (resref) | Resref of a script file ("specific" script?) |
| 0x0080 | 8 (resref) | Resref of the CRE file for this actor |
| 0x0088 | 4 (dword) | Offset to CRE structure (stored if the status of this creature is changed from its original status in the CRE file) |
| 0x008c | 4 (dword) | Size of stored CRE structure |
| 0x0090 | 128 (bytes) | Unknown. Most of these bytes are probably placeholders for fields which are used in-memory by either the game or the editor, since many of them contain what appears to be garbage of the sort which is left by not initializing a block of memory. |
Note: These are referred to as info points. A more appropriate name might be "active regions"; the name "Info point" comes from the names seen in the file as assigned to the various objects. Likely,
the Bioware editors automatically name these as "Info point 1", "Info point 2", ..., and "Trigger point 1", "Trigger point 2", ..., and "toXXXX", where XXXX is replaced with the 4-digit area specifier (i.e.
AR2600 == 2600, etc). This can be seen in that many of the names will appear as "Name1\0oint 3" -- i.e. the old name can be seen, only having been partially overwritten. Anyway, some of the objects are, in
fact, info points, but many of them are exits or "trigger points" (e.g. traps and other special regions).
| Offset | Size (datatype) | Description |
| 0x0000 | 32 (char array) | Name of this info point (this is the full name, probably used only in the editor?) |
| 0x0020 | 2 (word) | Type of this "trigger point": - 00: proximity trigger
- 01: info trigger (sign, point of notice, etc)
- 02: travel trigger
|
| 0x0022 | 8 (rect) | Minimum bounding box of this point. |
| 0x002a | 2 (word) | Count of vertices composing the perimeter of this info point. |
| 0x002c | 4 (dword) | Index of first vertex for this info point. |
| 0x0030 | 4 (dword) | Unknown. (usually 0) |
| 0x0034 | 4 (dword) | Index of cursor to use for this region (i.e. usually '22' for info point, '28' for inside exits, '30' for outside exits. It is unclear which BAM file these come from, but this is likely the frame number to use for the cursor. |
| 0x0038 | 8 (resref) | Resref of the destination area, if this is an exit. Unused for other object types. |
| 0x0040 | 32 (char array) | Name of the entrance within the destination area where we will appear if we pass through this door. Only used for "exit" objects. |
| 0x0060 | 4 (dword) | Flags:- bit 0
- bit 1: Reset trap flag (for proximity triggers)
- bit 2: Party Required flag (for travel triggers). Responsible for the "You must gather your party before venturing forth" message
|
| 0x0064 | 4 (strref) | The text associated with this "info point", if this is actually an "info point" (i.e. if type==01). |
| 0x0068 | 2 (word) | Trap detection difficulty (%) |
| 0x006a | 2 (word) | Trap removal difficulty (%) |
| 0x006c | 2 (word) | trapped flag |
| 0x006e | 2 (word) | trap detected flag |
| 0x0070 | 4 (point) | "trap launch" location. |
| 0x0074 | 8 (bytes) | Key type (usage unknown) |
| 0x007c | 8 (resref) | The script associated with this region, if it is a "trigger point". This script is activated when a member of your party passes over one of the edges of the polygon defining this region. |
| 0x0084 | 48 (bytes) | Unknown |
| 0x00b4 | 4 (point) | Unknown. |
| 0x00b8 | 4 (dword) | Unknown. |
| 0x00bc | 8 (resref) | Dialog file to be activated when this trigger is activated. Associated with proximity triggers. Whether it is used for other types is unknown. |
| Offset | Size (datatype) | Description |
| 0x0000 | 32 (char array) | Name of this spawn point (this is the full name, probably used only in the editor?) |
| 0x0020 | 4 (point) | The "location" of this spawn point |
| Offset | Size (datatype) | Description |
| 0x0000 | 32 (char array) | Name of this entrance -- as referenced by exits which lead to this entrance (specified in the source area's Info points, trigger points, and exits section. |
| 0x0020 | 4 (point) | The "location" of this entrance -- when you enter the area via this entrance, where does your party actually appear? |
| 0x0024 | 68 (bytes) | Unknown. |
| Offset | Size (datatype) | Description |
| 0x0000 | 32 (char array) | Name of this container -- Probably only used by the editor, since the name makes it fairly obvious which containers are trapped. |
| 0x0020 | 4 (point) | Location of this container. Exactly what qualifies as the "position" of the container is unclear. Perhaps this, too, is used by the editor? |
| 0x0024 | 2 (word) | Container type:- 00: <n/a>
- 01: BAG
- 02: CHEST
- 03: DRAWER
- 04: PILE
- 05: TABLE
- 06: SHELF
- 07: ALTAR
- 08: NONVISIBLE
- 09: SPELLBOOK
- 0a: BODY
- 0b: BARREL
- 0c: CRATE
|
| 0x0026 | 2 (word) | Lock difficulty |
| 0x0028 | 2 (word) | Is locked? (1 if locked, 0 otherwise) |
| 0x002a | 2 (word) | Unknown |
| 0x002c | 2 (word) | Trap detection difficulty |
| 0x002e | 2 (word) | Trap removal difficulty |
| 0x0030 | 2 (word) | Container is trapped |
| 0x0032 | 2 (word) | Trap has been detected |
| 0x0034 | 4 (point) | Trap launch target |
| 0x0038 | 8 (rect) | Minimum bounding box of container polygon |
| 0x0040 | 4 (dword) | Index of first item in this container. |
| 0x0044 | 4 (dword) | Count of items in this container. |
| 0x0048 | 8 (resref) | Resref of script to trigger if container trap is set off. |
| 0x0050 | 4 (dword) | Index of first vertex making up the outline of this container. |
| 0x0054 | 4 (dword) | Count of vertices making up the outline of this container. |
| 0x0058 | 32 (bytes) | Unknown |
| 0x0078 | 8 (resref) | Resref of a "key" item, which, if posessed allows this chest to be opened. |
| 0x0080 | 64 (bytes) | Unknown. |
For those of you that have been paying attention, you may recognize this struct as being used in both the CRE file and the STO file.
| Offset | Size (datatype) | Description |
| 0x0000 | 8 (resref) | Resref of the ITM resource for this particular item. |
| 0x0008 | 2 (word) | Unknown |
| 0x000a | 2 (word) | Usage 1 (typically the number of stacked items or the number of uses of the primary facility of a magical item) |
| 0x000c | 2 (word) | Usage 2 (typically the number of uses of the secondary facility of a magical item) |
| 0x000e | 2 (word) | Usage 3 (typically the number of uses of the tertiary facility of a magical item) |
| 0x0010 | 4 (dword) | Flags:- bit 0: identified
- bit 2: stolen
|
This is an array of points which are used to create the outlines of trigger/info/exit regions and for containers. Not much else to say. Lots of 16-bit words stored x0, y0, x1, y1...
| Offset | Size (datatype) | Description |
| 0x0000 | 32 (char array) | Name of this particular ambient. Typically a descriptive name, like "Tavern", "Dogs", or "Kids". Sometimes a not-so-descriptive name, like "ambi". |
| 0x0020 | 4 (point) | "Origin" (center) of this particular sound |
| 0x0024 | 2 (word) | Likely, the radius of this sound. |
| 0x0026 | 2 (bytes) | Unknown |
| 0x0028 | 6 (bytes) | Unknown |
| 0x002e | 2 (word) | Volume of this sound? (i.e. as a percentage of the maximum) |
| 0x0030 | 8*10 (resref array) | Resref of up to 10 sounds. The noise for this ambient sound is chosen at random from the (up to) 10 available sounds. |
| 0x0080 | 2 (word) | Number of sounds in the array of sound resource at 0x30 |
| 0x0082 | 2 (word) | Unknown |
| 0x0084 | 4 (dword) | Unknown |
| 0x0088 | 4 (dword) | Unknown |
| 0x008c | 4 (dword) | Unknown |
| 0x0090 | 4 (dword) | Flags of some sort. |
| 0x0094 | 64 (bytes) | Unknown |
Each area can have associated variables. Variables not associated with an
area are associated with either "GLOBAL" for global variables, or "LOCALS" for
local variables. This stores variables associated with this particular area
(this is keyed on the resref of this area, which is assumed to be a 6
character code, even though a resref is 8 characters long). For instance, the
variable accessed via 'Global("AR2600","FooBarDead")' would be stored in the
ARE file for AR2600. Typically these blocks are found only in saved ARE files
(i.e. extracted from .SAV files.). The structure, as much as is known,
is:
| Offset | Size (datatype) | Description |
| 0x0000 | 32 (char array) | Name of this variable. |
| 0x0020 | 8 (bytes) | Unknown |
| 0x0028 | 4 (dword) | Variable value |
| 0x002c | 40 (bytes) | Unknown |
The explored bitmask is an array of bits, one bit for each 16x16 pixel cell on the map. If a bit is 1, then the cell has been explored. Otherwise, it has not.
Doors in an AREA file are the "door" objects that the user interacts with, to be distinguished from the "door" objects in the WED file. The WED file deals with how the opening and closing of a door changes the appearance of the world. A door in an AREA file details what happens when the user tries to open the door, what polygon the mouse must be inside of in order for mouse clicks to affect the door in question. The two types of door objects are linked through the id field in each -- the 8-byte character array which contains an identifier for the door. If the names in the two files match, the doors are the same, and toggling the state of the AREA door will toggle the state of the WED door.
| Offset | Size (datatype) | Description |
| 0x0000 | 32 (char array) | A long name for this door. |
| 0x0020 | 8 (char array) | A short identifier for this door. Probably used to establish a mapping between doors in the AREA file and doors in the WED file. |
| 0x0028 | 4 (dword) | Flags related to this door. |
| 0x002c | 4 (dword) | Index of first vertex comprising the outline of this door while the door is open. |
| 0x0030 | 2 (word) | Count of vertices comprising the outline of this door while the door is open. |
| 0x0032 | 2 (word) | Count of vertices comprising the outline of this door while the door is closed. |
| 0x0034 | 4 (dword) | Index of first vertex comprising the outline of this door while the door is closed. |
| 0x0038 | 8 (rect) | Minimum bounding box of the door polygon when it is open. |
| 0x0040 | 8 (rect) | Minimum bounding box of the door polygon when it is closed. |
| 0x0048 | 4 (dword) | Index of first "vertex" in "impeded cell block" for "door closed" state. These vertices are not actually vertices, but instead, cell coordinates (each cell corresponding to one tile in the WED file's Tilemap structures. When the door is closed, these cells cannot be entered by any object. |
| 0x004c | 2 (word) | Count of "vertices" in "impeded cell block" for "door closed" state. See note at offset 0x48 in this structure for details. |
| 0x004e | 2 (word) | Count of "vertices" in "impeded cell block" for "door open" state. This is the same as the above field, except it is used when the door is open, instead of when the door is closed. |
| 0x0050 | 4 (dword) | Index of first "vertex" in "impeded cell block" for "door open" state. This is the same as the field at 0x48, except it is used when the door is open, instead of when the door is closed. |
| 0x0054 | 2 (word) | Unknown |
| 0x0056 | 2 (word) | Unknown |
| 0x0058 | 16 (bytes) | Unknown |
| 0x0068 | 4 (dword) | Unknown |
| 0x006c | 2 (word) | Trap detection difficulty |
| 0x006e | 2 (word) | Trap removal difficulty |
| 0x0070 | 2 (word) | Trapped flag |
| 0x0072 | 2 (word) | Trap detected flag |
| 0x0074 | 4 (point) | Trap launch target point |
| 0x0078 | 8 (resref) | Resref of key item needed to unlock door. |
| 0x0080 | 8 (resref) | Resref of script for this item. (Script is activated when "open" attempt is made on item.) |
| 0x0088 | 4 (dword) | Unknown |
| 0x008c | 4 (dword) | Lock difficulty (0-100) |
| 0x0090 | 8 (rect) | Bounding box for...? |
| 0x0098 | 28 (bytes) | Unknown |
| 0x00b4 | 4 (strref) | Name of this door, if it has one. Name is used if the door initiates dialog with the user. |
| 0x00b8 | 8 (resref) | Resref of the dialog resource associated with this door, if any. This dialog will be used if the door initiates dialog with the user in its associated script. |
| 0x00c0 | 8 (bytes) | Unknown |
| Offset | Size (datatype) | Description |
| 0x0000 | 32 (char array) | A long name for this animation. |
| 0x0020 | 4 (point) | The point at which the "center" of the animation is to be played -- i.e. each frame in the BAM file has its center placed at this precise coordinate. |
| 0x0024 | 4 (dword) | Unknown |
| 0x0028 | 8 (resref) | The resref of the BAM file to be played for this animation. |
| 0x0030 | 2 (word) | Sequence number within the BAM resource |
| 0x0032 | 2 (word) | Unknown |
| 0x0034 | 4 (dword) | Unknown |
| 0x0038 | 4 (dword) | Unknown |
| 0x003c | 16 (bytes) | Unknown |
These are textual notes which either you can add to your map, or which, in
Torment, are automatically added to your map. This format isn't too well
known, but it also isn't too complicated.
| Offset | Size (datatype) | Description |
| 0x0000 | 2 (word) | X coordinate |
| 0x0002 | 2 (word) | Y coordinate |
| 0x0004 | 48 (bytes) | text of note |
| 0x0034 | ... | (unused bytes of padding in Torment) |
This information comes from Dmitry Jemerov. Neither of us have seen any
instances of areas which include objects of this type, but he has managed to
determine the format of these objects, nonetheless. Since there are no
examples, we don't know precisely what they are used for. If more information
becomes available, this space will be updated.
| Offset | Size (datatype) | Description |
| 0x0000 | 32 (char array) | Name |
| 0x0020 | 8 (resref) | Unknown |
| 0x0028 | 4 (dword) | Unknown |
| 0x002c | 4 (dword) | Primary search squares start. The primary search squares are the squares which are impeded when the object is in one state (i.e. the search squares through which a creature cannot travel). |
| 0x0030 | 4 (dword) | Primary search squares count |
| 0x0034 | 4 (dword) | Secondary search squares start. The secondary search squares are like the primary search squares, except for when the object is in an alternate state of some sort. |
| 0x0038 | 4 (dword) | Secondary search squares count |
| 0x003c | 48 (bytes) | Unknown (unused?) |
[ back to index ]