Jump to content

Linking table between Craft Loadout and Race Type buildup


Maurice76

Recommended Posts

After some more thorough analysis of the GeoScape.exe, I've managed to identify a data range that links the Craft Loadout of USO's (including those that spawn Terror missions - and Artefact sites are spawned by Terror ships as well, with a little twist) to the Alien Stats table.

 

In DOS v1.0 of TFTD, starting from address 76DD6h is a string of 98 bytes that takes care of this. Together with 2 padding bytes at the start of the string, these 98 bytes can be split up in 16 bytes per Race Type. Doing as such yields the following table:

 

Race type All missions except surface missions

Comm. Navi. Medic Tech. Sq.L. Sold. Terr1 Terr2

0 Aquatoid 12 00 11 00 10 00 09 00 08 00 07 00 00 00 00 00

1 Gill Man 16 00 15 00 14 00 14 00 13 00 13 00 02 00 02 00

2 Lobster Man 21 00 20 00 19 00 18 00 19 00 17 00 04 00 04 00

3 Tasoth 23 00 23 00 22 00 23 00 23 00 22 00 04 00 04 00

4 Mixed Tasoth 00 00 00 00 08 00 07 00 23 00 22 00 04 00 04 00

5 Mixed Lobster 03 00 02 00 04 00 07 00 18 00 17 00 04 00 00 00

 

Each set of 2 columns is assigned to an alien rank. Alien Rank together with Race Type determine a specific value in this table.

 

These values each link directly into the Alien Stats table for TFTD. For completeness sake, the Alien Stats table for TFTD looks like this (I've omitted the 39 stats for each unit, just kept the number and name):

00 Hallucinoid Terrorist

01 Calcinite Terrorist

02 Xarquid Terrorist

03 Deep One Terrorist

04 Tentaculat Terrorist

05 BioDrone Terrorist

06 Triscene Terrorist

07 Aquatoid Soldier

08 Aquatoid Squad Leader

09 Aquatoid Technician

10 Aquatoid Medic

11 Aquatoid Navigator

12 Aquatoid Commander

13 Gillman Soldier

14 Gillman Squad Leader

15 Gillman Technician

16 Gillman Commander

17 Lobster Man Soldier

18 Lobster Man Squad Leader

19 Lobster Man Technician

20 Lobster Man Navigator

21 Lobster Man Commander

22 Tasoth Soldier

23 Tasoth Squad Leader

24 Coelacanth Tank

25 Male Civs

26 Female Civs

27 Displacer Tank

 

This table is used for any mission at a Touchdown depth deeper than 0. Missions with a Touchdown depth of 0 are all surface missions (before a mission starts with a USO that is "Touched Down", the Touchdown Depth is changed from 0 to randomly 1 or 2) and when it generates aliens for those surface missions, it will alter the values read from the table during runtime. The alteration is to raise all values that are below 5 in the above table by 1, with Mixed Tasoth being a special snowflake: instead of raising it by 1, those values are randomly raised by 1 or 2 (the value is re-randomized for every alien). The table then would look like this:

 

Race type All surface missions

Comm. Navi. Medic Tech. Sq.L. Sold. Terr1 Terr2

0 Aquatoid 12 00 11 00 10 00 09 00 08 00 07 00 01 00 01 00

1 Gill Man 16 00 15 00 14 00 14 00 13 00 13 00 03 00 03 00

2 Lobster Man 21 00 20 00 19 00 18 00 19 00 17 00 05 00 05 00

3 Tasoth 23 00 23 00 22 00 23 00 23 00 22 00 05 00 05 00

4 Mixed Tasoth XX 00 XX 00 08 00 07 00 23 00 22 00 YY 00 YY 00

5 Mixed Lobster 04 00 03 00 05 00 07 00 18 00 17 00 05 00 01 00

 

The value for XX is either 1 or 2, the value for YY is either 5 or 6. Mixed Tasoth Terror missions never have Commanders, but they will have Navigators (1 to be precise, if I am not mistaken - there is one Navigator listed in the Battleship Craft Loadout, the Craft responsible for carrying out Terror Missions - unless I am mistaken in where the game deploys Mixed Tasoth crews). Notice that when it generates a Terror Mission, it will replace the Navigator by either a Calcinite or a Xarquid - essentially allowing the possibility to generate a Xarquid in a surface mission.

 

I suspect that they wanted to have random Terrorists in the mission, by spawning either Bio-Drones or Triscenes, but then overlooked the Navigator in the process. In about 50% of the missions, it would probably not even be noticed, as it would spawn a Calcinite. Looking at the code, the easiest way to fix it is simply by setting the Alien stats link value of the Navigator from 00 to 23.

 

P.S.:

Note that the alien ranks listed above the tables and also used in the Alien Stats table are just references to different versions of a given alien. This is most clear for Tasoths, which use only 2 versions (designated as Soldiers and Squad Leaders) and other ranks simply refer to one of those 2, mostly the Squad Leader variant. In many cases, the rank listed in the Alien Stats table doesn't match the position within the table, because it's no more than a variant counter of the alien in question. Maybe it was used initially (original UFO?), but it seems that the rank table in the Alien Stats listing has no purpose (anymore), given that some of them occur in multiple places in the table.

Link to comment
Share on other sites

I was wrong about my last claim. That Rank column is the very thing that defines the rank of the alien. The columns in the race type buildup are only types 1 through 8, unrelated to Alien rank. For instance, the Tasoth lineup features four entries of 23, two entries of 22 and two entries of 0. When the game spawns Aliens of this race buildup, all 23's will show up ingame as Tasoth Squad Leaders and all 22's will show up as Tasoth Soldiers. The Alien Stats table I listed above has all the Race and Rank combinations that the game knows.

 

Also, when I wrote that in order to fix the Xarquid spawn on Terror Missions with the Mixed Tasoth Race type, I overlooked one detail: the same line is also responsible for populating Alien Colony Stage 1 missions. Replacing the 0 by a 23 effectively means that all Hallucinoid Terrorists will be replaced by Tasoth Squad Leaders instead. So to really fix it, the number of Aliens in the Alien Deployment table for Colony Stage 1 missions needs to be adjusted as well. Type 5 needs to be reduced and Type 1 needs to be increased, to retain the same number of Tasoth Squad Leaders and Hallucinoids in that particular mission.

 

In the default setting, the game spawns this many Tasoth Squad Leaders for Colony Stage 1 missions:

Beginner/Experienced: 3 + rand [2]

Veteran/Genius: 3 + rand [2]

Superhuman: 4 + rand [2]

 

And this many Hallucinoids:

Beginner/Experienced: 3 + rand [1]

Veteran/Genius: 4 + rand [1]

Superhuman: 6 + rand [1]

 

So, to really fix the issue of the Xarquid spawning in a surface mission while leaving Colony Stage 1 untouched, the following adjustments are needed:

 

Clear the spawn type 5 from the Colony Stage 1 deployment table:

68D84h: 03 -> 00 (this indicates the number to spawn at Beginner/Experienced)

68D85h: 04 -> 00 (this indicates the number to spawn at Superhuman)

68D86h: 02 -> 00 (this is the random amount of extra aliens of this type to spawn)

 

Adjust type 2 to spawn all Tasoth Squad Leaders for Colony Stage 1:

68DC3h: 02 -> 03

68DC4h: unchanged

68DC5h: 01 -> 02

 

And change their Weapon Loadouts of Type 2 to that of Type 5:

68DCCh: 2A -> 22 (Sonic Cannon)

68DCDh: 2B -> 23 (Sonic Cannon Power Clip)

68DCEh: 2B -> 23

68DCFh: 2B -> 2C (Sonic Pulser)

68DD0h: 2B -> 00

2A is the Thermal Shock Launcher, 2B the ammunition for it.

68DD1h: 28 -> 1E (Heavy Thermic Lance)

68DD2h: 29 -> 2C

68DD3h: 29 -> 2C

68DD4h: 29 -> 2C

68DD5h: 29 -> 2E (M.C. Reader)

28 is the Disruptor Pulse Launcher and 29 its ammunition. Soldiers already carry this in many cases.

 

Adjust type 1 to spawn all Hallucinoid Terrorists for Colony Stage 1:

68DD8h: 01 -> 03

68DD9h: 02 -> 06

68DDAh: unchanged

 

And finally, adjust the Alien Race Type buildup table for the Mixed Tasoth so Type 2 is no longer referring to Hallucinoid Terrorists, but rather to Tasoth Squad Leaders:

76E1Ah: 00 -> 17

 

P.S.: the amount of aliens to spawn at Veteran and Genius levels is simply the sum of the number to spawn at Beginner/Experienced and to spawn at Superhuman, dividing by 2 and truncating the outcome.

 

P.S. 2: Note that there is a bug with regards to Type 1 aliens for Alien Colony Stage 1 missions. Even though it is set to spawn as an Hallucinoid, it does get assigned items in the Loadout section of the Alien Deployment table; the items are loaded into the bottom right section of the Hallucinoid (where the top left section is the "main" section of 2x2 units), which is likely the reason they don't show up once the Hallucinoid is killed or stunned. Because of that, the only effect of these items is to clog up the already cramped item list. Hallucinoids don't use them anyway, as their attack is hardcoded into the exe. To remove the items from the Loadout section and thereby fix the bug, change the following addresses:

First loadout (Sonic Blasta Rifle & 2 Clips):

68DDCh: 24 -> 00

68DDDh: 25 -> 00

68DDEh: 25 -> 00

Second loadout (Sonic Cannon, 2 Clips and 2 Sonic Pulsers):

68DE1h: 22 -> 00

68DE2h: 23 -> 00

68DE3h: 23 -> 00

68DE4h: 2C -> 00

68DE5h: 2C -> 00

Third loadout (Thermal Shok Launcher & 4 Thermal Shok Bombs):

68DE6h: 2A -> 00

68DE7h: 2B -> 00

68DE8h: 2B -> 00

68DE9h: 2B -> 00

68DEAh: 2B -> 00

Link to comment
Share on other sites

The UfoPedia site lists the Race Type spawn table per set of 2 months (here), with percentages and race types changing over time. I've managed to track down that file within the GeoScape.exe file, but I find something different. Not only is the table not accessed in blocks of 2 months, but I am also not seeing specific indices for the Ship Terror missions. As such, the information in the listed table on the UfoPedia site may be correct, but I can't confirm or deny it at this moment.

 

(Update: I've found the Ship Terror reference. When it spawns a Ship Terror site, it will populate it with the row in the fourth table, that corresponds to the Alien Surface Attacks. This is a hard link).

 

Within the GeoScape.exe file, the table starts at address 74A08h and is composed of 35 entries of 10 bytes each. This is split up across 5 distinct sub-tables, each with 7 rows, 1 row per mission type. The subroutine that handles the pointer into the correct table makes a determination based on ingame month. For month 0, it uses the first one. For month 1 and 2, it uses the second one. For month 3, 4 and 5 it points to the third one, while for month 6, 7 and 8 it points to the fourth. For all other months, it points to the fifth.

 

I also assume that month 0 is january 2040, contrary to information that it represents december 2039, since the game starts at january 1st, 2040, at noon. The game has a lot of data tables that point to month 0, which would essentially be redundant if that would be december 2039 instead. Anyway, derived from the game itself:

 

Month: 0 (january)

Alien Race Type: AQUA GILL LOBS TASO M-TA M-LO

Alien Probe Mission 70% 30% 0% 0% 0% 0%

Alien Interdiction 50% 50% 0% 0% 0% 0%

Alien Resource Raid 60% 40% 0% 0% 0% 0%

Alien Infiltration 60% 40% 0% 0% 0% 0%

Alien Colony Expansion 30% 70% 0% 0% 0% 0%

Alien Surface Attacks 0% 100% 0% 0% 0% 0%

Floating Base Attack 60% 40% 0% 0% 0% 0%

 

Month 1 & 2 (february & march)

Alien Race Type: AQUA GILL LOBS TASO M-TA M-LO

Alien Probe Mission 60% 30% 10% 0% 0% 0%

Alien Interdiction 50% 50% 0% 0% 0% 0%

Alien Resource Raid 40% 60% 0% 0% 0% 0%

Alien Infiltration 50% 30% 20% 0% 0% 0%

Alien Colony Expansion 40% 40% 20% 0% 0% 0%

Alien Surface Attacks 20% 80% 0% 0% 0% 0%

Floating Base Attack 30% 40% 30% 0% 0% 0%

 

Month 3, 4 & 5 (april, may & june)

Alien Race Type: AQUA GILL LOBS TASO M-TA M-LO

Alien Probe Mission 30% 40% 30% 0% 0% 0%

Alien Interdiction 30% 50% 20% 0% 0% 0%

Alien Resource Raid 50% 50% 0% 0% 0% 0%

Alien Infiltration 20% 50% 30% 0% 0% 0%

Alien Colony Expansion 10% 30% 60% 0% 0% 0%

Alien Surface Attacks 20% 30% 50% 0% 0% 0%

Floating Base Attack 20% 60% 20% 0% 0% 0%

 

Month 6, 7 & 8 (july, august & september)

Alien Race Type: AQUA GILL LOBS TASO M-TA M-LO

Alien Probe Mission 20% 10% 40% 30% 0% 0%

Alien Interdiction 10% 0% 40% 50% 0% 0%

Alien Resource Raid 30% 0% 0% 70% 0% 0%

Alien Infiltration 10% 30% 20% 40% 0% 0%

Alien Colony Expansion 10% 40% 30% 20% 0% 0%

Alien Surface Attacks 10% 30% 20% 20% 20% 0%

Floating Base Attack 20% 30% 30% 20% 0% 0%

 

Month 9+ (october and beyond)

Alien Race Type: AQUA GILL LOBS TASO M-TA M-LO

Alien Probe Mission 20% 20% 20% 40% 0% 0%

Alien Interdiction 30% 0% 30% 40% 0% 0%

Alien Resource Raid 50% 0% 0% 50% 0% 0%

Alien Infiltration 20% 20% 50% 10% 0% 0%

Alien Colony Expansion 10% 20% 60% 10% 0% 0%

Alien Surface Attacks 20% 20% 20% 10% 30% 0%

Floating Base Attack 10% 10% 60% 20% 0% 0%

 

The note on the UfoPedia site about specific sites holds: Artefact Sites Stage 1 and Stage 2 are of the Mixed Tasoth type, just as Alien Colony Stage 1 missions. Alien Colony Stage 2 are based on Lobster Man (not the Mixed one). T'Leth Stage 1 is Aquatoid, Stage 2 is Mixed Lobster Man, as is Stage 3.

Link to comment
Share on other sites

As I had a hand in setting up the page many years ago, the determination that the stages were in 2 month blocks was obtained from observational evidence (from UFO) rather than a direct code dig to check what was happening.

 

3 month blocks may be more accurate and explains why I was noticing aliens only scheduled to appear the block of months before show up in the month after. It was a very heavily modified table so that only one race showed up all year round except for which ever stage I was wanting to test.

 

Dec 2039 was only included to keep Stage 0 symmetrical with the other stages, the game otherwise starts on Jan 2040.

 

- NKF

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...