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

Offline robin

  • Commander
  • *****
  • Posts: 983
  • ULTIMATE ROOKIE
    • View Profile
Can someone explain how alien missions are generated?
« on: June 16, 2014, 10:44:13 pm »
regions:
  - type: SOMEREGION
    missionWeights:

alienMissions:
    [...]
    waves:
        count:
        timer:


I tried different values but I can't figure it out, I have to put "ridiculous" values (like 'missionWeights: STR_MISSION: 250') to get the mission generated with some frequency. And even then I seem to get no mission of that kind on the first month, but lots on the second which seems strange to me (tested with hyper-waver decoder).
(If a bit more background is needed, I'm actually speaking about the STR_MIB_COVERUP mission form my men in black mod. With the current values it seems it almost never gets generated).

Might be that missions on the same ufo trajectory gets "canceled" if there is already one ongoing?
If someone could clarify a bit it could be helpful.

Thanks

Offline Falko

  • Commander
  • *****
  • Posts: 810
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #1 on: June 16, 2014, 11:12:29 pm »
the first mission is always alien_research ..
iirc you get one terror per month
but i cant say how many other missions you get in the first month

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2312
  • Developer
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #2 on: June 17, 2014, 12:11:07 am »
month 1: one alien research mission, one terror mission. shooting down UFOs may trigger a retaliation mission.
month 2: one randomly selected mission, one terror mission, missions from previous months continue. shooting down UFOs may trigger a retaliation mission.
repeat until:
month 6: two randomly selected missions, one terror mission, missions from previous months continue. shooting down UFOs may trigger a retaliation mission.
repeat until:
month 12-ish: two randomly selected missions, one terror mission, one alien retaliation mission, missions from previous months continue. shooting down UFOs may trigger a retaliation mission.
« Last Edit: June 17, 2014, 12:13:58 am by Warboy1982 »

Offline robin

  • Commander
  • *****
  • Posts: 983
  • ULTIMATE ROOKIE
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #3 on: June 17, 2014, 12:47:16 am »
month 1: one alien research mission, one terror mission. shooting down UFOs may trigger a retaliation mission.
month 2: one randomly selected mission, one terror mission, missions from previous months continue. shooting down UFOs may trigger a retaliation mission.
repeat until:
month 6: two randomly selected missions, one terror mission, missions from previous months continue. shooting down UFOs may trigger a retaliation mission.
repeat until:
month 12-ish: two randomly selected missions, one terror mission, one alien retaliation mission, missions from previous months continue. shooting down UFOs may trigger a retaliation mission.
Ok, I thought it just randomly selected and executed one wave, and the mission was already over.

If I try to describe the whole process, it's actually like this:

- a region is randomly selected;
  the only factor influencing this choice is the "regionWeight" entry.

- mission STR_ALIEN_BUKKAKE is randomly selected;
  the only factor influencing this choice is "missionWeight" for the mission in the selected region.

- after 'timer', the first listed wave is executed, and the related 'count' ufos are spawned;
- the ufo (or ufos) goes over its 'trajectory' until it reaches the exit point (last coordinate of trajectory);
- the first wave is over;
- after 'timer', the second listed wave is executed, and the related 'count' ufos are spawned;
- the ufo (or ufos) goes over its 'trajectory' until it reaches the exit point (last coordinate of trajectory);
- the second wave is over;
(..and so on, in descending order, until it gets at the bottom of the list of waves for the STR_ALIEN_BUKKAKE mission).

- the mission then is over;
       if the month is not over: it waits the end of the month and then it starts the whole process from the beginning;
       if the month already switched to the next: it immediately re-starts the process.

?
« Last Edit: June 17, 2014, 01:09:42 am by robin »

Offline Falko

  • Commander
  • *****
  • Posts: 810
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #4 on: June 17, 2014, 01:05:24 am »
the missions are generated at start
take a look at a save file you will find something like this
Code: [Select]
alienStrategy:
  regions:
    STR_ANTARCTICA: 4
    STR_SOUTHERN_AFRICA: 8
    STR_NORTH_AMERICA: 18
    STR_SOUTH_AMERICA: 10
    STR_EUROPE: 16
...
  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_BASE: 16
        STR_ALIEN_HARVEST: 11
        STR_ALIEN_ABDUCTION: 4
      region: STR_EUROPE
    - region: STR_NORTH_AFRICA
      missions:
        STR_ALIEN_RESEARCH: 8
        STR_ALIEN_ABDUCTION: 8
...
the regions part shows the likelihood what target-region is selected for the next mission
within the region the number show the likelyhood of a mission within this region
if a region/mission combo is selscted it will be deleted from the list
if all missione are done the list will be newly generated - so if you add a mod with new mission you need you play some time (iirc mid 2000?) until the list is empty and is regenerated with the new missions
i hope the devs correct me i if i am wrong

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2312
  • Developer
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #5 on: June 17, 2014, 01:05:33 am »
once the last ufo from the last wave of the mission has been removed from play, the mission ends.
completely regardless of the time of month. when i say "missions from the previous months continue" i mean that literally, any missions that haven't ended continue until they end.
once a mission has ended, that particular mission/region combination won't pop up again (except terror, retaliation, supply and infiltration)

what falko stated is correct, but the caveat about waiting until 2000 only applies to saved games, not new ones.
« Last Edit: June 17, 2014, 01:07:46 am by Warboy1982 »

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 8532
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Can someone explain how alien missions are generated?
« Reply #6 on: June 17, 2014, 01:52:04 am »
once a mission has ended, that particular mission/region combination won't pop up again (except terror, retaliation, supply and infiltration)

Warboy, does it mean that once aliens complete (or fail to complete) a, say, Alien Base mission in Europe, they will never undertake this mission again, even if the player blows up the base or prevents the base from being built at all?

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2312
  • Developer
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #7 on: June 17, 2014, 02:06:15 am »
until the mission reset in 2000, yes, although countries signing pacts from infiltration (which continues indefinitely) also generate bases

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 8532
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Can someone explain how alien missions are generated?
« Reply #8 on: June 17, 2014, 04:32:07 am »
until the mission reset in 2000, yes, although countries signing pacts from infiltration (which continues indefinitely) also generate bases

Clever. I never suspected the game is so complex.

I wonder if this feature can somehow be highlighted as part of the glamour/tactics... :)

Offline Hobbes

  • Commander
  • *****
  • Posts: 3445
  • Infiltration subroutine in progress
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #9 on: June 20, 2014, 04:12:31 pm »
month 1: one alien research mission, one terror mission. shooting down UFOs may trigger a retaliation mission.
month 2: one randomly selected mission, one terror mission, missions from previous months continue. shooting down UFOs may trigger a retaliation mission.
repeat until:
month 6: two randomly selected missions, one terror mission, missions from previous months continue. shooting down UFOs may trigger a retaliation mission.
repeat until:
month 12-ish: two randomly selected missions, one terror mission, one alien retaliation mission, missions from previous months continue. shooting down UFOs may trigger a retaliation mission.

I'm going to make a wiki page explaining how the Strategic AI works to include this info.

Are you guys thinking of allowing this part to be costumized?

Offline Warboy1982

  • Administrator
  • Commander
  • *****
  • Posts: 2312
  • Developer
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #10 on: June 20, 2014, 06:03:27 pm »
uh, possibly?

Offline Hobbes

  • Commander
  • *****
  • Posts: 3445
  • Infiltration subroutine in progress
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #11 on: June 20, 2014, 07:03:49 pm »
uh, possibly?

My question came out of curiosity rather than need. :)

There are also a few things I'm curious about:

      - ufo: STR_MEDIUM_SCOUT
        count: 1
        trajectory: P1
        timer: 15000
      - ufo: STR_LARGE_SCOUT
        count: 1
        trajectory: P1
        timer: 9600
      - ufo: STR_TERROR_SHIP
        count: 1
        trajectory: P0
        timer: 12000
      - ufo: STR_TERROR_SHIP
        count: 1
        trajectory: P7
        timer: 9000

From my recollection of the original game, you'd get first a scout, then the Terror Ship and there would be a chance that the scout failed to pick a target or that it would be shot down. I'm guessing that the first 3 UFOs listed are scouts and the final UFO is the one that actually performs the terror attack, if one of the scouts picks a target, but they fail, does the last UFO still gets generated?

And the value after timer, is it minutes?

Offline Solarius Scorch

  • Global Moderator
  • Commander
  • *****
  • Posts: 8532
  • WE MUST DISSENT
    • View Profile
    • Nocturmal Productions modding studio website
Re: Can someone explain how alien missions are generated?
« Reply #12 on: June 20, 2014, 07:07:44 pm »
The first UFO is hard-coded to be an Alien Research mission with Sectoids. Therefore I think it works outside of the normal pattern.

Offline Hobbes

  • Commander
  • *****
  • Posts: 3445
  • Infiltration subroutine in progress
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #13 on: July 24, 2014, 03:33:45 am »
until the mission reset in 2000

Can anyone point me to where in the code this is located? I've been collecting all the info about Alien Mission Generation and looking at GeoscapeState.

Offline Falko

  • Commander
  • *****
  • Posts: 810
    • View Profile
Re: Can someone explain how alien missions are generated?
« Reply #14 on: July 24, 2014, 03:45:38 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