BASE.DAT

From UFOpaedia
Revision as of 23:30, 15 May 2008 by MikeTheRed (talk | contribs) (→‎UFO Structure: Added more tracking info to the Item listing)
Jump to navigation Jump to search

UFO Structure

Ripped from Hatfarm / Chris Voss's great pages

BASE.DAT: Each entry is 292 Bytes long

00-0E: Base Name, pretty obvious

0F: Presumably the Null character if the Base Name uses all 15 characters

10: Base's short range detection capability.

12: Base's long range detection capability.

14: Base's hyperwave detection capability.

11, 13, 15: These are probably the high bytes for the Short, Long, and Hyper-wave detections respectively. Should always be 0 as a value of 100 (hex: 64 00) is perfect detection.

Logical values for the detection capabilities:

10 short, 0 long: This base has small radar(s) only.

20 short, 20 long: This base has large radar(s) only.

30 short, 20 long: This base has small and large radar(s).

100 hyperwave: This base has a hyperwave decoder(s).

The radar values can be set to 100 for perfect short range detection (presumably -- it definitely makes UFOs appear more often), but these reset to the correct values any time you complete a build in that base.

Table 1: Radar Ability Combinations
Radar Module / Scan Type Short Long Hyperwave
Small Radar 10 0 0
Large Radar 20 20 0
Hyperwave 0 0 100
Radar Combinations
Sm + Sm 10 0 0
Sm + Lg 30 20 0
Sm + Hyp 10 0 100
Lg + Lg 20 20 0
Lg + Hyp 20 20 100
Hyp + Hyp 0 0 100
Sm + Lg + Hyp 30 20 100


16-39: The next offsets are arranged so they're easier to understand. They are for facilities in the base:

16 17 18 19 1A 1B
1C 1D 1E 1F 20 21
22 23 24 25 26 27
28 29 2A 2B 2C 2D
2E 2F 30 31 32 33
34 35 36 37 38 39

The possible values are as follows:

00 - Access Lift
01 - Living Quarters
02 - Laboratory
03 - Workshop
04 - Small Radar System
05 - Large Radar System
06 - Missile Defense
07 - General Stores
08 - Alien Containment
09 - Laser Defense
0A - Plasma Defense
0B - Fusion Ball Defense
0C - Grav Shield
0D - Mind Shield
0E - Psionic Laboratory
0F - Hyper-wave Decoder
10 - Hangar (Top Left)
11 - Hangar (Top Right)
12 - Hangar (Bottom Left)
13 - Hangar (Bottom Right)
FF - Empty

3A-5D: The next offsets represent the days until a facility is completed. They're set up the same way:

3A 3B 3C 3D 3E 3F
40 41 42 43 44 45
46 47 48 49 4A 4B
4C 4D 4E 4F 50 51
52 53 54 55 56 57
58 59 5A 5B 5C 5D

Possible values are 00 to FF. Empty spaces must have a FF value in their corresponding offset.

The following are the rest of the offsets I know. There are holes in the numbering but I have no idea what they are. With the exception of scientists and technicians, which are one byte each, all values are 2-byte signed little-endian values (-32,768 to +32,767). Example: 05 00 should be read as 0005; FE FF should be read as FFFE (-2).

It should be noted that despite the range of values a two-byte signed field gives you, due to a known issue, you cannot have more than 9,999 units of a given item in storage at any given base, regardless of what item it is.

Here's the info for bytes 5E-11E. The Record Number (Rec#) is used for e.g. PRODUCT.DAT:

  Hex   Dec  Rec#  Item
 ----   ---  ----  ----
 005E    94    -   Engineer
 005F    95    -   Scientist
 0060    96    0   Stingray Launcher
 0062    98    1   Avalanche Launcher
 0064   100    2   Cannon
 0066   102    3   Fusion Ball Launcher
 0068   104    4   Laser Cannon
 006A   106    5   Plasma Beam
 006C   108    6   Stingray Missile
 006E   110    7   Avalanche Missile
 0070   112    8   Cannon Rounds
 0072   114    9   Fusion Balls
 0074   116   10   Tank/Cannon
 0076   118   11   Tank/Rocket Launcher
 0078   120   12   Tank/Laser Cannon
 007A   122   13   Hovertank/Plasma
 007C   124   14   Hovertank/Launcher
 007E   126   15   Pistol
 0080   128   16   Pistol Clip
 0082   130   17   Rifle
 0084   132   18   Rifle Clip
 0086   134   19   Heavy Cannon
 0088   136   20   HC-AP Ammo
 008A   138   21   HC-HE Ammo
 008C   140   22   HC-IN Ammo
 008E   142   23   Auto Cannon
 0090   144   24   AC-AP Ammo
 0092   146   25   AC-HE Ammo
 0094   148   26   AC-IN Ammo
 0096   150   27   Rocket Launcher
 0098   152   28   Small Rocket
 009A   154   29   Large Rocket
 009C   156   30   Incendiary Rocket
 009E   158   31   Laser Pistol
 00A0   160   32   Laser Rifle
 00A2   162   33   Heavy Laser
 00A4   164   34   Grenade
 00A6   166   35   Smoke Grenade
 00A8   168   36   Proximity Grenade
 00AA   170   37   High Explosive
 00AC   172   38   Motion Scanner
 00AE   174   39   Medi-Kit
 00B0   176   40   Psi-Amp
 00B2   178   41   Stun Rod
 00B4   180   42   Electro Flare
   (6 unknown records)
 00C2   194   49   Heavy Plasma
 00C4   196   50   Heavy Plasma Clip
 00C6   198   51   Plasma Rifle
 00C8   200   52   Plasma Rifle Clip
 00CA   202   53   Plasma Pistol
 00CC   204   54   Plasma Pistol Clip
 00CE   206   55   Blaster Launcher
 00D0   208   56   Blaster Bomb
 00D2   210   57   Small Launcher
 00D4   212   58   Stun Bomb
 00D6   214   59   Alien Grenade
 00D8   216   60   Elerium-115
 00DA   218   61   Mind Probe
   (3 unknown records)
 00E2   226   65   Sectoid Corpse
 00E4   228   66   Snakeman Corpse
 00E6   230   67   Ethereal Corpse
 00E8   232   68   Muton Corpse
 00EA   234   69   Floater Corpse
 00EC   236   70   Celatid Corpse
 00EE   238   71   Silacoid Corpse
 00F0   240   72   Chryssalid Corpse
 00F2   242   73   Reaper Corpse
 00F4   244   74   Sectopod Corpse
 00F6   246   75   Cyberdisc Corpse
   (4 unknown records)
 0100   256   80   UFO Power Source
 0102   258   81   UFO Navigation
 0104   260   82   UFO Construction
 0106   262   83   Alien Food
 0108   264   84   Alien Reproduction
 010A   266   85   Alien Entertainment
 010C   268   86   Alien Surgery
 010E   270   87   Examination Room
 0110   272   88   Alien Alloys
 0112   274   89   Alien Habitat
 0114   276   90   Personal Armour
 0116   278   91   Power Suit
 0118   280   92   Flying Suit
 011A   282   93   HWP Cannon Shell
 011C   284   94   HWP Rockets
 011E   286   95   HWP Fusion Bomb

0120-0123: I have no idea, any help would be appreciated.

TFTD Structure

BASE.DAT: Each entry is 296 Bytes long.

00-0E: Base Name, pretty obvious.

0F: Null character if the Base Name uses all 15 characters. If this byte is non-0, the base name will happily overflow and read from the item quantities.

10-D3: Quantity of each item available at that base (signed 2-byte little-endian integers; see explanation in UFO section for details).

10  Ajax Launchers
12  D.U.P. Head Launcher
14  Craft Gas Cannon
16  P.W.T. Cannon
18  Gauss Cannon
1A  Sonic Oscillator
1C  Ajax Torpedoes
1E  D.U.P. Head Torpedoes
20  Gas Rounds(x50)
22  P.W.T Ammo
24  Coelacanth/G. Cannon
26  Coelacanth/Aqua Jet
28  Coelacanth/Gauss
2A  Displacer /Sonic
2C  Displacer /P. W. T.
2E  Dart Gun
30  Dart Clip
32  Jet Harpoon
34  Harpoon Clip
36  Gas Cannon
38  GC-AP Bolts
3A  GC-HE Bolts
3C  GC-Phosphorous Bolts
3E  Hydro-Jet Cannon
40  HJ-AP Ammo
42  HJ-HE Ammo
44  HJ-P Ammo
46  Torpedo Launcher
48  Small Torpedo
4A  Large Torpedo
4C  Phosphor Torpedo
4E  Gauss Pistol
50  Gauss Rifle
52  Heavy Gauss
54  Magna-Blast Grenade
56  Dye Grenade
58  Particle Disturbance Grenade
5A  Magna-Pack Explosive
5C  Particle Disturbance Sensor
5E  Medi-Kit
60  M.C. Disruptor
62  Thermal Tazer
64  Chemical-flare
66  Vibro Blade
68  Thermic Lance
6A  Heavy Thermic Lance
6C  (invalid - prints garbage if used)
6E  (invalid - prints garbage if used)
70  (invalid - prints garbage if used)
72  Sonic Cannon
74  Cannon Power Clip
76  Sonic-Blasta Rifle
78  Blasta Power Clip
7A  Sonic Pistol
7C  Pistol Power Clip
7E  Disruptor Pulse Launcher
80  Disruptor Ammo
82  Thermal Shok Launcher
84  Thermal Shok Bomb
86  Sonic Pulser
88  Zrbite
8A  M.C. Reader
8C  Gauss Pistol Clip
8E  Gauss Rifle Clip
90  Heavy Gauss Clip
92  Aquatoid Corpse
94  Gill Man Corpse
96  Lobster Man Corpse
98  Tasoth Corpse
9A  Calcinite Corpse
9C  Deep One Corpse
9E  Bio-Drone Corpse
A0  Tentaculat Corpse
A2  Triscene Corpse
A4  Hallucinoid Corpse
A6  Xarquid Corpse
A8  (invalid - prints ' Technician' if used)
AA  (invalid - prints ' Squad Leader' if used)
AC  (invalid - prints ' Soldier' if used)
AE  (invalid - prints ' Terrorist' if used)
B0  Ion-Beam Accelerators
B2  Magnetic Navigation
B4  Alien Sub Construction
B6  Alien Cryogenics
B8  Alien Cloning
BA  Alien Learning Arrays
BC  Alien Implanter
BE  Examination Room
C0  Aqua Plastics
C2  Alien Re-animation Zone
C4  Plastic Aqua Armour
C6  Ion Armour
C8  Mag. Ion Armour
CA  Solid Harpoon Bolts
CC  Aqua Jet Missiles
CE  P.W. Torpedo
D0  Gauss Cannon Ammo
D2  (invalid - prints 'Gauss Cannon Ammo' if used)

D4-D9: Unknown.

DA-FD: The next offsets are arranged so they're easier to understand. They are for facilities in the base:

DA DB DC DD DE DF
E0 E1 E2 E3 E4 E5
E6 E7 E8 E9 EA EB
EC ED EE EF F0 F1
F2 F3 F4 F5 F6 F7
F8 F9 FA FB FC FD

The possible values are as follows:

00 - Air Lock
01 - Living Quarters
02 - Laboratory
03 - Workshop
04 - Standard Sonar
05 - Wide Array Sonar
06 - Torpedo Defences
07 - General Stores
08 - Alien Containment
09 - Gauss Defences
0A - Sonic Defences
0B - P.W.T. Defences
0C - Bomb Shield
0D - M.C. Defences
0E - M.C.-Lab
0F - Transmission Resolver
10 - Sub Pen (Top Left)
11 - Sub Pen (Top Right)
12 - Sub Pen (Bottom Left)
13 - Sub Pen (Bottom Right)
FF - Empty

FE-121: The next offsets represent the days until a facility is completed. They're set up the same way:

FE FF 100 101 102 103
104 105 106 107 108 109
10A 10B 10C 10D 10E 10F
110 111 112 113 114 115
116 117 118 119 11A 11B
11C 11D 11E 11F 120 121

Possible values are 00 to FF. Empty spaces must have a FF value in their corresponding offset.

0122: Number of technicians (00-FF).

0123: Number of scientists (00-FF).

0124-0127: Unknown.

See Also