Browsing the gamefiles

Overview
Lost Alpha afficionados sometimes want to have a closer look at the internals of the game. Reasons for that may be a deeper insight into the game mechanics ("How does a silencer influence my weapon's performance?") or simply to document basic item properties ("What is the base price for that armor?").

This article is intended as a guide for the first steps.

Getting the tools
Prerequisite is an installation of Lost Alpha on your harddrive. Lets refer to the folder the game is installed in as the game_folder. Inside the game_folder you will see the file fsgame.ltx and the folder gamedata, just to make sure you have picked the correct one.

Now you need to get an unpacker as the gamefiles are stored in a packed format. Lost Alpha uses the same format as the canon S.T.A.L.K.E.R. games, so there are great numbers of suitable programs. I was using:
 * STALKER Data Unpacker (but not able to unpack the mods in 1.4007)
 * SoCPUP

But any other unpacker should work as well, just make sure it will be able to unpack the xdb format as well, not only the db format.

Install the unpacker to your computer and create a new folder on your harddrive, let's call it files_folder. The files_folder should be not inside the game_folder.

Unpacking the base gamefiles
Now extract all the files in the game_folder with the extension .db* (i.e. .db0, .db1, .db2, you get the pattern) to the files_folder. Up to v1.4002 all the files to extract were in the game_folder named gamedata.db*, starting with v1.4005 some moved with new names into the game_folder\gamedata folder. Please leave files in other folders (especially game_folder\mods) alone for now.

The exact procedure for extraction of course depends on the unpacker. Some examples: STALKER_Data_Unpacker_EN.exe game_folder\gamedata.db0 files_folder SoCPUP.exe -dir files_folder -unpack game_folder\gamedata.db0

Unpacking the mods
Lost Alpha v1.4007 comes with some out-of-the-box mods, stored in the identically named folder as .xdb archives.

You may want to extract them as well to get the gamefiles for the Lost Alpha version you have installed. Unpack those .xdb* files in the same way as the gamefiles. As these mods will overwrite some of the base gamefiles it is a good idea to extract the base gamefiles first, then copy the files_folder to a new folder and extract the mods into that new folder. So you have the base gamefiles and the modded gamefiles in separate folders.

Understanding the gamefiles
First thing you need is a good text editor with the capability to search in files. My editor of choice is Notepad++. Second thing is an image viewer (I prefer IrfanView, with plugins installed) and an image editor (I use GIMP, with the gimp-dds plugin).

For the casual explorer and wiki contributor there are four types of interesting files:
 * .ltx - the main configuration files containing most of the properties
 * .xml - the language-dependent texts displayed in the game
 * .dds - the textures and images displayed in the game
 * .script - the scripts that implement some of the game mechanics

Finding specific items
Let's say you want to find out about the SGI 5k.

You open your editor and use the functionality to search in files. For Notepad++ this is Search->Find in Files. Enter "SGI 5k" (or "SG-550" for v1.4005 and up) as search text, "*.xml" as filter for files and files_folder\config as directory to search in. One of the hits is in the file files_folder\config\text\eng\string_table_enc_weapons.xml, the line is SG-550. Open that file in the editor and navigate to the line. You will see a snippet like this:  SG-550

Search again in files, now for "wpn-sig550", "*.ltx" as filter and files_folder\config as directory. Now the hit is in file files_folder\config\weapons\w_sig550.ltx. Open that file and you will see the attributes of the SGI 5k.

Understanding item definitions
Understanding the file is quite easy. An ltx file contains the attributes for one or more objects. An object is identified by a line like [wpn_sig550]:weapon_base,weapon_5.56x45,weapon_m209

This means, the SGI has the internal ID wpn_sig550 and it inherits properties from the objects with the internal IDs weapon_base, weapon_5.56x45 and weapon_m209. The properties are listed below that line in form of name-value pairs like inv_name = wpn-sig550 or ammo_mag_size = 20.

Inheritance works as to be expected. Say you want to see what type of ammunition the SIG uses. So you look below the [wpn_sig550] for a property named ammo_class, but you won't find it. So you start looking in the first of the parent objects by searching for the file containing [weapon_base], but you won't find it there either (make sure you just look at the lines between [weapon_base] and the start of the next object [...]). So continue with the second object and there you will find a line like ammo_class = ammo_5.56x45_ss190,... To be exact you will need to also look into the third and last parent object as the inheritance works on last-one-wins basis.

Images
Images are a bit difficult in Lost Alpha (or XRay-based games in general). Just two examples:

The inventory icon of items is stored in the file files_folder\textures\ui\ui_icon_equipments.dds. The file contains all the inventory icons in one big file, so you need the coordinates of a specific item's icon. They are usually stored in the properties inv_grid_x, inv_grid_y, inv_grid_width and inv_grid_height. Multiply the values with 50 and you get the X/Y coordinates and width/height of the icon. With these values you can cut the inventory icon with an image editor like Gimp.

The upgrade icon of items are defined a bit different. Look for the property upgr_icon and search for the value in XML files. For the SIG you will find a hit in files_folder\config\ui\ui_upgrade_icons.xml. Open that file and look for the enclosing  tag. This will tell you to open the image files_folder\textures\ui\repair_wnd\ui_actor_weapons.dds, the coordinates in that DDS are directly stored with the  tag.