The concept of objects in Fallout 2
This document makes an attempt to organize the collected knowledge of the internal structure of Fallout 2. This document does not claim to be a complete exposition, nevertheless it describes one of the fundamental concepts in the structure of Fallout. Before studying this document, it's recommended to familiarize yourself with the Fallout 2 file formats.
We can divide game objects into three groups (see figure):
Describing the first group, it's convenient to start with the world map. Traveling on it, the player enters cities and runs into random encounters in the wasteland. Upon this it loads a location map, on which are game objects.
The second group is the player and related objects - his party (teammates) and the car. Where he goes, they go as well.
The third group is interface objects, such as videos.
(There are many diagrams in this document, so remember the following: squares are objects, arrows are connections between objects, arrows with captions are identifiers, through which objects are accessed. Boxes denote complex objects composed of several other objects. Dotted lines show indirect connections.)
Referring to objectsEdit
Referring to the information related to objects happens through pointers, namely:
for files: 1. By file name. 2. Through an identifier. for records in a text file: 3. By record number. 4. By record name.
For the most part, pointers are contained in game files (in text or binary format), but in some cases they are hardcoded in the engine (usually these are filenames).
An identifier (ID) is a number (DWORD, 4 bytes) which indicates the type of object, sometimes some parameters, and also the number (index) of the line in the file list which contains the name of the file. Here, you can see, to get the filename it used an intermediate object - the file list (LST file). Sometimes it doesn't use the whole ID, just the list index.
Record number is a number which corresponds to a block of data (sometimes just one line) in a text file.
Record name is a name corresponding to a block of data in a text file.
Simply put, references are made to files or to records in text files by means of either a name or a number.
List of pointers:
FL NAME - file name list indices and identifiers: MVE IDX - mve index, number of a movie LST IDX - list index, a numbered line in the file (LST file) PID - Proto ID, prototype identifier FID - Frame ID, image identifier SID - Script ID, script identifier Sound ID, sound file identifier record numbers in text files: MSG IDX - record number in a MSG file MAP IDX - map identifier (a section number in MAPS.TXT) AI IDX - AI package number (in AI.TXT) GVAR IDX - GVAR number (global variable in the game) record names in text files: MAP NAME - name of a section describing a map in MAPS.TXT NAME - name of a section in a text file
World map objectsEdit
World map objects are the world map itself and also cities and random encounters in the wasteland. Some unique random encounters are also considered as special encounters.
The world map consists of separate tiles (FRM files with an image of part of the map) - 4 horizontally, 5 vertically, 20 in all. Each tile contains 42 (7*6) squares of the world map. Squares are separated by yellow lines.
To determine what areas the player can travel on, and which he can't, masks of the world map are used. Each tile has its own mask.
Don't forget that some objects, such as the world map, have a soundtrack. It's hard-coded in the game engine.
Random encounters are recorded in WORLDMAP.TXT. The following diagram will explain the structure of WORLDMAP.TXT and the connections between world map and random encounter objects.
As you can see, the engine reads from WORLDMAP.TXT sections describing tiles [Tile], which contain a list of map tiles and the name of a mask file. For each world map square in the [Tile] section it records the name of an [Encounter Table] section, which describes the types of random encounters that can occur in that square.
For each random encounter in [Encounter Table] it stores the name of a location in MAPS.TXT and the name of an [Encounter] section, describing the random encounter. For special encounters it indicates only a location name in MAPS.TXT .
The [Encounter] section contains, for the encounter in which they occur, PIDs of critters, a list of critter scripts and items in their inventory, and a list of items on the ground.
MAPS.TXT contains the file names of location maps and GAM files for them.
The game engine finds names and descriptions of random encounters in the file WORLDMAP.MSG . Because there aren't numbered text lines in descriptions of encounters, only the engine knows how to find them. It is clear only that the order of entries in WORLDMAP.MSG matches the order of entries in MAPS.TXT (for location names) and in the [Encounter Table] section of WORLDMAP.TXT (for encounter descriptions).
Cities are green circles on the world map. The engine gets information about them from the file CITY.TXT . See the diagram below:
As you can see, in CITY.TXT there are pointers to a picture of the city map (displayed when you enter the city, for choosing which part of the city you want to go to) and to a picture of the name of the city (on the table with a button to go to that city). Also in CITY.TXT are the names of locations in MAPS.TXT .
Locations are some part of a city (for example, Trapper Town in Klamath). See the 'entrance' parameter in CITY.TXT for more explanation.
In MAPS.TXT are filenames for location maps and GAM files for them, and also the names of music and background sounds for those maps.
The engine takes the names of cities, locations, and maps from the WORLDMAP.MSG and MAP.MSG files. The number of records in these files is not specified anywhere; it's known only that the order of names corresponds to the order of objects in the CITY.TXT, WORLDMAP.TXT and MAPS.TXT files (see diagram).
When the player enters cities or encounters someone in the wasteland, a location map is loaded. The map consists of tiles, on which there are various objects. All this is indicated in the MAP file.
When loading maps, the engine also reads the GAM file with the same time, which holds map variables (MVAR). Some map parameters (including the names of music and background sound files) are located in MAPS.TXT (MAP IDX is the number of the section describing the map in that file). The map script SID is directly pointed to in the MAP file.
For saved maps, it reads the MAP file only the first time the player enters the map. After the game is saved, the location map is already loaded from the SAV file in the savegame. The SAV format is essentially the same as the MAP format.
In the grid of tiles, the floor and ceiling are indicated only by pointers to tiles' PRO files. And in the vicinity of objects, each object on the map (except tiles) indicates its PID, Script ID, FRM ID, and other parameters (see the MAP format description).
Map files also records so-called spatial-scripts. They are attached to individual hexes on the map.
Objects on mapsEdit
Each object in the game has its own prototype (PRO file), which specifies the parameters of the object (see the description of PRO files).
On maps there are six types of objects: items, critters, scenery, walls, tiles, and miscellaneous.
White in the diagram means that all objects have this parameter; green is only some, red is only for critters, and blue is only for items.
Every object has its own image on the map (FRM file, pointed to by FID), as well as a name and description (a pointer to the necessary line in the corresponding MSG file (pro_crit.msg, pro_item.msg, etc.)).
Items also have their images in inventory (INVEN FRM), and critters may have talking head images (HEAD FRM), i.e. images of the face and dialog routine.
Most objects also indicate a script (the Script ID pointer) and sound (ACM file, referred to with Sound ID). The name of the MSG file scripts communicate with (usually these are lines in dialog) matches the name of the script file, so it's believed they are also referred to with Script ID.
In PROTO.MSG there are some names and descriptions related to object parameters.
Messages about wounds and injuries to various parts of the body are located in COMBAT.MSG . The numbers (MSG IDX) of those message which are not dependent upon the type of critter or apply to the player are stored in the game engine. MSG IDX messages naming critter body parts (starting at record 1110) correspond to base_art_num (the second parameter in art\critters\critters.lst) MSG IDX messages about critical hits (starting at record 1450) correspond to critters' Kill type (see PRO file format).
Phrases characters say during combat (combat taunts) are stored in the files COMBATAI.MSG and CMBATAI2.msg (though the latter might not be used). MSG IDX combat taunts are stored in AI.TXT.
Dialogues with some characters have animation and sound. These are called 'talking heads'. Everything starts from their script.
The Script ID parameter is taken from the object on the map, not from the PRO file. The script calling the dialogue also has pointers to a background image (depends on the location the conversation happens on), a MSG file with dialogue cues, 'talking head' facial animations, and the character's attitudes toward the player (reaction).
The dialogue (MSG) file indicates the names of files synchronizing sounds and facial expressions, which, in turn, specify the names of sound files (ACM).
The result of the critter's attitude toward the player is that the character's face can be pleased, angry, or neutral. In the corresponding LIP files the engine performs speech animations along with the character's speech sounds. Referring to a specific image is done with the FRM ID.
Starter character files or premade PCs (characters chosen at the very beginning of the game), are in master.dat\premade\.
There are three "ready-made" characters; each contain three linked files: portrait (FRM), biography (BIO) and attributes (GCD). The files have different extensions, but are named accordingly (filenames are hardcoded in the engine):
combat.* - for Narg stealth.* - for Mingan diplomat.* - for Chitsa
The 'player' object is controlled by the game engine, and is closely tied into it. Everything that isn't coded into the engine is in the following files:
First, the player has his own script running on any map except for the world map.
- VAULT13.GAM contains global variables (GVAR's) for the game, mostly related to the player (reputations, titles, karmic traits, town reputations, states of quests).
- ENDDEATH.TXT contains settings for player death messages.
- GENREP.TXT contains settings for karma ranks (Savior of the Damned, Demon Spawn, etc.).
- KARMAVAR.TXT contains settings for karmic traits (Berserker, Champion, Childkiller, etc.).
- EDITOR.MSG contains names and descriptions of player statistics (on the character creation screen).
- STAT.MSG, TRAIT.MSG, SKILL.MSG, and PERK.MSG contain descriptions of stats, traits, skills, and perks respectively.
Current parameters (inventory, GVARs, karma, stats, skills, abilities, level, experience, etc.) are stored in saved games in a SAVE.DAT file.
There's an interesting object linked to the player - his portable laptop, generally known as the pip-boy. It is also controlled by the engine. It stores information from holodisks, videos, records about quests, and map locations.
There are three files related to holodisks.
HOLODISK.TXT contains settings for holodisks in the pip-boy.
VAULT13.GAM contains GVARs indicating if the holodisk has been read or not.
PIPBOY.MSG contains the names and contents of holodisks.
Quest descriptions are shown in the pip-boy in the Status section. They are divided into groups by the city in which the quests were received.
QUESTS.TXT contains settings for quests in the pip-boy.
VAULT13.GAM contains GVARs, which indicate progress toward completion of the quest.
QUESTS.MSG contains descriptions of quests in the pip-boy.
MAP.MSG contains names of the cities.
A list of parameters (combat behavior and level increases) and PIDs of party members are listed in PARTY.TXT .
Adding an NPC to the party is done by his script. The original Script ID is taken not from the PRO, but from parameters of the object on the map. But when adding to the party or gaining levels, SID is probably taken from the PRO file. NPC PRO files are stored in savegames.
Text used in the 'combat control' settings is stored in CUSTOM.MSG .
Text messages about NPCs gaining levels is in MISC.MSG .
The car is considered a party member, and its PID is in PARTY.TXT.
On the world map driving the car is controlled by the engine (as absurd as that may sound). There are visible changes in movement on the world map after purhasing and upgrading the car, tracking level of fuel, and stopping when out of fuel. A picture of the car appears to the right of the world map when in the car. It's FRM is at art\intrface\WMCARMVE.FRM .
Creating the car on location maps is done by the map script. The car consists of two parts: the trunk, a container (item), and the main part (scenery).
Videos are MVE files. They can be called from scripts, or directly by the engine upon certain events. These use just a video number. These numbers are hardcoded in the engine (and also the names of video files). Each video (or any part of it) can have it's own palette (PAL), which is also coded into the engine.
Each video has its own settings file (CFG), which describes fadeout effects and subtitle files (SVE). They have the same names as the MVE files. Video names (shown in the Pip-Boy) are stored in PIPBOY.MSG.
The slideshow is presented at the end of the game. It narrates the fate of cities and characters in the game.
Slideshow settings are in ENDGAME.TXT.
VAULT13.GAM contains GVARs which indicate what happens to a city.
The slides are in art\intrface\ . It's referred to by list index.
Subtitles for slides are in text files (text\english\game\nar_*.txt).
http://www.teamx.ru/rus/bd/resource_handling.shtml Original document] at teamx.ru (in russian)