aliens

Author Topic: Can someone explain how alien missions are generated?  (Read 17030 times)

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #15 on: July 24, 2014, 03:59:54 am »
there is no fixed timer
there is the "possibleMissions"-list in the save that is generated at start of the game
if the list is empty after all mission are executed the list will be newly generated
my best guess in the code would be in AlienStrategy::chooseRandomRegion

Well, if the 2000 number is merely an estimate then I'd advance it. I've been compiling all the mission weights to compare them and see the most probable missions and there are 51 possible Base, Abductions, Infiltration, Research and Harvest missions. On the first year you have 5 (1 mission until June) + 14 or 19 missions. On 2000 you get a total of 24 missions, leaving 8 for 2001.

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #16 on: July 24, 2014, 04:51:37 am »
each region only gets at most one mission type
so there are no two harvest missions in europe only one (till mission reset) - the race assignment is done when the mission goes from possible to "real"

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #17 on: July 24, 2014, 05:10:23 am »
each region only gets at most one mission type
so there are no two harvest missions in europe only one (till mission reset) - the race assignment is done when the mission goes from possible to "real"

Warboy said differently

once a mission has ended, that particular mission/region combination won't pop up again (except terror, retaliation, supply and infiltration)

But if it is as you say, then it doesn't make sense either. There are only 12 regions that have UFO missions assigned so the list would have to refill still on 1999 since the first year has 19 missions (Base, Infiltration, etc.)

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #18 on: July 24, 2014, 05:23:58 am »
warboy told me that the race is assigned at mission creation (possible mission != creation)
new game -> save -> editor
Code: [Select]
  possibleMissions:
    - region: STR_ANTARCTICA
      missions:
        STR_ALIEN_BASE: 35
        STR_ALIEN_RESEARCH: 25
    - region: STR_ARCTIC
      missions:
        STR_ALIEN_BASE: 35
        STR_ALIEN_RESEARCH: 25
    - region: STR_AUSTRALASIA
      missions:
        STR_ALIEN_ABDUCTION: 4
        STR_ALIEN_BASE: 16
        STR_ALIEN_HARVEST: 11
        STR_ALIEN_INFILTRATION: 8
        STR_ALIEN_RESEARCH: 15
    - region: STR_CENTRAL_ASIA
      missions:
        STR_ALIEN_ABDUCTION: 6
        STR_ALIEN_BASE: 8
        STR_ALIEN_HARVEST: 5
        STR_ALIEN_INFILTRATION: 10
        STR_ALIEN_RESEARCH: 5
    - region: STR_EUROPE
      missions:
        STR_ALIEN_ABDUCTION: 15
        STR_ALIEN_BASE: 6
        STR_ALIEN_HARVEST: 10
        STR_ALIEN_INFILTRATION: 20
        STR_ALIEN_RESEARCH: 10
    - region: STR_INDIAN_OCEAN
      missions: ~
    - region: STR_NORTH_AFRICA
      missions:
        STR_ALIEN_ABDUCTION: 8
        STR_ALIEN_BASE: 19
        STR_ALIEN_HARVEST: 8
        STR_ALIEN_INFILTRATION: 8
        STR_ALIEN_RESEARCH: 8
    - region: STR_NORTH_AMERICA
      missions:
        STR_ALIEN_ABDUCTION: 20
        STR_ALIEN_BASE: 20
        STR_ALIEN_HARVEST: 17
        STR_ALIEN_INFILTRATION: 20
        STR_ALIEN_RESEARCH: 14
    - region: STR_NORTH_ATLANTIC
      missions: ~
    - region: STR_PACIFIC
      missions:
        STR_ALIEN_BASE: 27
        STR_ALIEN_RESEARCH: 15
    - region: STR_SIBERIA
      missions:
        STR_ALIEN_ABDUCTION: 4
        STR_ALIEN_BASE: 9
        STR_ALIEN_RESEARCH: 6
    - region: STR_SOUTHERN_AFRICA
      missions:
        STR_ALIEN_ABDUCTION: 8
        STR_ALIEN_BASE: 9
        STR_ALIEN_HARVEST: 8
        STR_ALIEN_INFILTRATION: 8
    - region: STR_SOUTH_AMERICA
      missions:
        STR_ALIEN_ABDUCTION: 12
        STR_ALIEN_BASE: 22
        STR_ALIEN_HARVEST: 24
        STR_ALIEN_INFILTRATION: 18
        STR_ALIEN_RESEARCH: 10
    - region: STR_SOUTH_ATLANTIC
      missions: ~
    - region: STR_SOUTH_EAST_ASIA
      missions:
        STR_ALIEN_ABDUCTION: 21
        STR_ALIEN_BASE: 8
        STR_ALIEN_HARVEST: 13
        STR_ALIEN_INFILTRATION: 13
        STR_ALIEN_RESEARCH: 8
there are 48 missions in the list

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #19 on: July 24, 2014, 05:41:31 am »
there are 48 missions in the list

48 is correct, miscounted there.

Let's see if Warboy can clear this out. I'm curious if the resetting of the alien missions happens when there is none left (which make them more predictable) or if it resets before that.

This is also interesting:
Code: [Select]
if (monthsPassed >= 14 - (int)(_game->getSavedGame()->getDifficulty())
|| _game->getSavedGame()->isResearched("STR_THE_MARTIAN_SOLUTION"))
{
newRetaliation = true;
}

Essentially you get the additional retaliation mission is added either by reaching the end of 1999/2000 (month depends on the difficulty level) or by researching The Martian Solution.
« Last Edit: July 24, 2014, 05:47:43 am by Hobbes »

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #20 on: July 24, 2014, 05:43:31 pm »
Being going through the code and I think I found the function that refills the mission pool at AlienStrategy, if I'm reading this correctly:

Code: [Select]
const std::string AlienStrategy::chooseRandomRegion(const Ruleset *rules)
{
std::string chosen = _regionChances.choose();
if (chosen == "")
{
init(rules);
chosen = _regionChances.choose();
}
assert ("" != chosen);
return chosen;
}

The game removes a region from the list of possible choices  by setting the regionChance to 0 once there are no more missions available. But when the choice for a region turns empty, it resets the Mission and Region weight values on the ruleset before choosing again.

If this is correct than it means that the mission list is refreshed around 2001 and not 2000.

Offline Falko

  • Commander
  • *****
  • Posts: 802
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #21 on: July 24, 2014, 06:23:44 pm »
my best guess in the code would be in AlienStrategy::chooseRandomRegion
your guess is as good as mine :)
not sure how many missions are there per year or if the "emptying" happens in nov 00 or mar 01 - if you add mods with new missions its further away

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #22 on: July 24, 2014, 06:36:56 pm »
your guess is as good as mine :)
not sure how many missions are there per year or if the "emptying" happens in nov 00 or mar 01 - if you add mods with new missions its further away

This is what determines the number of random missions:

Code: [Select]
determineAlienMissions();
if (monthsPassed > 5)
determineAlienMissions();

For the first 5 months you get Alien Research + 4 random missions, for a total of 5 missions. In addition you also get Alien Terror once a month and, by the end of 1999 and beginning of 2000 (depends on the difficulty level) a Retaliation mission is added.

Starting on the 6th month you get 2 random missions per month, so 14 missions for 7 remaining months, for a yearly total of 19 missions in 1999. And on 2000, that's 24 random missions, with 5 missions remaining for 2001.

Of course, all of this applies only to vanilla since adding new random missions will push forward the March 2001 date.

Offline richardhead

  • Sergeant
  • **
  • Posts: 16
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #23 on: February 07, 2019, 11:06:05 pm »
I would like to slow down alien activity. Toward the end of the game im shooting down 3-10 ships A DAY!  I can barely get time to pass at all just shooting down ships, if I tried to recover every ship I shot down the game would take forever!

Online Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9089
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #24 on: February 07, 2019, 11:45:40 pm »
I would like to slow down alien activity. Toward the end of the game im shooting down 3-10 ships A DAY!  I can barely get time to pass at all just shooting down ships, if I tried to recover every ship I shot down the game would take forever!

it's the game telling you to stop messing around and go to cydonia already...

Offline Hobbes

  • Commander
  • *****
  • Posts: 2102
  • Infiltration subroutine in progress
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #25 on: February 07, 2019, 11:46:51 pm »
I would like to slow down alien activity. Toward the end of the game im shooting down 3-10 ships A DAY!  I can barely get time to pass at all just shooting down ships, if I tried to recover every ship I shot down the game would take forever!

A couple of tips:
* You don't really need to expand your base network to cover the entire globe. You can win by building just a couple of additional bases, or none at all (the 1 base challenge). That way, you don't detect so many UFOs
* You don't get any penalty if you shoot down the UFO and then don't assault it afterwards. You already got the score from shooting it down, so unless you're desperate for cash or want to train rookies, let the crashed UFOs disappear