Author Topic: Alien Missions vs. Alien Attacks  (Read 8130 times)

Offline grzegorj

  • Captain
  • ***
  • Posts: 87
  • grzegorj and Sherlock are my nicknames...
    • View Profile
    • X-COM
Alien Missions vs. Alien Attacks
« on: September 14, 2014, 04:14:07 pm »
Perhaps I have found a solution to a problem once been discussed on Ufopaedia. The problem is of a big importance for the game.

UFO / TFTD game researchers found alien appearence ratios in the game exe file. It appeared that also the Alien Retaliation mission has such ratios set. On the other side, it was said that alien attacks on XCom bases are always responses to XCom activity, occurring with some chance, and it is always the XCom-suffering alien race which responds - so the appearence ratios in the game seemed to be of no use. They were said to be superfluous (https://www.ufopaedia.org/index.php?title=Alien_Appearance_Ratios: "All Retaliation rows are unused. Retaliation missions are generated in response to shooting down enemy craft, with a set probability that is scaled by the difficulty level multiplier.").

It was also observed that (during TFTD playing) Tasoths were able to attack a ship route as early as in April 2040 even if the first appearance of that race should be in June 2040 (see Ufopaedia: https://www.ufopaedia.org/index.php?title=Alien_Appearance_Ratios_(TFTD)). Contrary to the popular opinion, no flying/floating USO recording used to be done just before the attack. It seemed that the aliens emerged from the deep, not from a USO.

Similarly, it was observed in UFO:EU that some terror attacks may happen very early in the campaign, even in the first week, and no preceding Terror Ship flights were observed even if they should be (e.g. when the terrorized city was not too far from the XCom base).

I think I have solved all the above problems. Namely, according to my observations, there are TWO DIFFERENT general Alien activity types. The first type are the well-known alien missions, each containing several phases of scheduled UFO/USO appearances, and chosen by the game engine in accordance with the alien appearance ratios. The other type are aliens single attacks that are not scheduled, not in accordance with the ratios, and not consisting of any phases (hence "single").

So, it seems that the aliens take a part in both (a) missions and (b) single attacks which are not part of any mission (and thus are not scheduled). Single attacks mean, among others, city terror attacks (in TFTD: shipping route, port and island terror attacks), not recorded before, not preceded by an appearance of any UFO/USO (the aliens attack immediately) and not in agreement with the appearance tables. Hence Ethereals (UFO:EU) or Tasoths (TFTD) may appear as early as in April, hence aliens may terrorize land as early as in the first days of the campaign, without smaller UFOs preceding the attack.

Single terror attacks are frequent in first months, then (exactly when?) they seem to cease. Aliens can still terrorize cities (UFO) or ships, ports and islands (TFTD) but only (mainly?) during their Alien Terror / Alien Surface Attacks missions rather than single attacks. Of course - if such a type of mission has been chosen for a current month. It is also quite probable that shooting down UFOs/USOs during first phases of the mission can stop it, and finally no terror will occur. Or (which one is true?): it will prevent aliens from knowing the localization of the city (port, island, ship route). As the result, the final UFO/USO (Terror Ship in UFO:EU and Battleship in TFTD) will appear but not find its target.

As it seems to me, a similar dual mechanism lies behind alien attacks on XCom bases. Some of the attacks are a result of an alien response to shooting down a UFO / downing a USO (with a chance of occurrence which depends on the game difficulty level). Contrary to single terror attacks, a Battleship (UFO) / Dreadnought (TFTD) always appears then before the attack. The aliens know exactly where the XCom base is located, so nothing can help XCom to avoid the battle, and the UFO/USO moves straight to the base. Appearance ratios are of no use then - it is the same race which responds, as the race whose UFO/USO has been downed by XCom.

These single attacks in response to UFO/USO downing seem to have nothing to do with Alien Retaliation / Floating Base Attack missions. Like other of the 7 mission types altogether, Alien Retaliations / Floating Base Attacks are scheduled and consist of several phases. Such a mission must be chosen for the current month (together with another mission - two missions start a month). It is quite probable (but not confirmed!) that the mission region (chosen at the beginning of a new month) must contain an existing XCom base. Smaller UFOs/USOs happening on the first phases of the mission are scouts which help aliens to locate the base (otherwise unknown, unlike during a single attack). Shooting them down can also stop the occurring of the further phases of the mission, and as a result, no Battleships / Dreadnoughts will appear finally. Alien Appearence Ratios are applied, contrary to what is said in Ufopaedia (so the data are not superfluous). It is also only a chance that the aliens will find the XCom base location (unlike single attacks when the Aliens always know where the base is located, without a preceding reconnaissance).

In UFO and TFTD the aliens start two missions each month. It is known nothing about single attacks: what is the exact number of them, or even if they depends on time at all (perhaps there are moths with no single attacks, and months with several single attacks). However, observations suggest that they stop at a certain moment of the campaign (or become very rare). Anyway, multi-phase missions dominate over single attacks (if any still possible) in later months of the game.

I would like to know if my observations (as it's been seen, partially not in accordance with Ufopaedia) are correct, and if not, how to explain the observed game behaviour.

My second question is how it all works in OXC. Are multi-phase missions and single attacks distinguished? Are the aliens able to terrorize a city as early as, say, on 1st January 1999? Does the number of single attacks (those terror ones and on XCom bases) depend on the current month, and how (e.g. two attack a month, together with two missions starting)? Is there a possibility e.g. for Ethereals to appear as early as in the first month of the campaign (during a single, non-scheduled, city terror attack)? And if appearance ratios / rules exist in the game, what are they like? The above mentioned April Tasoths (and also probably April Ethereals) suggest that they should not be the same appearance ratios as in alien missions.

In the original game, two new Alien missions start each month. Is it hardcoded in OXC, or can be modded? And: is it possible to change the rule of starting alien missions (in a game mod, to make the campaign different that in the original game) that they would start in a day chosen by chance and not the first day of each month?

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Alien Missions vs. Alien Attacks
« Reply #1 on: September 15, 2014, 05:05:35 pm »
Check this thread https://openxcom.org/forum/index.php?topic=2293.0 for an explanation by Warboy of how the mission generation works.

Offline Dioxine

  • Commander
  • *****
  • Posts: 5458
  • punk not dead
    • View Profile
    • Nocturnal Productions
Re: Alien Missions vs. Alien Attacks
« Reply #2 on: September 16, 2014, 01:20:58 am »
I don't think any mission can be stopped once it has started. Shooting down UFOs induces huge delays though.

It is not possible for a Terror Ship to not find any target. However, note that Terror mission final phase consists of 2 Terror Ships. The first one just makes a fly-by, the second one picks a random city in the region to attack. Shooting that very last one Terror Ship seems to avert Terror from occuring.

It is confirmed that the race conducting retaliation has nothing to do with their order of appearance. You shoot down Sectoid UFO in January, you may be instantly targetted by Ethereal retaliation.

It is worth noting that "Retaliation Mission" is actually a mission where the aliens seek your base. An attack on your base is not a part of this mission per se. "Retaliation Attack Run" - consisting of a single Battleship heading straight for your base at full speed - is closely related to the Retal mission, but a separate event none the less. I think the Attack Run is commenced immediately after your base has been found, regardless of any missions, and the attacking race is the same as the one who *found* your base; any unfinished waves of Retaliation Mission are cancelled. Killing the battleship makes the aliens immediately send another one.

This mechanics could explain "out of the blue" attacks on your bases (spotted, say, by a Scout you failed to notice), but cannot explain early terrors - IF they happen. Theoretically, though, the Attack Run can be performed without any preceding Retal mission... All it takes is for the aliens to "learn" the location of your base.

This is all I know about this intriguing issue...
« Last Edit: September 16, 2014, 01:27:24 am by Dioxine »

Offline grzegorj

  • Captain
  • ***
  • Posts: 87
  • grzegorj and Sherlock are my nicknames...
    • View Profile
    • X-COM
Re: Alien Missions vs. Alien Attacks
« Reply #3 on: October 02, 2014, 06:49:05 pm »
So, modders cannot change the scheme of mission appearance, only frequency of their types (plus add completely new types). It is a pity...

I am under impression that the number of started, scheduled missions depends on the difficulty level of the game in UFO:EU. I will check it when time allows. Hopefully, it is not too hard to read from UFO:EU data files in this respect (even if a program translating [most of] the savegame into a text savegame in OXC-type would be much nicer...). And the game itself runs without any problems (with the help of DosBox) on my computer.

But in the thread at which Hobbes points I have not found a word on terror attacks not being part of any mission (and not scheduled in UFO:EU). Such attacks are absolutely sure in both UFO:EU and TFTD. For example, there is a possibility to have a terror mission (in UFO:EU at least) in the second day of the game (with no Scouts preceding, and with no observed Terror Ship flies). OXC seems to have this kind of alien activity programmed. It is good!

It seems to me that such "out of the blue" attacks are possible in first months only. In TFTD, "Alien Activities" ("first type alien bases") seem to stop such terror attacks from occurring. Or, if an alien base (in TFTD: the normal one, the one of the 2nd type) was generated (always only by a country that has signed pact with aliens?), it can also prevent "out of the blue" terror attacks.

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Alien Missions vs. Alien Attacks
« Reply #4 on: October 02, 2014, 07:49:28 pm »
But in the thread at which Hobbes points I have not found a word on terror attacks not being part of any mission (and not scheduled in UFO:EU). Such attacks are absolutely sure in both UFO:EU and TFTD. For example, there is a possibility to have a terror mission (in UFO:EU at least) in the second day of the game (with no Scouts preceding, and with no observed Terror Ship flies). OXC seems to have this kind of alien activity programmed. It is good!

I think you are suffering from confirmation bias regarding this issue of 'alien attacks'.

I'll say it again (already did it before): there are no such things as isolated alien attacks on UFO:EU where no UFOs are generated before the mission. (I can't speak 100% for TFTD since I haven't seen code for it yet and I suspect the Artifact Sites are generated without UFOs).

And to my knowledge, there's no code on OXC that generates 'Alien Attacks' - please point it out if you know where it is, otherwise you have no proof that it happens. The code that generates terror sites can be found on here

Or, to be more precise:
Code: [Select]
else
{
https:// UFO landed.

if (ufo.getRules()->getType() == "STR_TERROR_SHIP" && _rule.getType() == "STR_ALIEN_TERROR" && trajectory.getZone(curWaypoint) == RuleRegion::CITY_MISSION_ZONE)
{
https:// Specialized: STR_ALIEN_TERROR
https:// Remove UFO, replace with TerrorSite.
addScore(ufo.getLongitude(), ufo.getLatitude(), engine);
ufo.setStatus(Ufo::DESTROYED);
TerrorSite *terrorSite = new TerrorSite();
terrorSite->setLongitude(ufo.getLongitude());
terrorSite->setLatitude(ufo.getLatitude());
terrorSite->setId(game.getId("STR_TERROR_SITE"));
terrorSite->setSecondsRemaining(4 * 3600 + RNG::generate(0, 6) * 3600);
terrorSite->setAlienRace(_race);

The TerrorSite function is only called when there's a Terror Ship (STR_TERROR_SHIP) with a defined terror mission (STR_ALIEN_TERROR) and the UFO trajectory has a defined city (CITY_MISSION_ZONE). If all of those are positive it then calls the TerrorSite function to create and place a new Terror Site, definining its location, id, timer and race.

Otherwise, there's no instance on the OXC code where the TerrorSite function is called, which shows that 'Alien Attacks' don't happen and Terror Sites can only be generated through alien missions.

What can happen is that you've failed to detect the scout UFO or the following Terror Ship that initiates the Terror Site. Quoting from the Large Radar description: "Each system has a 5% chance of detecting an average sized object every 10 minutes.". Since Terror Ships quickly head to their target cities after arriving at the region you have a very low chance of detecting them before the terror site appears. Once you build the Hyperwave Decoder on a world region, you'll see all those UFOs that previously went undetected. Before the Decoder, 5% is a really low odd to detect UFOs, unless they spend a lot of time airborne or on the ground. 

But if you need to 'see' that there are no alien attacks and that all Terror Sites are generated by UFOs, try the Missions Test mod I've attached below: it replaces the starting Small Radar with a Hyperwave Decoder that has its range increased to cover the entire globe.
« Last Edit: October 02, 2014, 09:00:02 pm by Hobbes »

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Alien Missions vs. Alien Attacks
« Reply #5 on: October 02, 2014, 08:38:42 pm »
So, modders cannot change the scheme of mission appearance, only frequency of their types (plus add completely new types). It is a pity...

I am under impression that the number of started, scheduled missions depends on the difficulty level of the game in UFO:EU.

The only thing that the difficulty level affects is when you start getting automatic retaliation missions:

Code: [Select]
void GeoscapeState::time1Month()
{
_game->getSavedGame()->addMonth();

int monthsPassed = _game->getSavedGame()->getMonthsPassed();
bool newRetaliation = false;

https:// Determine alien mission for this month.
determineAlienMissions();
if (monthsPassed > 5)
determineAlienMissions();

setupTerrorMission();

if (monthsPassed >= 14 - (int)(_game->getSavedGame()->getDifficulty())
|| _game->getSavedGame()->isResearched("STR_THE_MARTIAN_SOLUTION"))
{
newRetaliation = true;
}

With Superhuman being difficulty = 4, that means that 14 - 4 = 10, or around November (with January being 0) you get the first automatic retaliation (unless you have researched The Martian Solution, which automatically triggers the retaliations), lower difficulty levels push the month forward.

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2333
  • Developer
    • View Profile
Re: Alien Missions vs. Alien Attacks
« Reply #6 on: October 03, 2014, 02:28:50 am »
colour me impressed, Hobbes, i couldn't have explained it better myself.
i can't speak for TFTD yet, as i haven't really figured out how artefact/terror misions are generated. i'll have more info on that when i finish up in the battlescape, but as far as Enemy Unknown is concerned, that's how it works, and indeed how it worked in the original. the only difference is the mission reset in 2001-ish (+- randomness and xcom interference)

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Alien Missions vs. Alien Attacks
« Reply #7 on: October 03, 2014, 04:47:15 am »
colour me impressed, Hobbes, i couldn't have explained it better myself.
i can't speak for TFTD yet, as i haven't really figured out how artefact/terror misions are generated. i'll have more info on that when i finish up in the battlescape, but as far as Enemy Unknown is concerned, that's how it works, and indeed how it worked in the original. the only difference is the mission reset in 2001-ish (+- randomness and xcom interference)

Hey, you were the one who first pointed me to all of this, so I'd say you made a good job yourself of explaining it. :)

As I said, my memory is that it is impossible to stop Artifact Sites from popping up. From what I recall they only appear after a certain month has passed and then they appear regularly but I don't think it's on a monthly basis. But all of this should be taken with a grain of salt since I haven't played TFTD in years and memory plays tricks on people.

Offline BBHood217

  • Commander
  • *****
  • Posts: 540
    • View Profile
Re: Alien Missions vs. Alien Attacks
« Reply #8 on: October 18, 2014, 03:57:40 pm »
From my experience with TFTD, shipping route terror attacks and artifact sites happen somewhere at the start of a month.  And they just happen, there's no alien sub that lands to start one or whatever.  In fact, I remember one game where a battlesub (not calling it a battleship to avoid confusion with the UFO battleship) was doing a terror mission (or surface attack, whatever) at the end of the month.  It didn't land and attack until the first day the next month and around that time, a shipping route terror attack occured elsewhere.  So now I had two terror missions happening simultaneously.  It wasn't fun, and I think I remember having to ignore one of them too.

I also remember that eventually, the aliens just stop with the surface attack missions and do nothing but attack shipping lanes/activate artifact sites for terror missions.  Bleh, another reason why I call it Tedium from the Deep.