PRODUCT.DAT (TFTD)

From UFOpaedia
Jump to: navigation, search

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:

  • 3Ch = Zbrite
  • 58h = Aqua Plastics
  • 50h = Ion-Beam Accellerators
  • 51h = Magnetic Navigation
  • FFh = null (no prereq)
For example, the Leviathan's bytes 8-13 read: 58h, 50h, 51h, 78h, 2, 1. It needs 120 Aqua Plastics, 2 Ion Accelerators, and 1 Mag. 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 PWT Launcher manufacture bug: The PWT Launcher does not require an Aqua Plastic for the first one made (as shown on the Build screen), but subsequent PWT Launchers made in the same batch run do require an Alloy. For the PWT Launcher (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 PWT Launcher 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 Plastic saved for each FBL manufacturing job - and get back to work saving the world. See Fusion Ball Launcher (FBL) manufacturing "bug". Courtesy of Zombie: The Executable's source bytes for PRODUCT.DAT's FBL are ------- in MS-Edit with 100 columns or ----- 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. This is a record index (not byte index) into the Stores section of BASE.DAT. To convert this value to a byte offset into BASE.DAT, x 2 (Stores section record length = 2 bytes) and add 16 (BASE.DAT header length = 16 bytes).

15 (1 Byte): Unknown - always 1? [Not used]

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? [Not used]

File Dump

PRODUCT.DAT (TFTD)

Record|Start Cost |EngHrs |Wkspc |Material Required |BD | ? |Build?|  Description/Notes
       00 01 02 03  04 05  06 07  08 09 10 11 12 13  14  15  16 17

    0: 50 B1 03 00  90 01  06 00  FF 58 FF 00 01 00  03  01  01 00  PWT Launcher (craft)
    1: F0 C6 02 00  2C 01  06 00  FF FF FF 00 00 00  04  01  01 00  Gauss Cannon
    2: D0 72 03 00  F4 01  08 00  3C FF FF 0F 00 00  05  01  01 00  Sonic Oscillator
    3: 60 6D 00 00  58 02  06 00  3C FF FF 04 00 00  09  01  01 00  PWT Launcher ammo
    4: 20 A1 07 00  B0 04  19 00  FF FF FF 00 00 00  0C  01  01 00  Coelacanth/Gauss
    5: 50 F8 0C 00  B0 04  1E 00  3C 58 FF 1E 05 00  0D  01  01 00  Displacer/Sonic
    6: A0 BB 0D 00  78 05  1E 00  3C 58 FF 19 08 00  0E  01  01 00  Displacer/PWT
    7: 98 3A 00 00  90 01  19 00  3C 58 FF 05 08 00  5F  01  01 00  PW Torpedo (SWS)
    8: 40 1F 00 00  2C 01  02 00  FF FF FF 00 00 00  1F  01  01 00  Gauss Pistol
    9: 20 4E 00 00  90 01  03 00  FF FF FF 00 00 00  20  01  01 00  Gauss Rifle
   10: 00 7D 00 00  BC 02  04 00  FF FF FF 00 00 00  21  01  01 00  Heavy Gauss
   11: D0 84 00 00  DC 00  04 00  FF FF FF 00 00 00  26  01  01 00  Disturbance Sensor
   12: 60 6D 00 00  A4 01  04 00  FF FF FF 00 00 00  27  01  01 00  Medi-kit
   13: 00 71 02 00  F4 01  04 00  3C 58 FF 02 01 00  28  01  01 00  M.C. Disruptor
   14: 90 DC 01 00  E8 03  04 00  58 FF FF 01 00 00  31  01  01 00  Sonic Cannon
   15: 70 17 00 00  50 00  04 00  3C FF FF 03 00 00  32  01  01 00  Cannon Power Clip
   16: C0 57 01 00  34 03  04 00  58 FF FF 01 00 00  33  01  01 00  Sonic Blasta Rifle
   17: B8 0B 00 00  50 00  04 00  3C FF FF 02 00 00  34  01  01 00  Blasta Power Clip
   18: C0 DA 00 00  58 02  03 00  58 FF FF 01 00 00  35  01  01 00  Sonic Pistol
   19: D0 07 00 00  3C 00  04 00  3C FF FF 01 00 00  36  01  01 00  Pistol Power Clip
   20: 90 5F 01 00  B0 04  05 00  58 FF FF 01 00 00  37  01  01 00  Disruptor Pulse Launcher
   21: 40 1F 00 00  DC 00  03 00  3C FF FF 03 00 00  38  01  01 00  Disruptor Ammo
   22: B0 30 01 00  84 03  03 00  58 FF FF 01 00 00  39  01  01 00  Thermal Shok Launcher
   23: 58 1B 00 00  C8 00  02 00  3C FF FF 01 00 00  3A  01  01 00  Thermal Shok Bomb
   24: 2C 1A 00 00  C8 00  02 00  3C FF FF 02 00 00  3B  01  01 00  Sonic Pulsar
   25: 70 FF 03 00  B0 04  04 00  3C 58 FF 01 01 00  3D  01  01 00  M.C. Reader
   26: F0 55 00 00  20 03  0C 00  58 FF FF 04 00 00  5A  01  01 00  Plastic Aqua Armor
   27: 10 A4 00 00  E8 03  10 00  58 3C FF 05 05 00  5B  01  01 00  Ion Armor
   28: 90 E2 00 00  78 05  10 00  58 3C FF 05 10 00  5C  01  01 00  Magnetic Ion Armor
   29: B8 0B 00 00  64 00  0A 00  FF FF FF 00 00 00  58  01  01 00  Aqua Plastics
   30: D0 FB 01 00  78 05  16 00  58 3C FF 05 10 00  50  01  01 00  Ion-Beam Accelerators
   31: F0 49 02 00  40 06  12 00  58 FF FF 03 00 00  51  01  01 00  Magnetic Navigation
   32: 80 1A 06 00  B0 36  1E 00  58 50 51 41 01 01  C9  01  01 00  HAMMERHEAD
   33: C0 27 09 00  50 46  22 00  58 50 51 55 01 01  CC  01  01 00  MANTA
   34: A0 BB 0D 00  D0 84  24 00  58 50 51 78 02 01  CA  01  01 00  LEVIATHAN
   35: E8 03 00 00  14 00  03 00  FF FF FF 00 00 00  3E  01  01 00  Gauss Pistol Clip
   36: D0 07 00 00  2D 00  04 00  FF FF FF 00 00 00  3F  01  01 00  Gauss Rifle Clip
   37: A0 0F 00 00  46 00  04 00  FF FF FF 00 00 00  40  01  01 00  Heavy Gauss Clip
   38: 58 1B 00 00  96 00  03 00  3C FF FF 01 00 00  2B  01  01 00  Vibro Blade
   39: E0 2E 00 00  DC 00  03 00  3C FF FF 02 00 00  2C  01  01 00  Thermic Lance
   40: 20 4E 00 00  2C 01  03 00  3C FF FF 02 00 00  2D  01  01 00  Heavy Thermic Lance
   41: C8 00 00 00  05 00  02 00  FF FF FF 00 00 00  60  01  01 00  Gauss Cannon Ammo 
   42: 10 27 00 00  78 00  04 00  FF FF FF 00 00 00  61  01  01 00  {unused}