Difference between revisions of "PRODUCT.DAT"

From UFOpaedia
Jump to navigation Jump to search
(Thanks for the pointer on the Talk page, Tifi - I dug a little deeper, take a look)
(Added mention of file where prereqs index into.)
Line 12: Line 12:
 
'''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).
 
'''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):
+
'''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
 
:*60 = E115
 
:*88 = Alloys
 
:*88 = Alloys

Revision as of 01:01, 15 May 2008

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.

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.
Here we also see the possible 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 the file), bytes 8-13 read: 255, 88, 255, 0, 1, 0. It is the only product 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 looking for prerequisites as soon as it encounters a null one - but subsequently the manufacturing code does check all 3 prerequisite columns.

14 (1 Byte): Item type manufactured. What set of numbers is this pointing to? Please insert if you know. -RK

15 (1 Byte): Unknown - always 1?

16 (1 Byte?): Build flag

  • 0 - Can be built
  • 1 - Cannot be built (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