PRODUCT.DAT

From UFOpaedia
Revision as of 17:15, 25 February 2009 by MikeTheRed (talk | contribs) (Added GEOSCAPE link per Emphyrio)
Jump to navigation Jump to search

Product.dat holds information on the manufacturable items in the game, such as the time needed to build. To modify the stats of items made here look at OBDATA.DAT.

Most (if not all) of this info was obtained from Hatfarm's website. There are still values that are unknown in their function.

The PRODUCT.DAT data can also be found at offset 355596 in the vanilla 1.4 GEOSCAPE.EXE.

Structure

Each entry is 18 bytes long with 35 entries totaling 630 bytes. Values are presented according to byte offset (0 to 17).

0-3 (4 Bytes): Cost to manufacture item, in low-to-high byte format ([0] x 1, [1] x 256, [2] x 2562, [3] x 2563). This is the cost shown on the Build screen. Byte 3 is always 0; the most costly item requires 900k (2563 = 16.8 million).

4-5 (2 Bytes): Engineering Hours needed to complete one item (low byte, high byte)

6-7 (2 Bytes): Work space needed (low byte, high byte). It's conjecture that Byte 7 is the high byte for Byte 6; it's always 0. No item comes close to needing 256 work spaces (36 is the max).

8-13 (6 Bytes): An odd data-packing scheme to show manufacturing prerequisites. Bytes 8-10 show the prequisite; the matching Bytes 11-13 show how many are needed. Here, "matching" means whether it's the 1st, 2nd, or 3rd byte. Possible values for prerequisites (Bytes 8-10) - indexes into BASE.DAT:

  • 60 = E115
  • 88 = Alloys
  • 80 = Power Source
  • 81 = Navigation
  • 255 = null (no prereq)
For example, the Avenger's bytes 8-13 read: 88, 80, 81, 120, 2, 1. It needs 120 Alloys, 2 PSs, and 1 Nav.
This is an odd packing scheme because they used 6 bytes to show values for only 4 possible prerequisites. They could've just used 4 bytes, with each one specific to the four prereq types. Possibly they were originally thinking of having many more types of prequisites (but any one item could only have a max of 3 prerequisites). Perhaps e.g. TFTD has more prereqs. In any event, it's interesting inasmuch as it's a rare(?) example of X-COM packing data that should have been in an external list (per relational database rules) into its parent flat file. A somewhat similar example can be found with ammo requirements in bytes 25-28 of OBDATA.DAT.
Note that these bytes are also the cause of the Fusion Ball Launcher (FBL) manufacturing "bug". The FBL does not require an Alien Alloy for the first FBL made (as shown on the Build screen), but subsequent FBLs made in the same batch run do require an Alloy. For the FBL (the first Product in this file), bytes 8-13 read: 255, 88, 255, 0, 1, 0. It is the only PRODUCT.DAT item that does not have all its prerequisites shifted to the left (i.e., byte 8 is never null if there is a prequisite, for everything but the FBL). Apparently the Build screen itself (and the first item made) is coded to stop checking prerequisites as soon as it finds a null prereq - but subsequently the manufacturing code does check all 3 prerequisite columns. Editing PRODUCT.DAT to shift the Alloy prereq "left" fixes the problem (the first FBL shows, and uses, one Alloy). This fix only affects new production jobs; current jobs are stored in BPROD.DAT. Also note that the source data for PRODUCT.DAT is stored in the .EXE; you'd have to edit the executable to permanently fix the bug. Or just consider it a tiny gift from the programmers - one Alloy saved for each FBL manufacturing job - and get back to work saving the world. Courtesy of Zombie: The Executable's source bytes for PRODUCT.DAT's FBL are 459821-459838 in MS-Edit with 100 columns or 459720-459737 normally. Just look for 255, 88, 255 and that'll be the start of the mess. This is for the CE executable. If you have the DOS version, simply search for the three numbers above and you should find it near the end of Geoscape.exe.

14 (1 Byte): Item type manufactured. Indexes into BASE.DAT.

15 (1 Byte): Unknown - always 1?

16 (1 Byte?): Researched / Can Build flag. At the start of game, all values are set to 1.

  • 0 - Can be built
  • 1 - Cannot be built (yet; needs research)

17 (1 Byte): Unknown - always 0?

List of Entries

Again ripped from Hatfarm's website

 1 - Fusion Ball Launcher
 2 - Laser Cannon
 3 - Plasma Cannon
 4 - Fusion Ball
 5 - Tank/Laser Cannon
 6 - Hovertank/Plasma
 7 - Hovertank/Launcher
 8 - HWP Fusion Bomb
 9 - Laser Pistol
10 - Laser Rifle
11 - Heavy Laser
12 - Motion Scanner
13 - Medi-kit
14 - Psi-Amp
15 - Heavy Plasma
16 - Heavy Plasma Clip
17 - Plasma Rifle
18 - Plasma Rifle Clip
19 - Plasma Pistol
20 - Plasma Pistol Clip
21 - Blaster Launcher
22 - Blaster Bomb
23 - Small Launcher
24 - Stun Bomb
25 - Alien Grenade
26 - Mind Probe
27 - Personal Armour
28 - Power Suit
29 - Flying Suit
30 - Alien Alloys
31 - UFO Power Source
32 - UFO Navigation
33 - FIRESTORM
34 - LIGHTNING
35 - AVENGER

See Also